A comprehensive set of Go coding principles and Claude Code skills for building clean, maintainable, testable systems using linter-driven development.
Complete Go coding principles covering:
- Type design (primitive obsession prevention, self-validating types)
- Architecture (vertical slices)
- Testing strategies (table-driven, real implementations over mocks)
- Refactoring patterns
- Anti-patterns to avoid
Six specialized skills that work together to automate clean code practices:
- linter-driven-development - Meta-orchestrator for complete workflow
- code-designing - Domain type design and architecture planning
- testing - Testing principles and patterns
- refactoring - Linter-driven refactoring strategies
- pre-commit-review - Design validation (advisory)
- documentation - Feature documentation generation
- Claude Code installed
- Go development environment
Step 1: Add the marketplace
/plugin marketplace add buzzdan/ai-coding-rules
Step 2: Install the plugin
/plugin install go-linter-driven-development@ai-coding-rules
Verify installation:
/plugin list
Should show: go-linter-driven-development (enabled)
That's it! All skills are now available:
@linter-driven-development@code-designing@testing@refactoring@pre-commit-review@documentation
For automatic context loading:
# Your Project CLAUDE.md
## Automatic Go Coding Context
When working on Go code, ALWAYS read @ai-coding-rules/coding_rules.md first.The complete workflow orchestrator
Manages the entire development cycle:
- Phase 1: Design (invokes
@code-designingif needed) - Phase 2: Implementation (applies
@testingprinciples) - Phase 3: Linter loop (runs linter, invokes
@refactoringif fails) - Phase 4: Pre-commit review (invokes
@pre-commit-review) - Phase 5: Commit ready
Use when: Implementing any feature, bug fix, or refactor that should result in a commit.
Domain type design and architecture planning
Helps you:
- Design self-validating types
- Prevent primitive obsession
- Plan vertical slice architecture
- Create proper type hierarchies
Use when: Planning new features or identifying need for new types.
Testing principles and patterns
Guides you on:
- Table-driven tests (cyclomatic complexity = 1)
- Testify suites (only for complex setup)
- Real implementations over mocks
- Synchronization without time.Sleep
- Coverage strategies (100% for leaf types)
Use when: Writing tests or clarifying testing approach.
Linter-driven refactoring patterns
Provides patterns for:
- Storifying (clarify abstraction levels)
- Extract type (fix primitive obsession)
- Early returns (reduce nesting)
- Switch extraction (categorize cases)
- Decision tree for complexity reduction
Use when: Linter fails or code feels complex.
Design validation (advisory)
Validates code against design principles:
- π΄ Design Debt - Will cause pain when extending
- π‘ Readability Debt - Hard to understand now
- π’ Polish Opportunities - Minor improvements
Reviews entire commit + broader file context.
Use when: Before committing (automatically invoked by meta-orchestrator).
Feature documentation generation
Creates documentation for:
- Problem & solution overview
- Architecture with design decisions
- Usage examples (basic + advanced)
- Testing strategy
- Integration points
Use when: After completing a feature (may span multiple commits).
Use the meta-orchestrator for automatic workflow management:
You: "Implement user authentication using @linter-driven-development"
Claude:
1. Designs UserID, Email types (@code-designing)
2. Implements with tests (@testing principles)
3. Runs linter, refactors if needed (@refactoring)
4. Reviews design (@pre-commit-review)
5. Presents commit-ready summary with findings
You decide:
- Commit as-is
- Fix design debt (π΄)
- Fix design + readability debt (π΄ + π‘)
- Fix all findings (π΄ π‘ π’)
- Refactor broader scope
Invoke skills independently when needed:
"Use @code-designing to plan types for payment processing"
"Use @testing to structure tests for UserService"
"Use @refactoring to reduce complexity in HandleRequest"
"Use @pre-commit-review to validate this code"
"Use @documentation to document the auth feature"
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LINTER-DRIVEN DEVELOPMENT β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β Design Phase β
β (@code-designing)β
ββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β Implementation β
β + Testing β
β (@testing) β
ββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β Run Linter β
β task lintwithfix β
ββββββββββββββββββββ
β
βββββββββββ΄ββββββββββ
β β
β
Pass β Fail
β β
β ββββββββββββββββββββ
β β Refactoring β
β β (@refactoring) β
β ββββββββββββββββββββ
β β
β βββββββββββ
β β Loop until pass
β β
βββββββββββ΄ββββββββββ
β
βΌ
ββββββββββββββββββββ
β Pre-Commit β
β Review β
β (@pre-commit- β
β review) β
ββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β Advisory Report β
β π΄ Design Debt β
β π‘ Readability β
β π’ Polish β
ββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β User Decides β
β & Commits β
ββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β Feature Complete?β
ββββββββββββββββββββ
β
βββββββββββ΄ββββββββββ
β β
Yes No
β β
βΌ β
ββββββββββββββββββββ β
β Documentation β β
β (@documentation) β β
ββββββββββββββββββββ β
β β
β βββββββββββ
β β Next commit
β β
βΌ βΌ
βββββββββββββββ
β Done! β
βββββββββββββββ
- Prevent primitive obsession - Use self-validating types (UserID, Email, Port)
- Self-validating types - Validate in constructor, trust in methods
- Vertical slices - Group by feature, not technical layer
- Types around intent - Design around behavior, not just shape
- Leaf types - Most logic in self-contained, testable types
- Test public API only - Use
pkg_testpackage - Real implementations - Avoid mocks, use in-memory implementations
- Table-driven tests - Cyclomatic complexity = 1 per test case
- Testify suites - Only for complex infrastructure setup
- Coverage targets - 100% for leaf types, integration tests for orchestrators
- Linter-driven - Let linter failures guide refactoring
- Storifying - Top-level functions read like stories
- Extract types - Move primitive logic to custom types
- Early returns - Reduce nesting (max 2 levels)
- Functions < 50 LOC - Break down large functions
For any non-trivial work, use @linter-driven-development to ensure you follow the complete workflow:
"Implement port configuration with validation using @linter-driven-development"
The @pre-commit-review skill provides advisory feedback, not blocking. It categorizes findings:
- π΄ Design Debt - Strongly recommended to fix (will cause pain later)
- π‘ Readability Debt - Consider fixing (harder to understand)
- π’ Polish - Optional improvements
You decide whether to apply fixes or accept the debt knowingly.
After completing a feature (spanning one or multiple commits), use @documentation:
"Document the user authentication feature using @documentation"
This creates docs/[feature].md with:
- Problem/solution overview
- Architecture decisions
- Usage examples
- Integration points
The skills are living documents in your git repo:
- Found a better pattern? Update reference.md
- Need more examples? Add to examples.md
- Workflow needs adjustment? Edit SKILL.md
Commit, push, and everyone benefits.
Don't always need the full orchestrator:
# Quick design review before coding
"Use @code-designing to plan types for this feature"
# Check if tests are structured correctly
"Use @testing to review my test structure"
# Get refactoring suggestions for complex function
"Use @refactoring to suggest improvements for this function"
Standard Installation:
- Add the marketplace:
/plugin marketplace add buzzdan/ai-coding-rules
- Install the plugin:
/plugin install go-linter-driven-development@ai-coding-rules
Or add to your project's .claude/settings.json for automatic team-wide marketplace availability:
{
"extraKnownMarketplaces": [
"buzzdan/ai-coding-rules"
]
}Then team members can:
/plugin marketplace add buzzdan/ai-coding-rules
/plugin install go-linter-driven-development@ai-coding-rules
Updates:
/plugin update go-linter-driven-development@ai-coding-rules
Development Workflow:
- Clone the repository:
cd ~/dev
git clone https://github.com/buzzdan/ai-coding-rules.git
cd ai-coding-rules- Edit skills:
cd go-linter-driven-development/skills
# Edit SKILL.md, reference.md, examples.md files in any skill directory- Test changes locally:
# Start Claude Code from parent directory
cd ~/dev
claude
# Add local marketplace
/plugin marketplace add ./ai-coding-rules
# Install your development version
/plugin install go-linter-driven-development@ai-coding-rulesAfter making changes:
# Uninstall current version
/plugin uninstall go-linter-driven-development@ai-coding-rules
# Reinstall to test changes
/plugin install go-linter-driven-development@ai-coding-rules
- Commit and push:
cd ~/dev/ai-coding-rules
git add go-linter-driven-development/
git commit -m "Improve refactoring patterns in @refactoring skill"
git push origin main- Team gets updates: Team members run:
/plugin update go-linter-driven-development@ai-coding-rules
The @pre-commit-review skill uses debt-based categories (not "critical/important/nice-to-have") to reflect maintenance reality:
Will cause pain when extending/modifying code
Examples:
- Primitive obsession (string IDs, int ports)
- Wrong architecture (horizontal layers)
- Non-self-validating types
- Missing error context
Impact: Future changes require more work and risk bugs.
Makes code harder to understand and work with
Examples:
- Mixed abstraction levels
- Functions not storified
- Defensive nil checks
- Generic naming (utils, common)
Impact: Team members (and AI) struggle to understand intent.
Minor improvements for consistency
Examples:
- Non-idiomatic naming
- Missing comments
- Minor refactoring opportunities
Impact: Low, but keeps codebase clean.
You: "Implement user registration with email validation using @linter-driven-development"
Claude:
π Phase 1: Design
- Creating types: UserID, Email (self-validating)
- Planning vertical slice: user/user.go, user/service.go, user/repository.go
π Phase 2: Implementation
- Writing tests for UserID, Email constructors
- Implementing UserService with real in-memory repository
- Achieving 100% coverage on leaf types
π Phase 3: Linter
- Running: task lintwithfix
- β
Passed (0 issues)
π Phase 4: Pre-Commit Review
β οΈ 3 findings:
π΄ Design Debt (1):
- user/service.go:67 - Session token should be SessionToken type
π‘ Readability Debt (1):
- user/service.go:89 - Mixed abstractions in CreateUser()
π’ Polish (1):
- user/repository.go:34 - Naming: SaveUser β Save
π Broader Context:
While reviewing user/service.go, noticed similar primitive obsession
in GetUserByEmail (line 120). Consider broader refactor.
Would you like to:
1. Commit as-is
2. Fix design debt (π΄)
3. Fix design + readability (π΄π‘)
4. Fix all (π΄π‘π’)
5. Refactor entire file
You: "2 - fix design debt"
Claude: [Applies design debt fixes, re-runs linter, presents updated summary]
You: "Use @code-designing to plan types for payment processing"
Claude:
π¨ DESIGN PLAN
Core Domain Types:
β
Amount (float64) - Self-validating, prevents negative amounts
β
Currency (string) - Self-validating, ISO 4217 codes only
β
PaymentMethod (string) - Enum: CreditCard, BankTransfer, etc.
Orchestrating Types:
β
PaymentService - Coordinates payment operations
Dependencies: Repository, Gateway, Notifier
Methods: ProcessPayment, RefundPayment, GetStatus
Package Structure:
π payment/
βββ amount.go # Amount type
βββ currency.go # Currency type
βββ method.go # PaymentMethod enum
βββ service.go # PaymentService
βββ gateway.go # Gateway interface
Design Decisions:
- Amount is custom type to prevent negative values and ensure precision
- Currency validation ensures only valid ISO codes
- Vertical slice keeps all payment logic together
Ready to implement?
# Check installed plugins
/plugin list
# If not listed, install it
/plugin marketplace add buzzdan/ai-coding-rules
/plugin install go-linter-driven-development@ai-coding-rules
# Verify plugin is enabled
/plugin list
# If disabled, enable it
/plugin
# Select "go-linter-driven-development" and choose "Enable"
# Try uninstalling and reinstalling
/plugin uninstall go-linter-driven-development@ai-coding-rules
/plugin install go-linter-driven-development@ai-coding-rules
- Edit appropriate skill's
reference.md - Add examples to
examples.mdif applicable - Commit and push
- Create new directory in
skills/ - Add
SKILL.md(required) - Describes when/how to use - Add
reference.md(optional) - Detailed principles/patterns - Add
examples.md(optional) - Before/after examples - Update this README with new skill description
Before committing skill changes:
- Test in Claude Code with real code
- Verify skill invocation works
- Check that skill produces expected output
- Ensure integration with other skills works
[Add your license here]
Built for linter-driven development with Go. Optimized for use with Claude Code.