Skip to content

Claude Code Best Practices Applied to go-crypto-wallet

Based on Claude Code Best Practices Applied to the go-crypto-wallet project structure and conventions.

Table of Contents


Overview

The core principle of Claude Code best practices is context window management. Performance degrades as context fills. Every decision below maps back to this constraint.

This document evaluates the go-crypto-wallet project against each best practice, identifies what is already implemented, and recommends improvements.


1. Give Claude a Way to Verify Its Work

The single highest-leverage thing you can do.

What the Best Practice Says

  • Provide tests, screenshots, or expected outputs so Claude can check itself
  • Address root causes, not symptoms
  • Invest in making verification rock-solid

Current Implementation

MechanismStatusDetails
Makefile verification targetsImplementedmake go-lint, make check-build, make go-test
File-type verification matrixImplemented.claude/rules/task-context-loading.md maps file extensions to verification commands
go-development skillImplementedEnforces make go-lint && make tidy && make check-build && make go-test
Pre-commit hooks (lefthook)ImplementedConventional commit enforcement
Security vulnerability scanImplementedmake go-check-vuln
docs/task-contexts/verification.mdImplementedCentral verification command reference

Recommendations

PriorityRecommendationRationale
HighAdd a hook to auto-run make go-lint after Go file editsHooks guarantee execution (unlike advisory CLAUDE.md rules). Best practice: "Use hooks for actions that must happen every time with zero exceptions."
MediumAdd integration test targets per chainCurrently make go-test runs unit tests only; chain-specific integration tests would strengthen verification
LowConsider screenshot verification for any future web UI componentsNot currently applicable (CLI-only project)

2. Explore First, Then Plan, Then Code

Separate research and planning from implementation to avoid solving the wrong problem.

What the Best Practice Says

Four-phase workflow: Explore -> Plan -> Implement -> Commit

Current Implementation

MechanismStatusDetails
Kiro spec-driven workflowImplementedRequirements -> Design -> Tasks -> Implementation via /kiro:spec-* commands
Gap analysisImplemented/kiro:validate-gap before design
Design validationImplemented/kiro:validate-design after design
Implementation validationImplemented/kiro:validate-impl after implementation
OpenSpec explorationImplemented/opsx:explore for idea exploration before proposing changes
Plan Mode supportAvailableBuilt into Claude Code (Ctrl+G)

Assessment

This project exceeds the best practice with the Kiro spec-driven development workflow. The 3-phase approval process (Requirements -> Design -> Tasks) is more rigorous than the simple Plan Mode approach described in the best practice.

Recommendations

PriorityRecommendationRationale
MediumUse Plan Mode for small tasks that don't warrant a full Kiro specKiro specs are heavyweight; simple bug fixes or small refactors benefit from lightweight Plan Mode
LowDocument when to use Kiro specs vs Plan Mode vs direct implementationHelp users choose the right approach based on task complexity

3. Provide Specific Context in Prompts

The more precise your instructions, the fewer corrections you'll need.

What the Best Practice Says

  • Reference specific files
  • Point to existing patterns
  • Describe symptoms with location and success criteria
  • Use rich content: @ references, images, URLs, piped data

Current Implementation

MechanismStatusDetails
Task context loadingImplemented.claude/rules/task-context-loading.md auto-loads relevant context docs based on task type
Label-context mappingImplemented.claude/skills/label-context-mapping/ routes GitHub labels to skills and context files
Chain-specific contextsImplementeddocs/task-contexts/chain-specific.md + docs/chains/{chain}/README.md
Task-type contextsImplementeddocs/task-contexts/{bug-fix,feature-add,refactoring,...}.md
Architecture docsImplementedARCHITECTURE.md, docs/guidelines/architecture.md
@ file references in CLAUDE.mdImplementedCLAUDE.md references @AGENTS.md, @docs/guidelines/, @ARCHITECTURE.md

Assessment

This project has a sophisticated context loading system that goes beyond the best practice. The label-driven routing pattern automatically provides Claude with the right context based on GitHub issue labels.

Recommendations

PriorityRecommendationRationale
MediumAdd example prompts to task context docsShow users how to write effective prompts for each task type (e.g., "fix BCH address validation bug in watch wallet")
LowAdd @ references in frequently-used commandsSome slash commands could benefit from explicit file references to reduce Claude's exploration

4. Configure Your Environment

4.1 CLAUDE.md

Run /init to generate a starter CLAUDE.md, then refine over time.

What the Best Practice Says

  • Keep it short and human-readable
  • Include only things Claude can't infer from code
  • Prune regularly; bloated CLAUDE.md causes instruction loss
  • Check it into git for team sharing

Current Implementation

CriterionStatusDetails
Checked into gitYesCLAUDE.md is tracked
ConciseYesFocused on Kiro workflow, paths, and development rules
Bash commands Claude can't guessPartialVia @AGENTS.md and @docs/guidelines/ references
Code style that differs from defaultsDelegatedTo .claude/rules/ and docs/guidelines/coding-conventions.md
Architectural decisionsDelegatedTo ARCHITECTURE.md

Assessment

The CLAUDE.md follows a layered approach: it is concise itself and delegates detailed rules to .claude/rules/ (auto-loaded) and docs/guidelines/ (loaded on demand via @ references). This aligns well with the best practice of keeping CLAUDE.md short.

Recommendations

PriorityRecommendationRationale
MediumAudit CLAUDE.md + rules for redundancyBest practice: "If Claude already does something correctly without the instruction, delete it." Some rules may overlap between CLAUDE.md, AGENTS.md, and .claude/rules/
LowAdd compaction preservation instructione.g., "When compacting, always preserve the full list of modified files and any test commands"

4.2 Permissions

Use /permissions to allowlist safe commands.

Current Implementation

MechanismStatusDetails
.claude/settings.local.json allow listImplementedWhitelists make *, go *, git *, gh *, docker, sqlc, shell tools, bun, etc.
Granular git permissionsImplementedSpecific git subcommands allowed (add, commit, push, branch, etc.)

Assessment

Well-configured. The allow list covers standard development commands while maintaining security boundaries.

4.3 CLI Tools

Tell Claude Code to use CLI tools like gh, aws, gcloud.

Current Implementation

ToolStatusUsage
gh (GitHub CLI)ConfiguredIssue management, PR creation, release management
dockerConfiguredDatabase containers, build verification
atlasConfiguredDatabase schema management
sqlcConfiguredSQL code generation
mockeryConfiguredMock generation
golangci-lintConfiguredVia make go-lint
govulncheckConfiguredVia make go-check-vuln

4.4 MCP Servers

Run claude mcp add to connect external tools.

Current Implementation

MCPStatusDetails
claude-mem pluginInstalledPersistent cross-session memory via @thedotmack/claude-mem

Recommendations

PriorityRecommendationRationale
LowConsider adding a code intelligence MCP/pluginBest practice recommends code intelligence plugins for typed languages; could provide precise symbol navigation for Go

4.5 Hooks

Use hooks for actions that must happen every time with zero exceptions.

Current Implementation

HookStatusDetails
Stop notification soundImplementedPlays Funk.aiff when Claude stops
Pre-commit (lefthook)ImplementedConventional commit enforcement

Recommendations

PriorityRecommendationRationale
HighAdd post-edit hook for Go files: make go-lintGuarantees linting after every Go file edit, not just advisory
MediumAdd hook to block writes to auto-generated filesFiles with DO NOT EDIT headers should be protected by hooks, not just rules
MediumAdd hook to block writes to main branchCurrently advisory in AGENTS.md; a hook would enforce it deterministically

4.6 Skills

Create SKILL.md files in .claude/skills/ for domain knowledge and reusable workflows.

Current Implementation

The project has extensive skills covering:

  • Language-specific development (Go, TypeScript, Solidity, Shell)
  • Task-type workflows (git-workflow, fix-pr-review, fix-issue)
  • Chain-specific knowledge (bch-development, btc-terminology)
  • Infrastructure (db-migration, devops, makefile-update)
  • AI development lifecycle (openspec-*, knowledge-gap)

Assessment

Exceeds the best practice. The skill system with label-context-mapping creates an automated routing layer that the best practice doesn't cover.

4.7 Custom Subagents

Define specialized assistants in .claude/agents/ for isolated tasks.

Current Implementation

No custom subagents defined in .claude/agents/.

Recommendations

PriorityRecommendationRationale
MediumCreate a security-reviewer subagentThis project handles private keys and crypto transactions; a dedicated security review agent would catch vulnerabilities in a separate context
MediumCreate a architecture-reviewer subagentVerify Clean Architecture layer separation in a fresh context window
LowCreate a chain-compatibility subagentReview changes for cross-chain compatibility issues

5. Communicate Effectively

5.1 Codebase Questions

Ask Claude questions you'd ask a senior engineer.

No project-specific configuration needed. Claude can already explore the codebase.

5.2 Let Claude Interview You

For larger features, have Claude interview you first.

Current Implementation

The Kiro spec workflow (/kiro:spec-init -> /kiro:spec-requirements) already captures requirements through a structured process. For features outside the Kiro workflow, the interview pattern is available but not documented.

Recommendations

PriorityRecommendationRationale
LowAdd an interview-style command for quick featuresFor features too small for Kiro specs but complex enough to need requirements gathering

6. Manage Your Session

What the Best Practice Says

  • Course-correct early with Esc, /rewind, /clear
  • Manage context aggressively: /clear between tasks, /compact with focus instructions
  • Use subagents for investigation to keep main context clean
  • Checkpoints for safe experimentation
  • Resume conversations with --continue / --resume

Current Implementation

MechanismStatusDetails
claude-mem pluginImplementedPersistent memory across sessions
Session context hooksImplementedStartup hook loads recent context
Kiro spec artifactsImplementedSpecs persist across sessions as files

Recommendations

PriorityRecommendationRationale
MediumAdd compaction instructions to CLAUDE.mde.g., "When compacting, preserve: modified file list, current spec phase, chain context, and verification results"
MediumDocument subagent usage patterns in guidelinesBest practice: "Subagents are one of the most powerful tools available" - document when to use them for this project
LowAdd /rename convention for spec-related sessionse.g., "spec-postgresql-integration", "fix-bch-e2e-p1" for easy resumption

7. Automate and Scale

What the Best Practice Says

  • claude -p "prompt" for headless mode in CI/scripts
  • Multiple parallel sessions (Writer/Reviewer pattern)
  • Fan out across files for large migrations
  • --dangerously-skip-permissions only in sandboxed containers

Current Implementation

MechanismStatusDetails
Headless modeNot usedCI uses standard GitHub Actions, not Claude
Parallel sessionsNot configuredSingle-session workflow
Fan-out scriptsNot usedNo batch migration tooling

Recommendations

PriorityRecommendationRationale
MediumUse Writer/Reviewer pattern for security-critical changesHave one session implement, another review for security issues (critical for a crypto wallet)
LowConsider headless Claude for automated code review in CIclaude -p "Review this PR for security issues" --output-format json
LowFan-out pattern for future large migrationsUseful when migrating across chains or refactoring infrastructure layer

8. Avoid Common Failure Patterns

What the Best Practice Says

Anti-PatternFix
Kitchen sink session/clear between unrelated tasks
Correcting over and overAfter two failed corrections, /clear and write a better prompt
Over-specified CLAUDE.mdPrune ruthlessly; use hooks instead of advisory rules
Trust-then-verify gapAlways provide verification
Infinite explorationScope investigations or use subagents

Project-Specific Risk Assessment

Anti-PatternRisk LevelMitigation in Place
Kitchen sink sessionMediumNo explicit mitigation; relies on user discipline
Correcting over and overMediumKiro spec workflow reduces this by front-loading requirements
Over-specified CLAUDE.mdLowLayered architecture delegates detail to rules/skills
Trust-then-verify gapLowMakefile verification matrix and go-development skill enforce checks
Infinite explorationMediumTask-context-loading scopes context; but no subagent enforcement

Recommendations

PriorityRecommendationRationale
MediumAdd guideline: "Use subagents for codebase exploration"Prevent context pollution during investigation
LowAdd /clear reminder in long-running skillsSome E2E fix commands may run long; periodic context reset improves quality

Current State Assessment

Scorecard

Best PracticeScoreNotes
Verification4/5Strong Makefile targets; missing post-edit hooks
Planning workflow5/5Kiro spec-driven development exceeds the recommendation
Context in prompts5/5Automated label-driven context loading
CLAUDE.md4/5Well-structured layered approach; minor redundancy
Permissions4/5Comprehensive allow list
CLI tools5/5Full coverage of needed tools
MCP servers3/5claude-mem only; could add code intelligence
Hooks2/5Only notification sound; missing enforcement hooks
Skills5/5Extensive, well-organized skill system
Subagents1/5No custom subagents defined
Session management3/5claude-mem helps; missing compaction and subagent guidelines
Automation2/5No headless/parallel/fan-out usage

Overall: 43/60 (72%)


Gap Analysis and Recommendations

High Priority

  1. Add enforcement hooks
    • Post-edit hook: Run make go-lint after Go file modifications
    • Block hook: Prevent writes to auto-generated files (DO NOT EDIT)
    • Block hook: Prevent commits on main branch
    • Reference: Hooks Guide

Medium Priority

  1. Create custom subagents (.claude/agents/)

    • security-reviewer.md: Review code for private key leaks, injection, OWASP issues
    • architecture-reviewer.md: Verify Clean Architecture layer separation
    • Reference: Subagents Guide
  2. Add compaction instructions to CLAUDE.md

    markdown
    # Context Management
    When compacting, preserve: modified file list, current spec phase,
    chain context, and all verification results.
  3. Document subagent usage patterns

    • Add to docs/guidelines/workflow.md: when to use subagents for exploration vs. main context
  4. Adopt Writer/Reviewer pattern for security-critical changes

    • One session implements; another reviews with fresh context
    • Essential for crypto wallet security
  5. Audit rules for redundancy

    • Some rules appear in both CLAUDE.md -> AGENTS.md and .claude/rules/
    • Consolidate to reduce context consumption

Low Priority

  1. Explore code intelligence plugin for Go symbol navigation
  2. Consider headless Claude in CI for automated security review
  3. Add session naming conventions for spec-related work
  4. Document Plan Mode vs Kiro specs decision criteria