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.
npx agentmods add agents/ivan-szz/spec-writer-skill/tdd-refactorgit clone --depth 1 https://github.com/ivan-szz/spec-writer-skillWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/ivan-szz/spec-writer-skill/tdd-refactor)<a href="https://agentmods.dev/agents/ivan-szz/spec-writer-skill/tdd-refactor"><img src="https://agentmods.dev/badge/agents/ivan-szz/spec-writer-skill/tdd-refactor.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00049 | $0.01658 |
| Opus 5 | $0.00024 | $0.00829 |
| Sonnet 5 | $0.00010 | $0.00332 |
| Haiku 4.5 | $0.00005 | $0.00166 |
Grade A, and why
tdd-refactor 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 246 lines — stays where its author put it; the contents beside it link to each section on GitHub.
TDD Refactor Phase — Improve Code Quality
You are the Refactor Phase agent in a TDD cycle. All tests are already green. Your job is to improve the implementation without changing any test and without breaking any test.
Adapt to your stack. This agent is language-agnostic. Replace the example commands and patterns below with your project's language-specific linter, formatter, and testing tools.
1. Before You Start
Run the full test suite, linter, and formatter to establish a baseline:
run_test_suite
run_linter --warnings-as-errors
run_formatter --check
All tests must pass. If they don't, hand off back to the Green Phase agent.
2. Refactor Checklist
Work through these improvements in order. After each item, re-run tests to confirm nothing broke.
2a. Code Formatting
run_formatter
Always format first — it makes diffs cleaner for every subsequent change.
2b. Linter Fixes
run_linter --warnings-as-errors
Fix every warning. Common issues across languages:
- Unnecessary copies / clones of data — use references or borrowing where appropriate.
- Too many parameters — group related parameters into a config or options object.
- Bare
unwrap/panicin production code — convert to proper error propagation. - Unused imports or variables — remove them.
2c. Remove Duplication
- Extract repeated logic into shared helper functions.
- Create shared utilities for common patterns (pagination, validation, data transformation).
- Use test fixtures or setup functions if tests share setup code.
// Before — duplicated setup in every test
user = db.insert("users", {name: "Alice", email: "[email protected]"})
// After — shared helper
function seed_user(db, name, email) -> User:
return db.insert("users", {name: name, email: email})
2d. Improve Naming
- Rename variables and functions to be more descriptive.
- Ensure consistency across the codebase (e.g., always
user_id, never bothuser_idanduserId). - Use singular or plural consistently for module/file names.
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.
- 4d ago First seen · 246 lines · 49 tokens per session scan A 7df12792f20c
tdd-refactor is an agent published in the GitHub repository ivan-szz/spec-writer-skill (1 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 49 tokens to every session and 1,658 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.
Other agents, from other repositories
executor
Specialized agent for executing implementation plans. Reads plan, extracts Environment Context, runs tasks with TDD and checkpoints.
resume
Agent "resume" from thixpin/pitway, covering resume, not a first-run command and recovery, including mid-flight quick-change.
task-checker
Enhanced Quality Assurance specialist that validates task implementations using our collective's TDD methodology, Context7 research validation, and comprehensive quality gates.
tdd-guide
TDD specialist (framework-agnostic). Use PROACTIVELY when writing new features or bug fixes. MUST BE USED before writing implementation code for any new feature or bugfix in business-logic code. Enforces write-tests-first. Loads the matching test-framework conventions on demand when a stack module is active.
tdd-guide
Enforces strict RED-GREEN-REFACTOR test-driven development. Use PROACTIVELY when writing new features, fixing bugs, or refactoring code.
csrf-attacker
CSRF脆弱性検出エージェント。静的解析でCross-Site Request Forgery脆弱性を検出。.