1---2name: linter-driven-development3description: WHEN: User requests Go code work (implement, fix, add, refactor) or mentions @ldd in a Go project. Orchestrates complete workflow (Phases 1-5): design → test → implement → lint → fix → documentation. Auto-triggers parallel quality analysis and iterative fix loop until code is commit-ready.4---56<objective>7Meta orchestrator for Go implementation workflow: design → test → lint → refactor → review → commit.8Use for any commit: features, bug fixes, refactors.910**Reference**: See `reference.md` for agent prompt templates, example reports, and output formats.11</objective>1213<essential_principles>14**Auto-Pilot Behavior**: This skill triggers automatically when Go code work is detected. After permission is granted, announce: **"Using go-ldd workflow for this Go code work"** and proceed to pre-flight check.1516**Trigger Conditions**:17- User requests Go code work (implement, fix, add, refactor, update, change, modify, etc.)18- User mentions "ldd" or "@ldd" (shorthand for linter-driven-development)19- Working directory contains Go project (go.mod or .go files)20</essential_principles>2122<quick_start>23**Immediate Action**: Run Pre-Flight Check, then execute phases sequentially until commit-ready.24251. **Pre-Flight**: Verify Go project, find test/lint commands, identify plan context262. **Phase 1**: Design types (if needed) → Write tests → Implement code273. **Phase 2**: Run quality-analyzer agent → Route based on status284. **Phase 3**: Fix loop until CLEAN_STATE295. **Phase 4**: Documentation306. **Phase 5**: Present commit summary with options31</quick_start>3233<workflow>3435<pre_flight_check>36**ALWAYS RUN FIRST**3738<step name="confirm_intent">39Look for keywords: "implement", "ready", "execute", "do", "start", "continue", "next", "build", "create", "step 1", "task 2", or explicit "@linter-driven-development", "@ldd", "ldd"40</step>4142<step name="verify_go_project">43Check that `go.mod` exists in the project root or parent directories.44</step>4546<step name="find_commands">47**Search locations** (in order):481. Project docs: `README.md`, `CLAUDE.md`, `agents.md`492. Build configs: `Makefile`, `Taskfile.yaml`, `.golangci.yaml`503. Git repository root for workspace-level commands5152**Extract commands**:53- **Test command**: `go test`, `make test`, `task test`54- **Lint command**: `golangci-lint run --fix`, `make lint`, `task lintwithfix`55- **Fallbacks**: `go test ./...` and `golangci-lint run --fix`56</step>5758<step name="identify_plan">59Scan conversation history (last 50 messages) for step-by-step plan and which step to implement.60</step>6162<decision_tree>63<decision condition="All conditions met" action="Announce 'Engaging autopilot mode for [description]' → Phase 1" />64<decision condition="Unclear intent" action="Ask for confirmation" />65<decision condition="No plan found" action="Suggest creating plan first (offer @code-designing)" />66<decision condition="Not Go project" action="Explain limitation" />67</decision_tree>68</pre_flight_check>6970<phase name="1" title="Implementation Foundation">71**Design Architecture** (if new types/functions needed):72- Invoke @code-designing skill73- Output: Type design plan with self-validating domain types7475**Write Tests First**:76- Invoke @testing skill for guidance77- Write table-driven tests or testify suites78- Target: 100% coverage on new leaf types7980**Implement Code**:81- Follow coding principles from references/coding_rules.md82- Keep functions <50 LOC, max 2 nesting levels83- Use self-validating types, prevent primitive obsession84</phase>8586<phase name="2" title="Quality Analysis">87**Invoke quality-analyzer agent** for parallel quality analysis.88See `reference.md` → "Agent Prompt Templates" for full prompt.8990The agent automatically:91- Executes tests, linter, and code review in parallel (40-50% faster)92- Identifies overlapping issues with root cause analysis93- Returns structured report with prioritized fixes9495<routing>96<route status="TEST_FAILURE" action="Enter Test Focus Mode (fix tests, retry)" />97<route status="CLEAN_STATE" action="Skip to Phase 4 (Documentation)" />98<route status="ISSUES_FOUND" action="Continue to Phase 3 (Fix Loop)" />99<route status="TOOLS_UNAVAILABLE" action="Report error, ask user to install tools" />100</routing>101102<test_focus_mode>103Loop until tests pass:1041. Analyze failure root cause1052. Apply fix to implementation or tests1063. Re-run quality-analyzer (mode: "full")1074. Check status → continue or exit loop108109Max 10 iterations. If stuck, ask user for guidance.110</test_focus_mode>111</phase>112113<phase name="3" title="Iterative Fix Loop">114**For each prioritized fix** (from agent's report):1151161. **Apply Fix**:117 - Invoke @refactoring skill with file, function, issues, and root cause118 - @refactoring applies patterns: early returns, extract function, storifying, extract type, switch extraction, extract constant1191202. **Verify Fix** (Incremental Mode):121 - Re-run quality-analyzer with `mode: incremental`122 - See `reference.md` → "Agent Prompt Templates" for prompt123 - Agent returns delta report: fixed, remaining, new issues1241253. **Route Based on Status**:126 - `TEST_FAILURE` → Enter Test Focus Mode127 - `CLEAN_STATE` → Break loop, go to Phase 4128 - `ISSUES_FOUND` → Continue to next fix (or retry if no progress)1291304. **Safety Limits**:131 - Max 10 iterations per fix loop132 - If stuck after 3 attempts → show status, ask user133134**Loop until agent returns CLEAN_STATE**.135</phase>136137<phase name="4" title="Documentation">138Invoke @documentation skill:1391. Add/update package-level godoc1402. Add/update type and function documentation (WHY not WHAT)1413. Add godoc testable examples (Example_* functions)1424. If last plan step → add feature documentation to docs/143144**Verify**: Run `go doc -all ./...` and ensure examples compile.145</phase>146147<phase name="5" title="Commit Ready">148Generate comprehensive summary. See `reference.md` → "Commit Readiness Output Format" for template.149150Present user with options:1511. Commit as-is1522. Fix design debt only, then commit1533. Fix design + readability debt, then commit1544. Fix all findings, then commit1555. Refactor entire file, then commit156</phase>157158</workflow>159160<workflow_control>161<control aspect="Phases" behavior="Sequential: 1 → 2 → 3 → 4 → 5" />162<control aspect="Routing" behavior="Agent status determines path" />163<control aspect="Parallelism" behavior="Phase 2 runs 3 tools simultaneously" />164<control aspect="Incremental" behavior="After first run, agent analyzes only changed files" />165</workflow_control>166167<integration>168**Skills invoked**:169- @code-designing (Phase 1, if needed)170- @testing (Phase 1)171- @refactoring (Phase 3)172- @documentation (Phase 4)173174**Agents invoked**:175- `go-linter-driven-development:quality-analyzer` (Phase 2 and Phase 3 verification)176 - Internally delegates to `go-linter-driven-development:go-code-reviewer` for design analysis177178**After committing**:179- Feature complete → Already documented in Phase 4180- More work needed → Run this workflow again for next commit181</integration>182183<success_criteria>184Workflow is complete when ALL of the following are true:185186- [ ] Pre-flight check passed (Go project verified, commands discovered)187- [ ] Phase 1 complete (tests written, code implemented)188- [ ] Quality-analyzer returns `CLEAN_STATE`:189 - [ ] Tests pass190 - [ ] Linter passes (0 errors)191 - [ ] Code review clean (0 findings)192- [ ] Phase 4 complete (documentation added/updated)193- [ ] Commit summary presented to user with options194- [ ] User has chosen commit action (or deferred)195</success_criteria>