go-crypto-wallet / internal
Cursor rule128 starsChanged 6 months agoMITView on GitHub
Application Layer Rules
We split this application-layer.mdc into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 41
Use application-layer DTOs in method signatures (NOT infrastructure types)
- Distinctive: line 63
Keep DTOs simple - no business logic
- Distinctive: line 88
Should be kept as simple as possible, and specific functionality should be delegated to shared package layers such as the domain layer or …
≈ “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: Application Layer Rules
globs: ["internal/application/**/*.go"]
alwaysApply: false
---
# Application Layer Rules
## Overview
Rules for working with the Application layer (`internal/application/`).
This layer orchestrates use cases and defines port interfaces.
## Structure
```
internal/application/
├── dto/ # Data Transfer Objects
│ ├── btc/ # Bitcoin DTOs
│ └── ripple/ # XRP DTOs
├── ports/ # Interface definitions (abstractions)
│ ├── api/ # External API interfaces (btc, eth, xrp)
│ ├── file/ # File storage interfaces
│ ├── repository/# Repository interfaces (cold, watch)
│ └── wallet/ # Wallet key generator interfaces
└── usecase/ # Use case implementations
├── keygen/ # Key generation (btc, bch, eth, xrp, shared)
├── sign/ # Signing (btc, bch, eth, xrp, shared)
├── watch/ # Watch wallet (btc, bch, eth, xrp, shared)
└── shared/ # Shared helpers
```
## Port Interfaces (`application/ports/`)
**CRITICAL**: Interfaces are defined where they are USED, not where they are implemented.
### Rules
- Define interfaces in `application/ports/` for infrastructure abstractions
- Use application-layer DTOs in method signatures (NOT infrastructure types)
- Infrastructure packages implement these interfaces
### Example
```go
// application/ports/api/btc/interface.go
package btc
import btcdto "internal/application/dto/btc"
type Bitcoiner interface {
GetBalance() (btcutil.Amount, error)
GetAddressInfo(addr string) (*btcdto.AddressInfo, error) // Uses DTO
}
```
## DTOs (`application/dto/`)
### Rules
- DTOs define data structures for port interface method signatures
- Keep DTOs simple - no business logic
- Map infrastructure types to DTOs in infrastructure layer
### Example
```go
// application/dto/btc/dto.go
package btc
type AddressInfo struct {
Address string
ScriptPubKey string
IsWitness bool
Labels []string
}
```
## Use Cases (`application/usecase/`)
### Rules
- Each use case represents a single business operation
- Depend on port interfaces, not concrete implementations
- Delegate business logic to domain layer
- Wrap errors with context
- Should be kept as simple as possible, and specific functionality should be delegated to shared package layers such as the domain layer or /pkg.
### Pattern
```go
type XxxUseCase interface {
Execute(ctx context.Context, input XxxInput) (*XxxOutput, error)
}
type xxxUseCase struct {
repo repository.SomeRepositorier // Port interface
apiClient api.SomeAPIer // Port interface
}
func (u *xxxUseCase) Execute(ctx context.Context, input XxxInput) (*XxxOutput, error) {
// 1. Validate input (using domain validators)
// 2. Call infrastructure via port interfaces
// 3. Transform and return result
}
```
## Allowed/Forbidden
| Action | Allowed |
| --------------------------------- | ----------------------- |
| Import from `domain/` | Yes |
| Import from `application/ports/` | Yes |
| Import from `application/dto/` | Yes |
| Import from `infrastructure/` | No |
| Import from `interface-adapters/` | No |
| Define interfaces | Yes (in `ports/`) |
| Contain business logic | No (delegate to domain) |
## Related Rules
- @.claude/rules/internal/clean-architecture.md - Layer dependencies
- @.claude/rules/go/usecase.md - Use case patterns
- @.claude/rules/go/repository.md - Repository interfaces
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/btc-shared.mdcCursor rule
- .cursor/rules/internal/clean-architecture.mdcCursor rule
- .cursor/rules/internal/cli-structure.mdcCursor rule
- .cursor/rules/internal/domain-layer.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.

