Implement a Go feature using TDD methodology with up-to-date library documentation from Context7
From go-specialistnpx claudepluginhub sgaunet/claude-plugins --plugin go-specialist<feature description> [--skip-lint] [--skip-refactor] [--dry-run] [--force]Implement a Go feature using strict RED → GREEN → REFACTOR TDD methodology, with Context7 MCP integration for up-to-date library documentation at each phase.
$argument: Feature description and optional flags (required)| Flag | Short | Effect |
|---|---|---|
--skip-lint | -l | Skip golangci-lint in Phase 5 |
--skip-refactor | -r | Skip Phase 4 refactoring |
--dry-run | -n | Show plan only, no file writes |
--force | -f | Skip all user confirmations |
| Error | Action |
|---|---|
No go.mod found | Abort with message: "Not a Go project — no go.mod found" |
| Context7 unavailable | Warn and continue without doc validation |
| Tests won't compile | Display errors, attempt fix (max 2 retries), then ask user |
| Tests fail in GREEN phase | Attempt fix (max 2 retries), then ask user |
| Lint failure | Attempt auto-fix, re-run, then ask user |
| Build failure | Display errors, abort |
Parse flags from $argument:
--skip-lint / -l, --skip-refactor / -r, --dry-run / -n, --force / -fValidate Go project:
go.mod exists — if not, abort: "Not a Go project — no go.mod found"go.mod to identify module name and Go versionAnalyze project structure:
*_test.go files for package naming: flag any white box tests (package <pkgname> without _test suffix) for potential conversionIdentify libraries needed for the feature:
Fetch Context7 documentation for each library:
mcp__context7__resolve-library-id to get the library IDmcp__context7__query-docs with a query specific to the feature being implementedPresent implementation plan to user:
Ask confirmation via AskUserQuestion (skipped with --force):
--dry-run: display plan and stop hereCreate or edit *_test.go files with:
package <pkgname>_test (not package <pkgname>). Import the package under test explicitly so tests validate the public API. If internals must be tested, create an export_test.go in package <pkgname> that exports needed symbols (e.g., var InternalFunc = internalFunc)TestFeatureName_Scenariot.Helper() in test helpers, t.Parallel() where safeRun tests to confirm RED state:
go test -v ./...
Validate RED state:
Ask confirmation to proceed to GREEN phase (skipped with --force)
Write minimal code to make all tests pass:
Run tests to confirm GREEN state:
go test -v ./...
Validate GREEN state:
AskUserQuestionAsk confirmation to proceed to REFACTOR phase (skipped with --force)
Skipped entirely if
--skip-refactorflag is set.
Improve code quality while keeping tests green:
Run tests after each refactoring step to ensure no regression:
go test ./...
Run vet for correctness checks:
go vet ./...
If any test fails after a refactoring step → revert that step and warn user.
Always run (mandatory):
go build ./...
go vet ./...
go test -race ./...
go test -cover ./...
Unless --skip-lint, also run:
golangci-lint run ./...
On lint failure: attempt auto-fix, re-run. If still failing, ask user via AskUserQuestion.
Display quality summary with pass/fail indicators for each gate.
Display a structured summary:
## TDD Implementation Summary
### Files
- Created: [list of new files]
- Modified: [list of modified files]
### Tests
- Total: N tests
- Passed: N / N
- Coverage: XX%
### Libraries Used
- [library]: Context7 docs consulted ✓
- [library]: Standard library (no lookup needed)
### Quality Gates
- Build: ✓ / ✗
- Vet: ✓ / ✗
- Lint: ✓ / ✗ / skipped
- Race: ✓ / ✗
- Cover: XX%
- Black box: ✓ all tests use _test suffix / ✗ N files use white box naming
### Next Steps
- Review changes
- Commit with: /commit
- Push to remote
# Implement a Fibonacci calculator with full TDD flow
/go-tdd "Add a function to calculate Fibonacci numbers"
# Implement with no refactoring phase
/go-tdd "Add HTTP health check endpoint" --skip-refactor
# Preview the plan without writing any files
/go-tdd "Add Redis caching layer" --dry-run
# Run everything without confirmations
/go-tdd "Add JWT token validation middleware" --force
# Combine flags
/go-tdd "Add CSV export for reports" --force --skip-lint