mcpbeat Sign in

Common Tdd Agent Skill

Implements a strict Red-Green-Refactor loop to ensure zero production code is written without a prior failing test. Use when: creating new features, fixing bugs, or expanding test coverage.

3k tokens
context cost
the whole folder, loaded on every use
8
files
instructions only
0
copies elsewhere
how many repositories repackaged it
536
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/HoangNguyen0403/agent-skills-standard --skill common-tdd

What comes with it

8 760 bytes besides the instruction
references/aaa_example.md
references/aaa_methodology.md
references/anti-patterns.md
references/best-practices.md
references/tdd_patterns.md
references/test_runners.md
references/testing_anti_patterns.md

The instruction itself

11 sections, as written by the author

Test-Driven Development (TDD) Standard

Priority: P0 (CRITICAL)

> Iron Law: NO PRODUCTION CODE WITHOUT FAILING TEST FIRST.

> Code written before test MUST deleted. Start over.

Step 1: RGR Loop (Red-Green-Refactor)

> [!TIP]

> Orchestration: If sub-agents are available, delegate each AC implementation to specialist-tdd-implementer.

  • RED: Write minimal failing test. Verify failure (Expected error, not typo).
  • GREEN: Write simplest code to pass. Verify pass.
  • REFACTOR: Clean up code while staying green.

Red Flags

  • Stop if code exists before test: Delete it. Restart from RED.
  • Stop if test passes first run: You tested old behavior.
  • Stop if "tests after" appears: That is not TDD.

AAA Structure (Mandatory)

Every test must follow Arrange-Act-Assert:

  • Arrange: Set up inputs, stubs, mocks, and expected values.
  • Act: Call single unit under test.
  • Assert: Verify output and side effects. One logical assertion per test.

(See AAA Example for code structure).

Step 3: Verification & Thresholds

  • Minimum Coverage: 80% (Stat/Func/Line), 75% (Branch).
  • Mocks:
  • Always mock: HTTP, Time/Date, Filesystem.
  • Never mock: Fast internal services (<200ms), pure domain logic.
  • See Test Runner Reference for environment-specific commands.

Step 4: Principles & Mocks

  • Watch it Fail: Prove test works before writing code.
  • Minimalism: Don't add features/options beyond current test (YAGNI).
  • Isolation: Mock external APIs (HTTP) and Time.
  • Realism: Prefer real DBs (test containers) and fast internal services (<200ms).

Rationalization Prevention

  • "Too small to test": Small code still regresses. Write the test.
  • "Manual testing is enough": Manual checks do not prove the RED step.
  • "Keep code as reference": Pre-test code biases the implementation. Delete it.
  • "Tests after are equivalent": Passing immediately proves little.

Verification Checklist

  • [ ] Every new function/method failing test first?
  • [ ] Failure message expected?
  • [ ] Minimal code implemented passed?
  • [ ] AAA structure followed?
  • [ ] Coverage thresholds met?

Expert References

  • AAA Example
  • AAA Methodology
  • Test Runners
  • TDD Patterns
  • Testing Anti-Patterns

Anti-Patterns

  • No test-after: Writing tests post-implementation defeats TDD. Delete and restart.
  • No assertion-free tests: test without assert not test.
  • No testing implementation: Test behavior and contracts, not internal calls.
  • A passing test alone is not enough: the failing test must demonstrate missing behavior before implementation.

Other skills for the same job

different authors, same section of the catalogue
Webapp Testing
by anthropics
vendor ×12

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

6k tokens scripts
Finishing A Development Branch
by ZhanlinCui
×7

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup

1k tokens
Test Driven Development
by w95
×7

Use when implementing any feature or bugfix, before writing implementation code

2k tokens
Systematic Debugging
by ratacat
×7

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

10k tokens scripts
Verification Before Completion
by ZhanlinCui
×6

Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

1k tokens
Backtest Expert
by BaggaT236
×3

Expert guidance for systematic backtesting of trading strategies. Use when developing, testing, stress-testing, or validating quantitative trading strategies. Covers "beating ideas to death" methodology, parameter robustness testing, slippage modeling, bias prevention, and interpreting backtest results. Applicable when user asks about backtesting, strategy validation, robustness testing, avoiding overfitting, or systematic trading development.

15k tokens scripts
Adaptyv
by christophacham
×3

Cloud laboratory platform for automated protein testing and validation. Use when designing proteins and needing experimental validation including binding assays, expression testing, thermostability measurements, enzyme activity assays, or protein sequence optimization. Also use for submitting experiments via API, tracking experiment status, downloading results, optimizing protein sequences for better expression using computational tools (NetSolP, SoluProt, SolubleMPNN, ESM), or managing protein design workflows with wet-lab validation.

16k tokens
Aeon
by christophacham
×3

This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.

19k tokens

How to use it

Copy the folder

Take hoangnguyen0403/common-tdd from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.