tdd-workflow
Skill30 starsChanged 4 months agoMITView on GitHub
Enforce practical Test-Driven Development for code changes in Go services. Use for new features, bug fixes, refactors, API changes, and new modules. Requires Red-Green-Refactor evidence, defect-hypothesis-driven tests, killer cases, and coverage gates (line + risk-path).
128 other projects use a version of this.
Adopted by
Most recently taken up by
- Rojios/everything-claude-codetheir own version, first seen Nov 8, 2026
- lhbsaa/apex-unifiedtheir own version, first seen Nov 8, 2026
- ahmadvahidi/skill-atlastheir own version, first seen Nov 8, 2026
- mahsumaktas/agent-evolution-kittheir own version, first seen Nov 8, 2026
- ControllableModel/SWE-Skills-Benchtheir own version, first seen Nov 8, 2026
- LuisSambrano/antigravity-configtheir own version, first seen Nov 8, 2026
Used with
Projects with it also use brand-discovery, configure-ecc and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
ysyecustSkillbrand-discovery
Use when a brand needs to discover or articulate its identity through structured multi-session interviews. Covers purpose, positioning, audience, personality, voice, narrative, and founder-brand tension across 8 modules using laddering, 5 Whys, and projective techniques. Produces a resumable session with disk-persisted state and a master brandbook (90_SYNTHESIS.md).
Also in 6 projects that use this
royaluniondesign-sysSkillconfigure-ecc
Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.
Also in 12 projects that use this
junimnjwSkillralphinho-rfc-pipeline
RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.
Also in 12 projects that use this
loulanyueSkillnuxt4-patterns
Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.
Also in 10 projects that use this
royaluniondesign-sysSkillcontent-hash-cache-pattern
Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.
Also in 16 projects that use this
RojiosSkilldart-flutter-patterns
Production-ready Dart and Flutter patterns covering null safety, immutable state, async composition, widget architecture, popular state management frameworks (BLoC, Riverpod, Provider), GoRouter navigation, Dio networking, Freezed code generation, and clean architecture.
Also in 7 projects that use this
Other versions128 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 128
- affaan-m/ECC★ 246ksame name
- vudovn/ag-kit★ 8.2ksame name
- vudovn/antigravity-kit★ 8.2ksame name
- xu-xiang/everything-claude-code-zh★ 1.9ksame name
- loulanyue/awesome-claude-notes★ 272same name
- ab604/claude-code-r-skills★ 202same name
- cloudnative-co/claude-code-starter-kit★ 153same name
- xenitV1/Antigravity-Workflows★ 130same name
- cohen-liel/hivemind★ 108same name
- travisjneuman/.claude★ 106same name
118 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository52 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-designSkill
- api-integration-testSkill
- constructive-thinkingSkill
- create-prSkill
- deep-researchSkill
- e2e-testSkill
- fuzzing-testSkill
- git-commitSkill
- go-benchmarkSkill
- go-ci-workflowSkill
- go-code-reviewerSkill
- go-concurrency-reviewSkill
- go-dependency-auditSkill
- go-error-reviewSkill
- go-logic-reviewSkill
- go-makefile-writerSkill
- go-observability-reviewSkill
- google-searchSkill
- go-performance-reviewSkill
- go-quality-reviewSkill
- go-review-leadSkill
- go-security-reviewSkill
- go-test-reviewSkill
- incident-postmortemSkill
- kafka-event-driven-designSkill
- load-testSkill
- local-transcriptSkill
- log-analyzerSkill
- mongo-migrationSkill
- monitoring-alertingSkill
- mysql-migrationSkill
- oceanbase-table-designSkill
- oracle-migrationSkill
- pg-migrationSkill
- readme-generatorSkill
- redis-cache-strategySkill
- security-reviewSkill
- stock-analysis-leadSkill
- stock-balance-sheet-reviewSkill
- stock-business-reviewSkill
- stock-earnings-quality-reviewSkill
- stock-industry-reviewSkill
- stock-management-reviewSkill
- stock-peer-comparison-reviewSkill
- systematic-debuggingSkill
- tech-doc-writerSkill
- thirdparty-api-integration-testSkill
- unit-testSkill
- update-docSkill
- writing-plansSkill
- yt-dlp-downloaderSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. 0 are common, 10 are distinctive, and 9 are very specific to this project.
0
Common
Most of the 117 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Start with tests, not implementation.
- Very specific: line 15
Keep test files co-located and named <target>_test.go.
- Very specific: line 18
If project uses standard library only: use t.Fatalf for fatal, t.Errorf for value checks.
- Very specific: line 19
If project uses go-cmp: use cmp.Diff for deep struct comparison.
- Very specific: line 20
Detection: Check existing _test.go files for "github.com/stretchr/testify" imports.
- Very specific: line 21
Prefer table-driven tests with t.Run.
- Distinctive: line 22
Prefer real deps or lightweight fakes.
- Distinctive: line 23
Do not add speculative production code not required by failing tests.
- Distinctive: line 29
Before writing tests, list concrete defect hypotheses from target code:
- Distinctive: line 51
If gate waived, require explicit user approval and documented risk.
- Distinctive: line 55
Never claim tests/coverage were run unless actually executed.
- Distinctive: line 57
If executed: report exact commands and key result lines.
- Very specific: line 58
If not executable in current environment: report Not run in this environment and provide exact run commands.
- Very specific: line 64
avoid time.Sleep for synchronization
- Very specific: line 65
use channels/barriers/waitgroups/atomics to control ordering
- Distinctive: line 78
If exceeding range, justify by distinct logic paths.
- Very specific: line 83
Write behavior contract (Given/When/Then bullets).
- Distinctive: line 224
PASS: All Critical pass AND ≥4/5 Standard AND ≥3/4 Hygiene
- Distinctive: line 262
Run regression before publishing changes:
“Common” is measured: kept by at least 6 in 10 of the 117 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Go TDD Workflow
Apply TDD end-to-end: write failing tests first, implement minimal code, refactor safely, and prove quality with coverage plus risk-path checks.
Hard Rules
- Start with tests, not implementation.
- Preserve visible
Red -> Green -> Refactorevidence in commands/output. - Keep test files co-located and named
<target>_test.go. - Assertion strategy (adapt to project):
- If project uses testify:
requirefor fatal preconditions,assertfor value checks. - If project uses standard library only: use
t.Fatalffor fatal,t.Errorffor value checks; include got/want:t.Errorf("Name = %q, want %q", got, want). - If project uses go-cmp: use
cmp.Difffor deep struct comparison. - Detection: Check existing
_test.gofiles for"github.com/stretchr/testify"imports. Follow project convention.
- If project uses testify:
- Prefer table-driven tests with
t.Run. - Prefer real deps or lightweight fakes; avoid heavy mock chains by default.
- Do not add speculative production code not required by failing tests.
New Mandatory Gates
1) Defect Hypothesis Gate
Before writing tests, list concrete defect hypotheses from target code:
- boundary/index (
n-1,i+1, last-item behavior) - error propagation/wrapping
- mapping loss/data mismatch
- concurrency/order/timing
- idempotency/retry behavior
Each hypothesis must map to at least one test case name. For detailed defect-hypothesis patterns and BAD/GOOD examples, cross-reference the unit-test skill: references/bug-finding-techniques.md, references/killer-case-patterns.md, and Fixed Boundary Checklist.
2) Killer Case Gate
Per changed method/use-case, add at least one killer case that:
- targets a high-risk defect hypothesis
- includes assertion(s) that must fail on known bad mutation/path
- is explicitly marked in report
3) Coverage Gate (Line + Risk Path)
- Line coverage gate: changed package(s) >=80% by default.
- Risk-path gate: all high-risk branches/hypotheses must be covered even if line coverage already passes.
- If gate waived, require explicit user approval and documented risk.
4) Execution Integrity Gate
Never claim tests/coverage were run unless actually executed.
- If executed: report exact commands and key result lines.
- If not executable in current environment: report
Not run in this environmentand provide exact run commands.
5) Concurrency Determinism Gate
For concurrency-sensitive code:
- avoid
time.Sleepfor synchronization - use channels/barriers/waitgroups/atomics to control ordering
- run with
-race
6) Change-Size Test Budget Gate
Choose test depth by change size to avoid test bloat. Use concrete criteria first, then case budget:
| Size | Criteria | Test Budget |
| S | ≤2 files touched, ≤50 LOC, single critical path | 3-6 cases/method, essential regression |
| M | 3-5 files, 50-150 LOC, or 2 critical paths | 6-12 cases/method, selected cross-package regression |
| L | >5 files, >150 LOC, or 3+ critical paths | 10-20 cases/method + broader regression matrix |
If exceeding range, justify by distinct logic paths. For security-sensitive code (auth, input validation, SSRF guards, crypto), the budget may be doubled — document the security rationale in the output contract.
Workflow
- Classify change size (
S/M/L) and target scope. - Write behavior contract (Given/When/Then bullets).
- Build defect hypothesis list and map each to tests.
- Red: write failing tests first (include killer case).
- Characterization testing (for pre-existing code): when adding tests AFTER implementation already exists, satisfy the Red evidence gate via one of:
- Mutation: temporarily break the production code, verify new tests fail, then revert.
- Hypothesis: document the specific defect hypothesis each test targets — the hypothesis itself serves as Red evidence that the test guards a real risk.
- Characterization testing (for pre-existing code): when adding tests AFTER implementation already exists, satisfy the Red evidence gate via one of:
- Green: implement minimal code to pass failing tests.
- Refactor: improve structure without behavior change.
- Validate quality gates:
- focused tests
- coverage (line + risk-path)
-racewhen concurrency is relevant
- Report with evidence and residual risks.
Command Playbook (Go)
# Red phase (expect at least one fail)
go test ./path/to/pkg -run TestXxx -v
# Green phase
go test ./path/to/pkg -v
# Coverage (line)
go test ./path/to/pkg -coverprofile=coverage.out
go tool cover -func=coverage.out
# Concurrency safety (when applicable)
go test ./path/to/pkg -race -v
# Broader regression (as needed)
go test ./...Anti-Examples (Core TDD Mistakes)
For the full set of 7 anti-examples, read references/anti-examples.md. The most critical TDD mistakes are inlined here so the contract is self-contained:
Mistake 1: Writing all tests before any implementation (Big-Bang Red)
// BAD: 15 test cases written at once before any production code
// You lose the tight feedback loop — hard to tell which test drives which behavior
func TestUserService(t *testing.T) {
t.Run("create", func(t *testing.T) { /* ... 5 subtests */ })
t.Run("update", func(t *testing.T) { /* ... 5 subtests */ })
t.Run("delete", func(t *testing.T) { /* ... 5 subtests */ })
}
// Then implement everything at once — this is test-first, NOT TDD
// GOOD: one failing test → minimal implementation → next failing test
// Iteration 1: TestUserService/create/success → implement Create()
// Iteration 2: TestUserService/create/duplicate_email → add uniqueness check
// Each cycle is Red → Green → Refactor before moving onMistake 2: Testing implementation details instead of behavior
// BAD: locks test to implementation details and blocks safe refactor
repo.AssertCalled(t, "Save", mock.Anything, user)
// GOOD: assert observable behavior such as returned state, persisted fields, and domain errors
require.Equal(t, "active", got.Status)Mistake 3: Refactor phase changes observable behavior
// BAD: "refactor" silently changes API behavior
func NormalizeEmail(s string) string { return strings.TrimSpace(strings.ToLower(s)) }
// GOOD: keep behavior unchanged during refactor; add a new Red cycle for any behavior change
func normalizeEmail(s string) string { return strings.TrimSpace(s) }Mistake 4: Skipping Red evidence — "it compiles so it works"
// BAD: write test and implementation simultaneously, never see a failure
func TestAdd(t *testing.T) {
// Written AFTER Add() was already implemented
assert.Equal(t, 3, Add(1, 2))
}
// GOOD: write test FIRST, run it, see it FAIL, then implement
// Step 1: write test → go test → FAIL (Add undefined)
// Step 2: stub: func Add(a, b int) int { return 0 }
// go test → FAIL (got 0, want 3)
// Step 3: implement: return a + b → go test → PASS
// Red evidence proves the test actually validates somethingMistake 5: Change-size mismatch
// BAD: S change but 40 test cases and 6 helper files added without new logic paths
func TestTinyBugfix(t *testing.T) { /* massive matrix */ }
// GOOD: size the regression to the change budget, then justify any extra cases with distinct risk paths
func TestTinyBugfix_LastElementBoundary(t *testing.T) { /* focused killer case */ }Mistake 6: Speculative helper extraction before tests demand it
// BAD: extract helpers and abstractions before any failing test proves the need
type orchestrator struct{ repo Repo; audit Audit; cache Cache }
// GOOD: add the smallest code needed for the current Red case, then refactor after Green
func createUser(repo Repo, in CreateUserInput) (User, error) { /* minimal path */ }Quality Scorecard
Mark each as PASS / FAIL / N/A (reason).
Critical (all must pass for overall PASS)
| # | Check | Criteria |
| C1 | Red evidence exists | Failing test demonstrated before implementation |
| C2 | Killer case present | Each changed method/use-case has at least one killer case |
| C3 | Risk-path coverage | All high-risk hypotheses have test coverage |
Standard (≥4/5 must pass)
| # | Check | Criteria |
| S1 | Defect hypothesis list | Exists and maps to test case names |
| S2 | Success + error + boundary paths | All three path categories covered |
| S3 | High-signal assertions | Business fields asserted, not just nil/not-nil |
| S4 | Coverage ≥80% | Changed package(s) meet line coverage gate |
| S5 | Execution integrity | Run evidence provided, or explicit not-run note |
Hygiene (≥3/4 must pass)
| # | Check | Criteria |
| H1 | Test file naming/location | <target>_test.go, co-located |
| H2 | Subtest hierarchy | t.Run with clear naming |
| H3 | Table-driven style | Multi-scenario behavior uses table-driven pattern |
| H4 | Regression scope | Final regression proportionate to change size (S/M/L) |
Scoring:
- PASS: All Critical pass AND ≥4/5 Standard AND ≥3/4 Hygiene
- FAIL: Any Critical fails → overall FAIL regardless of other scores
Output Contract
Changed filesChange size:S/M/Lwith reasonDefect hypotheses -> test mappingKiller casesRed -> Green evidence(orNot run in this environment)Coverage(line + risk-path)Scorecard(3-tier: Critical / Standard / Hygiene)Residual risks / follow-ups— must include:- untested edge cases beyond budget
- design limitations of the target function
- security implications for sensitive code (e.g., bypass vectors, upstream stdlib assumptions)
- dependencies on upstream behavior (stdlib, libraries, environment)
References (Load Selectively)
Always read (every TDD task):
references/boundary-checklist.md— defect hypothesis patterns and killer case design
Read for API/service layer TDD (skip for pure-function or utility TDD):
references/api-3layer-template.md— Handler/Service/Repo TDD templatereferences/fake-stub-template.md— fake design and error injection
Read for first-time TDD or complex refactors:
references/tdd-workflow.md— end-to-end walkthrough, Outside-In vs Inside-Out, characterization testing
Read when reviewing or generating TDD code:
references/anti-examples.md— 5 additional TDD mistakes with BAD/GOOD examples
Read for characterization testing (adding tests to pre-existing code):
references/golden-characterization-example.md— full output contract with mutation-based Red evidence for a security-sensitive function
Skill Maintenance
Run regression before publishing changes:
scripts/run_regression.shValidates frontmatter, gates, anti-examples, scorecard, references, and golden fixtures.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

