go-crypto-wallet / internal
Cursor rule128 starsChanged 6 months agoMITView on GitHub
Domain Layer Rules
We split this domain-layer.mdc into the rules it gives an agent
9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 41
Add business rules and validators
- Distinctive: line 43
Create domain interfaces for infrastructure to implement
- Distinctive: line 44
Write pure functions (no side effects)
- Very specific: line 48
NEVER: import from infrastructure/, application/, or interface-adapters/
- Distinctive: line 49
NEVER: use database, API clients, or file I/O
- Very specific: line 50
NEVER: add logging (use pkg/logger/ only if absolutely necessary)
- Distinctive: line 54
Use pure unit tests without mocks
- Distinctive: line 55
Test business logic in isolation
- Distinctive: line 56
No infrastructure dependencies required
≈ “Common” is an estimate: at least 1 in 5 of the 6,350 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
description: Domain Layer Rules
globs: ["internal/domain/**/*.go"]
alwaysApply: false
---
# Domain Layer Rules
## Overview
Rules for working in the domain layer (`internal/domain/`).
The domain layer contains **pure business logic with ZERO infrastructure dependencies**.
## Key Principles
1. **NO dependencies** on infrastructure (no database, no API clients, no file I/O)
2. Defines interfaces that infrastructure must implement (Dependency Inversion)
3. Contains pure business logic testable without mocks
4. Most stable layer - changes here affect all other layers
## Structure
| Package | Purpose |
|---------|---------|
| `account/` | Account types, validators, multisig configurations |
| `address/` | Address entity and types |
| `auth/` | Authentication account keys and full public keys |
| `bitcoin/` | Bitcoin-specific types (address, transactions, inputs/outputs) |
| `coin/` | Cryptocurrency type definitions |
| `ethereum/` | Ethereum-specific types (account keys, transactions) |
| `key/` | Key value objects, validators, fingerprint, seed |
| `multisig/` | Multisig validators, MuSig2 implementation |
| `payment/` | Payment request types |
| `transaction/` | Transaction entity, types, validators |
| `wallet/` | Wallet types, descriptor builder |
| `xrp/` | XRP-specific types (constants, account keys) |
## Allowed
- Add business rules and validators
- Define value objects and entities
- Create domain interfaces for infrastructure to implement
- Write pure functions (no side effects)
## Forbidden
- **NEVER** import from `infrastructure/`, `application/`, or `interface-adapters/`
- **NEVER** use database, API clients, or file I/O
- **NEVER** add logging (use `pkg/logger/` only if absolutely necessary)
## Testing
- Use pure unit tests **without mocks**
- Test business logic in isolation
- No infrastructure dependencies required
- Tests should be fast and deterministic
## Example: Domain Interface
```go
// internal/domain/multisig/nonce_repository.go
// Domain defines the interface, infrastructure implements it
type NonceRepositorier interface {
Store(ctx context.Context, nonce *NonceCommitment) error
GetBySignerAndTx(ctx context.Context, signerID, txID string) (*NonceCommitment, error)
}
```
## Related Rules
- @.claude/rules/internal/clean-architecture.md - Layer dependency rules
- @.claude/rules/go/conventions.md - Go conventions
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 3,978 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository62 other files it gives its agents.
- AGENTS.mdAGENTS.md
- internal/AGENTS.mdAGENTS.md
- pkg/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- internal/CLAUDE.mdCLAUDE.md
- pkg/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/agent-files.mdcCursor rule
- .cursor/rules/apps/bun.mdcCursor rule
- .cursor/rules/apps/eth-contracts.mdcCursor rule
- .cursor/rules/apps/xrp-server.mdcCursor rule
- .cursor/rules/database/atlas-hcl.mdcCursor rule
- .cursor/rules/database/sqlc.mdcCursor rule
- .cursor/rules/documentation-language.mdcCursor rule
- .cursor/rules/general.mdcCursor rule
- .cursor/rules/github-actions.mdcCursor rule
- .cursor/rules/go/conventions.mdcCursor rule
- .cursor/rules/go/di.mdcCursor rule
- .cursor/rules/go/go-path.mdcCursor rule
- .cursor/rules/go/go-test.mdcCursor rule
- .cursor/rules/internal/application-layer.mdcCursor rule
- .cursor/rules/internal/btc-shared.mdcCursor rule
- .cursor/rules/internal/clean-architecture.mdcCursor rule
- .cursor/rules/internal/cli-structure.mdcCursor rule
- .cursor/rules/internal/dto.mdcCursor rule
- .cursor/rules/internal/infrastructure-layer.mdcCursor rule
- .cursor/rules/internal/interface-adapters-layer.mdcCursor rule
- .cursor/rules/internal/internal-interface.mdcCursor rule
- .cursor/rules/internal/mockery.mdcCursor rule
- .cursor/rules/internal/repository.mdcCursor rule
- .cursor/rules/internal/usecase.mdcCursor rule
- .cursor/rules/proto.mdcCursor rule
- .cursor/rules/README.mdCursor rule
- .cursor/rules/security.mdcCursor rule
- .cursor/rules/shell-script.mdcCursor rule
- .cursor/rules/ssot.mdcCursor rule
- .cursor/rules/task-context-loading.mdcCursor rule
- .cursor/rules/typescript.mdcCursor rule
- .cursor/rules/yaml.mdcCursor rule
- llms.txtllms.txt
- bch-developmentSkill
- btc-terminologySkill
- db-migrationSkill
- devopsSkill
- docs-ssotSkill
- docs-updateSkill
- fix-pr-reviewSkill
- github-issue-creationSkill
- git-workflowSkill
- go-developmentSkill
- knowledge-gapSkill
- label-context-mappingSkill
- makefile-updateSkill
- mockerySkill
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
- shell-scriptsSkill
- solidity-developmentSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

