tdd-workflow
Skill1 starsChanged 58 days agoMITView on GitHub
Test-driven development discipline covering the red-green-refactor loop with an enforced RED gate, the test pyramid, mocking boundaries, test naming and structure, and a CI coverage gate of around 90 percent line coverage of real logic. Use when you say "write this feature test first", "add tests for this bug fix", "our coverage gate is failing", "what should I mock here", or "refactor this without breaking behaviour". Not for browser journeys and the flaky-test policy, use `e2e-testing`.
78 other projects use a version of this.
Adopted by
Most recently taken up by
- mnzralee/claude-multi-agent-architecturetheir own version, first seen Oct 3, 2026
- JameMy0001/antigravity-skills-hubtheir own version, first seen Oct 2, 2026
- kapadias/nonnatheir own version, first seen Oct 1, 2026
- imMamdouhaboammar/tiktok-growth-automation-meshtheir own version, first seen Oct 1, 2026
- smitshivalkar-spectims4567/hsj-agent-skillstheir own version, first seen Sep 29, 2026
- beelabstudio/aitheir own version, first seen Sep 20, 2026
Used with
Projects with it also use kotlin-testing, ralphinho-rfc-pipeline and 8 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.
tpavanipradeepSkillkotlin-testing
Kotlin testing patterns with Kotest, MockK, coroutine testing, property-based testing, and Kover coverage. Follows TDD methodology with idiomatic Kotlin practices.
Also in 6 projects that use this
InfopibeSkillralphinho-rfc-pipeline
RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.
Also in 10 projects that use this
mryeastcodeSkillnuxt4-patterns
Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.
Also in 5 projects that use this
saxon-ySkillconfigure-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
InfopibeSkillcontent-hash-cache-pattern
Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.
Also in 12 projects that use this
WorldFlowAISkillproject-guidelines-example
Also in 19 projects that use this
- +2 more from Infopibe
Other versions78 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 78
- WorldFlowAI/everything-claude-code★ 4ksame name
- xu-xiang/everything-claude-code-zh★ 2ksame name
- zhukunpenglinyutong/ai-max★ 335same name
- loulanyue/awesome-claude-notes★ 272same name
- ab604/claude-code-r-skills★ 205same name
- cloudnative-co/claude-code-starter-kit★ 151same name
- tpavanipradeep/everything-claude-code★ 134same name
- templetongroup/radiant★ 113same name
- hellangleZ/burn-in-cceverywhere-ralph★ 112same name
- cohen-liel/hivemind★ 110same name
68 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 repository59 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- agentic-engineeringSkill
- ai-regression-testingSkill
- angularSkill
- ansibleSkill
- api-designSkill
- architecture-decision-recordsSkill
- ascend-memorySkill
- ascend-web-hunterSkill
- audio-scribeSkill
- automation-inventorySkill
- backend-patternsSkill
- bashSkill
- build-dependency-managementSkill
- code-formatterSkill
- code-reviewerSkill
- coding-standardsSkill
- dart-flutter-patternsSkill
- database-migrationsSkill
- deployment-patternsSkill
- design-systemSkill
- docker-patternsSkill
- e2e-runbooksSkill
- e2e-testingSkill
- embedded-c-arduinoSkill
- frontend-designSkill
- g-code-3d-printingSkill
- github-opsSkill
- git-workflowSkill
- golang-patternsSkill
- hexagonal-architectureSkill
- home-assistantSkill
- java-coding-standardsSkill
- jetbrains-ide-opsSkill
- jira-integrationSkill
- keycloak-patternsSkill
- kicadSkill
- markdown-writerSkill
- mongodb-patternsSkill
- nextjs-app-router-patternsSkill
- node-backend-patternsSkill
- observability-and-loggingSkill
- obsidianSkill
- performance-optimizationSkill
- postgres-patternsSkill
- powershellSkill
- project-trackingSkill
- python-patternsSkill
- pytorch-patternsSkill
- react-patternsSkill
- researchSkill
- review-duplicationSkill
- security-reviewSkill
- seoSkill
- soap-webservicesSkill
- springboot-patternsSkill
- unitySkill
- web-accessibilitySkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 5 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 72 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Write the test before the code, watch it fail for the right reason, then make it pass.
- Distinctive: line 37
Write the user journey, turn it into test cases, watch them fail, implement the minimum, watch them pass, then refactor under green.
- Distinctive: line 91
Do not touch production code until a valid RED state is confirmed.
- Distinctive: line 136
Verify locally before pushing.
- Very specific: line 197
Every test sets up state, performs one action, then asserts the observable outcome.
- Distinctive: line 245
Never weaken an assertion to make a test pass.
- Distinctive: line 296
Run the suite in watch mode while developing.
“Common” is measured: kept by at least 6 in 10 of the 72 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
Test-Driven Development Workflow
Write the test before the code, watch it fail for the right reason, then make it pass. This skill owns the loop, the
coverage gate, and the mocking boundary. coding-standards is the hub above it and the language testing skills hold the
per-stack mechanics.
When to activate
- Writing a new feature, an endpoint, or a component.
- Fixing a bug, where the test that reproduces it comes first.
- Refactoring, where the existing tests are the safety net that has to stay green.
- The coverage gate is failing, or a pull request is blocked on it.
- Deciding what to mock, or whether a test belongs at the unit, integration, or end-to-end layer.
When not to activate
- Browser journeys through a real UI, and the flaky-test policy. Use
e2e-testing, which is canonical for both. - Capability sweeps against a deployed stack with an API client. Use
e2e-runbooks. - Regression tests aimed specifically at AI-introduced defects and sandbox-path drift. Use
ai-regression-testing. - Per-language mechanics: pytest fixtures and parametrisation, Go table-driven tests and fuzzing, JUnit slice tests. Use
python-patterns,golang-patterns, orspringboot-patterns. - Load, soak, or capacity testing. Use
performance-optimizationfor the measurement discipline instead.
The loop
Write the user journey, turn it into test cases, watch them fail, implement the minimum, watch them pass, then refactor under green.
State the journey in one sentence before writing any test, because a test suite that cannot be traced back to a journey usually tests the implementation instead.
As a signed-in customer, I want to search the catalogue by keyword,
so that I can find a product without knowing its exact name.Turn the journey into cases that name the behaviour and the condition.
describe('catalogue search', () => {
it('returns matching products for a keyword', async () => {})
it('returns an empty list for a query that matches nothing', async () => {})
it('falls back to substring matching when the search index is unavailable', async () => {})
it('orders results by relevance score, highest first', async () => {})
})The RED gate
Running the new test and seeing it fail is mandatory before any production code changes. A test that was written but never executed proves nothing, and a failure caused by a typo proves nothing either.
npm testA valid RED state is one of two things. Runtime RED: the target compiles, the new test actually executes, and the result is a failure. Compile-time RED: the new test references code that does not exist yet, and the compile failure is itself the signal.
In both cases the failure must be caused by the missing implementation or the bug under repair, not by unrelated syntax errors, broken setup, missing dependencies, or a pre-existing regression elsewhere.
Fail: the failure is real but proves nothing about the behaviour under test.
FAIL src/search.test.ts
Cannot find module '@/lib/testing/helpers'Pass: the failure is the behaviour the test was written to demand.
FAIL src/search.test.ts > returns an empty list for a query that matches nothing
expected [] but received undefinedDo not touch production code until a valid RED state is confirmed. Then implement the minimum that turns it green, rerun the same target, and only refactor once green.
npm testRefactoring under green means removing duplication, improving names, and simplifying structure, with the suite rerun after each step.
Coverage gate
Around 90 percent line coverage of real logic, across unit, integration and end-to-end tests combined. Branch coverage sits at 70 to 80 percent. Critical logic reaches 100 percent where that genuinely adds value rather than as a ritual. No exclusion pattern may be added to dodge a meaningful test, and every edge case, error path, and boundary condition is covered.
Enforce it as a CI gate so a pull request that drops coverage below the threshold is blocked.
Fail: the config key is plural, so Jest ignores the whole block and the gate never fires.
{
"jest": {
"coverageThresholds": {
"global": { "branches": 70, "functions": 90, "lines": 90, "statements": 90 }
}
}
}Pass: the key Jest actually reads.
{
"jest": {
"coverageThreshold": {
"global": { "branches": 70, "functions": 90, "lines": 90, "statements": 90 }
}
}
}Verify locally before pushing.
npm run test:coverageTest layers
Three layers, with the bulk of the suite at the bottom. The proportions and the tooling per layer are in references/advanced-testing.md.
- Unit. Individual functions, pure logic, component behaviour, helpers. No input or output.
- Integration. Endpoints, data access, service interactions, external boundaries, run against real engines through Testcontainers.
- End-to-end. Critical user journeys through the real UI.
e2e-testingowns this layer entirely, including the Playwright patterns, locator rules, and CI wiring. Write the journeys there and reference them from here.
Test naming
Descriptive names in the project's existing style win. A reader who has never seen the code should learn the behaviour and the condition from the name alone.
Match what the project already does. Where a project has no convention, use the natural-language form from
coding-standards, which is the canonical rule: a sentence describing the behaviour and the condition that triggers it.
Fail: names that describe nothing.
test('works', () => {})
test('test search 2', () => {})
test('happyPath', () => {})Pass: natural-language form, the default.
test('returns an empty list when no product matches the query', () => {})
test('throws when the API key is missing', () => {})Pass: the <method>_<scenario>_<expectedResult> form, which is the same rule spelled differently and is idiomatic in
JUnit codebases. Use it when the project already uses it, not as a second convention alongside the first.
@Test
void calculateTotal_withEmptyCart_returnsZero() { }
@Test
void processPayment_whenCardDeclined_throwsPaymentException() { }The two forms are alternatives, never a mix inside one codebase.
Test structure
Every test sets up state, performs one action, then asserts the observable outcome. Which words label the three phases
is the project's choice: Arrange / Act / Assert and Given / When / Then are the common spellings. Read the
existing tests and match them.
One behaviour per test. Several assertions are fine when they all verify that one behaviour, and each test builds its own data so the order tests run in never matters.
Fail: the second test depends on the first.
test('creates a user', () => { createUser('alice') })
test('updates the same user', () => { updateUser('alice', { name: 'Alicia' }) })Pass: each test owns its setup.
test('creates a user', () => {
const user = createTestUser()
expect(findUser(user.id)).toBeDefined()
})
test('updates a user', () => {
const user = createTestUser()
updateUser(user.id, { name: 'Alicia' })
expect(findUser(user.id).name).toBe('Alicia')
})Test what the user observes
Assert the behaviour the caller can see, not the internal state that produced it. A test coupled to internals fails on every refactor and passes through real defects.
Fail:
expect(component.state.count).toBe(5)Pass:
expect(screen.getByText('Count: 5')).toBeInTheDocument()Never weaken an assertion to make a test pass. Fix the code, or fix the setup that was wrong.
Mocking boundaries
Mock only what you own, and only in unit tests. Do not mock the database when you can exercise it: integration tests run against a real engine through Testcontainers, never a shared staging instance. For third-party HTTP clients, ORMs, and cloud SDKs, prefer a real instance, the library's own official test double, or an HTTP-level fake such as WireMock or MSW. The detail behind both rules is in references/advanced-testing.md.
The mocks below are unit-test doubles for a boundary the test does not own, not a substitute for exercising the real datastore.
A repository, mocked at the interface the application defines.
jest.mock('@/lib/repositories/product-repository', () => ({
productRepository: {
findByKeyword: jest.fn(async () => [{ id: 1, name: 'Test Product' }]),
findById: jest.fn(async () => ({ id: 1, name: 'Test Product' })),
},
}))An external HTTP client, mocked at the project's own wrapper rather than at the vendor SDK.
jest.mock('@/lib/clients/search-client', () => ({
searchClient: {
query: jest.fn(async () => [{ id: 'test-product', score: 0.95 }]),
health: jest.fn(async () => ({ reachable: true })),
},
}))Note what both examples have in common: the seam is an interface the project defines, so the mock stays valid when the vendor library changes underneath it.
Flaky tests
e2e-testing holds the canonical flaky-test policy: the fix-or-quarantine SLA, the maximum quarantine period, what
happens when it expires, the prohibited sleep patterns, and when a framework retry is allowed. It applies to every
layer, not only browser tests. Do not restate it here, and do not adopt a second policy alongside it.
Continuous testing
Run the suite in watch mode while developing.
npm test -- --watchGate the commit on tests and lint.
npm test && npm run lintIn CI, run with coverage and upload the report.
- name: Run tests
run: npm test -- --coverage
- name: Upload coverage
uses: codecov/codecov-action@v7Reference map
| Task | Open |
| Test pyramid proportions, contract testing, mutation testing, performance testing, JaCoCo and PIT config, the Testcontainers mandate, the test data factory pattern | references/advanced-testing.md |
Related skills
coding-standardsholds the canonical test-naming and test-structure rules this skill applies.e2e-testingowns the browser layer and the flaky-test policy.e2e-runbooksowns capability verification against a deployed stack.ai-regression-testingowns bug-driven regression tests and sandbox-path parity.python-patterns,golang-patterns,springboot-patternshold the per-language mechanics.performance-optimizationowns the measurement discipline when a test proves something is slow.
Checklist
- A user journey was stated before the first test was written.
- The test was executed and produced a valid RED for the intended reason.
- No production code changed before that RED was confirmed.
- The implementation is the minimum that turns the test green.
- Refactoring happened only under green, with the suite rerun after each step.
- Around 90 percent line coverage of real logic, branch coverage 70 to 80 percent, enforced in CI.
- The coverage config uses the key the tool actually reads.
- Test names describe behaviour and condition, in one convention across the codebase.
- Every test builds its own data and passes in any order.
- Assertions target observable behaviour, and none was weakened to get green.
- Mocks sit at interfaces the project owns, and integration tests use Testcontainers.
- The full suite ran, not just the one test that was being fixed.
- No test is skipped or disabled without a tracked quarantine entry.
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.

