test-driven-development

A guide to test-driven development, or TDD, a method where a failing automated test is written before the code that should make it pass. It follows a repeatable red, green, and refactor cycle.

In plain words
What is it for?
Developing business logic, use cases, repositories, and view models, as well as reproducing and fixing bugs with focused tests and verified implementation changes.
Why use it?
Writing implementation first can leave requirements unclear or bugs untested. TDD makes the expected behavior explicit and checks the fix at each stage.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/rabee-elkholy/android-harness-kit/test-driven-development
Any agent
npx skills add rabee-elkholy/android-harness-kit --skill test-driven-development
Clone the repo
git clone --depth 1 https://github.com/rabee-elkholy/android-harness-kit

Made for: Claude Code, Codex.

Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 572 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00047 $0.00572
Opus 5 $0.00023 $0.00286
Sonnet 5 $0.00009 $0.00114
Haiku 4.5 $0.00005 $0.00057

Measured 2d ago against content hash de138d0bd65a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test-driven-development scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/skills/test-driven-development/SKILL.md · 46 lines

How it starts

The opening of the file, as written. The whole thing — 46 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Test-Driven Development (TDD) Skill

1. Core Principle: Red-Green-Refactor

Production code is only written in response to a failing test that defines its requirements or reproduces a defect.


2. Four-Phase TDD Protocol

Phase 1: RED (Write the Failing Test)

  • Author a concise, focused unit test in src/test/java/.../*Test.kt.
  • Test names must clearly describe the scenario and expected outcome (e.g. loginViewModel_invalidPassword_emitsValidationError()).
  • Capture both happy paths and boundary/error cases.

Phase 2: PROVE FAILURE (Empirical Verification)

  • Execute the targeted unit test task:
    python .agents/scripts/run_gradle_task.py :app:testDebugUnitTest --tests "com.package.FeatureTest.testName"
    
  • Verify that the test fails for the expected assertion reason (not due to a compilation failure or configuration error).

Phase 3: GREEN (Minimal Implementation)

  • Write the minimal amount of production code required to make the failing test pass.
  • Re-run the targeted test to verify BUILD SUCCESSFUL and test pass.

Phase 4: REFACTOR & HARDEN

  • Improve code readability, remove duplication, and extract reusable helpers.
  • Ensure strict adherence to Shift-Left Quality Invariants:
    1. Single-source StateFlow unidirectional data flow.
    2. Zero inline FQCNs.
    3. Zero synchronous I/O on Dispatchers.Main.
    4. Proper Coroutine cancellation and dispatcher handling (StandardTestDispatcher with advanceUntilIdle()).

3. Test Quality Invariants (Mandatory for Pre-Review Gate)

  1. Assertion Depth: Every @Test method must have at least $\ge 2$ meaningful assertions (assertEquals, assertTrue, assertNull). Trivial checks (assertTrue(true)) are strictly prohibited.
  2. Coroutines & Turbine: Use runTest with StandardTestDispatcher or app.cash.turbine:turbine for testing Flows and Channels.
  3. Mock Isolation: Use pure Fakes or explicit coEvery/every definitions with relaxed = false for critical domain assertions. Never leak mock state across tests; reset in @After.
  4. Zero Placeholder Tests: Never commit empty test stubs or TODO() test bodies.

Read the full file on GitHub · 46 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 46 lines · 47 tokens per session scan A de138d0bd65a

Subscribe to this mod's changes

test-driven-development is a skill published in the GitHub repository rabee-elkholy/android-harness-kit (3 stars, last pushed 2d ago), licensed MIT. It adds 47 tokens to every session and 572 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

ui-ux-pro-max

UI/UX design intelligence for web, mobile, and desktop. This skill should be used when designing, building, reviewing, or fixing interfaces, including pages, components, design systems, accessibility, interaction, responsive layout, typography, color, charts, and stack-specific UI implementation. Searchable local…

nextlevelbuilder/ui-ux-pro-max-skill · 114 tokens

design

Comprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini or Atlas Cloud AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social/ads/web/print), icon design (15 styles, SVG, Gemini 3.1 Pro), social…

nextlevelbuilder/ui-ux-pro-max-skill · 144 tokens

ui-styling

Create beautiful, accessible user interfaces with shadcn/ui components (built on Radix UI + Tailwind), Tailwind CSS utility-first styling, and canvas-based visual designs. Use when building user interfaces, implementing design systems, creating responsive layouts, adding accessible components (dialogs, dropdowns…

nextlevelbuilder/ui-ux-pro-max-skill · 90 tokens

banner-design

Design banners for social media, ads, website heroes, creative assets, and print. Multiple art direction options with optional generated or supplied visuals. Actions: design, create, generate banner. Platforms: Facebook, Twitter/X, LinkedIn, YouTube, Instagram, Google Display, website hero, print. Styles: minimalist…

nextlevelbuilder/ui-ux-pro-max-skill · 99 tokens

design-system

Token architecture, component specifications, and slide generation. Three-layer tokens (primitive→semantic→component), CSS variables, spacing/typography scales, component specs, strategic slide creation. Use for design tokens, systematic design, brand-compliant presentations.

nextlevelbuilder/ui-ux-pro-max-skill · 52 tokens

brand

Brand voice, visual identity, messaging frameworks, asset management, brand consistency. Activate for branded content, tone of voice, marketing assets, brand compliance, style guides.

nextlevelbuilder/ui-ux-pro-max-skill · 35 tokens