repository

repository is a cursor rule for Cursor from hiromaily/go-crypto-wallet. It costs 0 tokens per session (1,938 once invoked), scanned A, original, MIT.

Rules for the repository pattern in a Go cryptocurrency wallet. Repositories hide data access and convert between domain objects and storage-specific records, while interfaces and implementations live in separate layers.

In plain words
What is it for?
Use it when adding data access for cold or watch wallets, including accounts, seeds, addresses, and transactions. It guides repository interfaces, MySQL implementations, naming, and test mocks.
Why use it?
It prevents application code from depending directly on MySQL, SQL-generated code, or other storage details. Storage can change while the rest of the application continues using the same repository interface.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding data access for cold or watch wallets, including accounts, seeds, addresses, and transactions. It guides repository interfaces, MySQL implementations, naming, and test mocks.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/hiromaily/go-crypto-wallet/repository
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/hiromaily/go-crypto-wallet

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for repository

README.md
[![agentmods](https://agentmods.dev/badge/rules/hiromaily/go-crypto-wallet/repository/github.svg)](https://agentmods.dev/rules/hiromaily/go-crypto-wallet/repository)
Your own site
<a href="https://agentmods.dev/rules/hiromaily/go-crypto-wallet/repository"><img src="https://agentmods.dev/badge/rules/hiromaily/go-crypto-wallet/repository/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for repository

Your own site · 80×15
<a href="https://agentmods.dev/rules/hiromaily/go-crypto-wallet/repository"><img src="https://agentmods.dev/badge/rules/hiromaily/go-crypto-wallet/repository.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,938 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01938
Opus 5 $0.00000 $0.00969
Sonnet 5 $0.00000 $0.00388
Haiku 4.5 $0.00000 $0.00194

Measured 8d ago against content hash 3083218daceb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

repository scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/internal/repository.mdc · 309 lines

How it starts

The opening of the file, as written. The whole thing — 309 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Repository Pattern

Overview

Rules for implementing Repository pattern in go-crypto-wallet. Repositories abstract data access and map between domain entities and infrastructure.

Applicable Files

  • internal/application/ports/repository/**/*.go - Interface definitions (Ports)
  • internal/infrastructure/repository/**/*.go - Implementations

Architecture

internal/application/ports/repository/
├── cold/                    # Cold wallet repositories (keygen/sign)
│   ├── account_key.go       # Interface
│   ├── auth.go
│   └── seed.go
└── watch/                   # Watch wallet repositories
    ├── address.go           # Interface
    ├── btc_transaction.go
    └── ...

internal/infrastructure/repository/
├── cold/
│   ├── mysql/               # MySQL implementations
│   │   ├── account_key_sqlc.go
│   │   └── ...
│   └── mocks/               # Test mocks
│       └── mock_*.go
└── watch/
    ├── mysql/
    │   ├── address_sqlc.go
    │   └── ...
    └── mocks/
        └── mock_*.go

Interface Definition (Ports)

Naming Convention

Interface names end with er suffix:

// ✅ GOOD: Descriptive interface names
type AddressRepositorier interface { ... }
type BTCTxRepositorier interface { ... }
type SeedRepositorier interface { ... }

// ❌ BAD: Missing suffix or unclear
type AddressRepository interface { ... }
type AddressRepo interface { ... }

Interface Location

Interfaces MUST be defined in internal/application/ports/repository/:

// internal/application/ports/repository/watch/address.go
package watch

type AddressRepositorier interface {
    GetAll(accountType domainAccount.AccountType) ([]*domainAddress.Address, error)
    GetAllAddress(accountType domainAccount.AccountType) ([]string, error)
    GetOneUnAllocated(accountType domainAccount.AccountType) (*domainAddress.Address, error)
    InsertBulk(ctx context.Context, items []*domainAddress.Address) error
    UpdateIsAllocated(isAllocated bool, Address string) (int64, error)
}

Read the full file on GitHub · 309 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 309 lines · 0 tokens per session scan A 3083218daceb

Subscribe to this mod's changes

repository is a cursor rule published in the GitHub repository hiromaily/go-crypto-wallet (127 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,938 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.