New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Test-driven development skill that enforces red-green-refactor cycles only when explicitly requested.

version
0.0.23
GitHub stars
37
View on GitHub

What it does

  • Adds the tdd skill, a Test-Driven Development workflow built around the red-green-refactor cycle
  • Activates only when a user explicitly asks for TDD, not for general test writing in your project

Development practices: TDD workflow with red-green-refactor

Add marketplace

/plugin marketplace add spences10/claude-code-toolkit

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install dev-practices@claude-code-toolkit

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

Test-Driven Development

Drive implementation through tests using the red-green-refactor cycle.

Adapted from Matt Pocock's TDD skill

Trigger Patterns

  • "use TDD"
  • "TDD this feature"
  • "red-green-refactor"
  • "test-driven"
  • "write tests first"

Do not activate for general "write tests for X" or "add test coverage" requests. This skill is specifically for the TDD workflow where tests lead implementation.

Philosophy

Test behavior, not implementation. Every test should verify what the code does from the outside, not how it works inside. See deep-modules.md for the reasoning behind this.

Good tests act as a contract: they define what the module promises to its callers. If you can swap the internals completely and your tests still pass, they're testing the right thing.

Workflow

1. Plan the Interface

Before writing any code, decide the public surface area:

  • What functions/methods/endpoints will exist?
  • What are the inputs and outputs?
  • What are the edge cases and error conditions?

Design for the caller, not the implementation. See interface-design.md.

2. Write a Tracer Bullet Test

Start with one test that exercises the simplest meaningful path through the feature. This test should:

  • Call the public API as a real consumer would
  • Assert the most basic expected output
  • Fail — because the implementation doesn't exist yet
RED: test exists, code does not

Run the test. Confirm it fails for the right reason (missing function, wrong return value — not a syntax error).

3. Make It Green

Write the minimum code to pass that one test. Do not write more than what the test demands. Hardcode return values if that's all it takes. The goal is a green test suite, not elegant code.

GREEN: test passes with minimal implementation

4. Refactor Under Green

With the test passing, clean up. Remove duplication, improve names, extract helpers — but only while tests stay green. See refactoring.md.

REFACTOR: improve code quality, tests still pass

5. Repeat

Add the next test. Pick the next simplest behavior that isn't covered. Follow the same cycle:

  1. Write a failing test
  2. Make it pass with minimal code
  3. Refactor while green

Build up complexity incrementally. Each cycle should take minutes, not hours.

6. Handle Edge Cases

After the core behavior works, add tests for:

  • Invalid inputs and error conditions
  • Boundary values
  • Empty/null/undefined cases
  • Concurrent access if relevant

7. Final Refactor

Once all behavior is covered, do a final pass:

  • Look for patterns across tests — consolidate setup with helpers
  • Check that test names clearly describe the behavior being verified
  • Ensure no test depends on another test's state
  • Review implementation for unnecessary complexity

When to Mock

Use real dependencies when practical. Mock only at system boundaries — network calls, databases, file systems, clocks. See mocking.md for detailed guidance.

Test Quality

Write tests that are readable, independent, and fast. See tests.md for patterns on naming, structure, and assertion style.

Anti-patterns

  • Writing implementation before the test (defeats the purpose)
  • Writing multiple tests before making any pass (too much red)
  • Skipping the refactor step (accumulates mess)
  • Testing private methods or internal state
  • Making tests pass by weakening assertions
  • Mocking everything instead of testing real behavior

References

From the spences10/claude-code-toolkit README

claude-code-toolkit

Productivity and ecosystem tools for Claude Code.

For vendor-agnostic skills usable outside Claude Code's plugin marketplace, use spences10/skills.

Quick Start

# Add marketplace
/plugin marketplace add spences10/claude-code-toolkit

# Install plugins
/plugin install mcp-essentials
/plugin install analytics
/plugin install toolkit-skills
/plugin install claude-workflow
/plugin install dev-environment
/plugin install devops-skills
/plugin install dev-practices
/plugin install nopeek

Plugins

mcp-essentials

Setup guide for recommended MCP servers:

ServerPurpose
mcp-omnisearchUnified search (Tavily, Kagi, GitHub, Perplexity)
mcp-sqlite-toolsSafe SQLite operations
mcpickManage MCP servers, plugins, cache, and profiles

Skills: mcp-setup — setup guide for configuring MCP servers

analytics

Query Claude Code usage from ccrecall database:

  • Token usage by model/project/day
  • Session history
  • Thinking block search

Skills: analytics — query token usage and session history

toolkit-skills

Core skills for the toolkit ecosystem.

SkillDescription
ecosystem-guideGuide to choosing the right tool across the ecosystem
researchVerify sources before presenting findings
skill-creatorDesign and create Claude Skills using progressive disclosure
reflectExtract learnings from sessions and persist to skills
plugin-devValidate, test, and distribute Claude Code plugins

claude-workflow

Claude Code workflow patterns.

SkillDescription
advanced-promptingHigh-leverage prompts that challenge Claude's defaults
claude-md-maintenanceMaintain CLAUDE.md files effectively
orchestrationMulti-agent orchestration patterns for team mode
structured-rpiEnhanced Research-Plan-Implement workflow with structured phase gates

dev-environment

Development environment setup.

SkillDescription
terminal-optimizationTerminal setup for Claude Code (Ghostty, statusline, tmux)
worktree-masteryGit worktree patterns for parallel Claude sessions

devops-skills

DevOps patterns.

SkillDescription
ci-debug-workflowDebug failing CI pipelines and reproduce bugs locally
techdebt-finderFind duplicated code, inconsistent patterns, and refactoring opportunities
deslopIdentify and remove AI-generated code patterns (slop)
improve-codebase-architectureFind architectural improvement opportunities and deepen shallow modules

dev-practices

Development practice skills.

SkillDescription
tddTest-Driven Development workflow with red-green-refactor cycle

nopeek

Secret safety for Claude Code sessions. Powered by the nopeek CLI.

HookEventWhat it does
redact-outputPreToolUse(Bash)Best-effort pattern redaction for selected cloud CLI stdout; not stderr

Tell your coding agent: Use npx nopeek if you need keys. Swap npx for pnpx or bunx if that's what you use. The agent selects keys and uses run for each credential-dependent command. init is an optional cloud-auth audit, not an installation prerequisite.

Security migration: Update to nopeek CLI 0.0.17 or newer and nopeek plugin 0.0.24 or newer. Stored credentials and CLI profiles are no longer automatically loaded into sessions, and load no longer writes CLAUDE_ENV_FILE. Remove legacy SessionStart registrations and restart affected sessions. The retired session-load.sh entry point only prints migration guidance; it never reads stored keys. Neither updating nor deleting stored keys clears old environments, session files, histories, or transcripts. Rotate exposed credentials.

Persistence remains explicit, global plaintext, and not project-scoped; load --persist now requires --only. Prefer per-command run instead. run --only filters the file, not inherited parent variables, and does not prevent child output or argument disclosure. Redaction is not a guarantee.

Skills: nopeek — per-command credentials, migration, and limitations

Regression checks (synthetic credentials only):

python3 -m unittest discover -s plugins/nopeek/tests -v
claude plugin validate plugins/nopeek

See the cross-agent assessment for source-backed comparisons and the tested delivery boundary.

Ecosystem

Related projects for Claude Code power users. For portable skills across compatible agents, use spences10/skills.

ProjectWhat it does
nopeekPer-command credential loading that reduces accidental disclosure
svelte-skills-kitProduction-ready Svelte 5 & SvelteKit skills (90%+ verified accuracy)
claude-skills-cliCreate skills with progressive disclosure validation and 84% activation hooks
mcpickManage MCP servers, plugins, cache, and profiles from the CLI
ccrecallSync Claude Code transcripts to SQLite for usage analytics and search

Local Development

git clone git@github.com:spences10/claude-code-toolkit.git ~/repos/claude-code-toolkit

# Add local marketplace
/plugin marketplace add ~/repos/claude-code-toolkit

# Install plugin
/plugin install mcp-essentials

Releasing Updates

Version lives in one place: .claude-plugin/marketplace.json. Bump all "version" values there, commit, and push. Users with auto-update get changes on startup. Others run /plugin update plugin-name@spences10-claude-code-toolkit.

Details

Marketplace
spences10/claude-code-toolkit
Source
plugins/dev-practices
Author
Scott Spence
Category
Skills
License
MIT
Keywords
tdd, testing, red-green-refactor, test-driven
Listed since
Apr 7, 2026

More from spences10/claude-code-toolkit

All 8

Similar to dev-practices

More Testing & QA