Linter-driven refactoring patterns to reduce complexity and improve code quality. Use when linter fails with complexity issues (cyclomatic, cognitive, maintainability) or when code feels hard to read/maintain. Applies storifying, type extraction, and function extraction patterns.
View on GitHubbuzzdan/ai-coding-rules
go-linter-driven-development
January 16, 2026
Select agents to install to:
npx add-skill https://github.com/buzzdan/ai-coding-rules/blob/main/go-linter-driven-development/skills/refactoring/SKILL.md -a claude-code --skill refactoringInstallation paths:
.claude/skills/refactoring/<objective> Linter-driven refactoring patterns to reduce complexity and improve code quality. Operates autonomously - no user confirmation needed during execution. **Reference**: See `reference.md` for complete decision tree and all patterns. **Examples**: See `examples.md` for real-world refactoring case studies. </objective> <quick_start> 1. **Receive linter failures** from @linter-driven-development 2. **Analyze root cause** - Does it read like a story? Can it be broken down? 3. **Apply patterns** in priority order (early returns → extract function → storifying → extract type) 4. **Verify** - Re-run linter automatically 5. **Iterate** until linter passes **IMPORTANT**: This skill operates autonomously - no user confirmation needed. </quick_start> <when_to_use> - **Automatically invoked** by @linter-driven-development when linter fails - **Automatically invoked** by @pre-commit-review when design issues detected - **Complexity failures**: cyclomatic, cognitive, maintainability index - **Architectural failures**: noglobals, gochecknoinits, gochecknoglobals - **Design smell failures**: dupl (duplication), goconst (magic strings), ineffassign - Functions > 50 LOC or nesting > 2 levels - Mixed abstraction levels in functions - Manual invocation when code feels hard to read/maintain </when_to_use> <learning_resources> Choose your learning path: - **Quick Start**: Use the patterns below for common refactoring cases - **Complete Reference**: See [reference.md](./reference.md) for full decision tree and all patterns - **Real-World Examples**: See [examples.md](./examples.md) to learn the refactoring thought process - [Example 1](./examples.md#example-1-storifying-mixed-abstractions-and-extracting-logic-into-leaf-types): Storifying and extracting a single leaf type - [Example 2](./examples.md#example-2-primitive-obsession-with-multiple-types-and-storifying-switch-statements): Primitive obsession with multiple types and switch elimination </learning_resources> <an