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 skills/gg-mo/repo-hygiene/testing-new-codenpx skills add gg-mo/repo-hygiene --skill testing-new-codegit clone --depth 1 https://github.com/gg-mo/repo-hygieneWrote 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/skills/gg-mo/repo-hygiene/testing-new-code)<a href="https://agentmods.dev/skills/gg-mo/repo-hygiene/testing-new-code"><img src="https://agentmods.dev/badge/skills/gg-mo/repo-hygiene/testing-new-code.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.1 | $0.00056 | $0.01029 |
| Opus 5 | $0.00028 | $0.00515 |
| Sonnet 5 | $0.00011 | $0.00206 |
| Haiku 4.5 | $0.00006 | $0.00103 |
Grade A, and why
testing-new-code 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 5d 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 — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Testing New Code
Overview
In a repo using repo-hygiene, new code paths get tests before they're committed. The default is YES; "tests-after-if-asked" is the wrong default. Manual sanity checks are not tests — they leave no regression net for the next change.
Core principle: Untested code is one unrelated refactor away from broken.
REQUIRED BACKGROUND: If superpowers:test-driven-development is already active in this session, follow its RED-GREEN-REFACTOR cycle and consider this skill satisfied. Use this skill only when TDD is not driving the workflow.
When To Use
- Wrote a new function with any branching or business logic
- Fixed a bug (regression test required — see below)
- Changed behavior of an existing function
- Added a public API entry point (CLI, HTTP, GraphQL, exported function)
When NOT to Use (Genuine Triviality Only)
- Pure renames, formatting, or type-annotation-only changes
- Modifying a pass-through wrapper already tested at a higher layer
- Adding a constant
- Documentation-only changes
- Test code itself
Not a valid exception: "It's only 3 lines." Three lines of business logic still need a test.
Bug Fixes Require Regression Tests
A bug fix without a regression test is incomplete. Verify the red-green cycle:
- Write the test against the pre-fix code → should FAIL
- Apply the fix → test should PASS
- Revert the fix once → test should fail again (proves it covers the bug)
- Re-apply the fix → test passes (final state)
If the test passes with the fix reverted, it isn't covering the bug.
Where Do Tests Live?
Mirror the repo's existing convention. If the repo has no tests yet, default to:
| Language | Default |
|---|---|
| JavaScript / TypeScript | *.test.ts or *.spec.ts next to source, or __tests__/ sibling |
| Python | tests/test_<module>.py at repo root |
| Go | *_test.go next to source |
| Rust | #[cfg(test)] mod tests { ... } in same file; tests/ for integration |
| Java / Kotlin | src/test/... mirroring source |
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.
- 5d ago First seen · 107 lines · 56 tokens per session scan A 6fc211a17598
testing-new-code is a skill published in the GitHub repository gg-mo/repo-hygiene (3 stars, last pushed 3mo ago), licensed MIT. It adds 56 tokens to every session and 1,029 once invoked, about $0.0003 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 skills, from other repositories
testing-principles
Language-agnostic testing principles including TDD, test quality, coverage standards, and test design patterns. Use when writing tests, designing test strategies, or reviewing test quality.
specify-incremental
Decompose a single-feature specification into a linear, phase-by-phase implementation plan. Use this for medium-complexity work — single feature, one or two components — where transparent human-in-the-loop phase review is preferred over factory automation.
plan
Analyzes architecture, selects patterns, assesses testability, then decomposes work into ordered TDD tasks with exact verification commands and explicit acceptance mapping. Works from an approved spec (zuvo:brainstorm output) or directly from a user-provided description.
unbiased-review
Use when reviewing a spec, plan, or implementation produced by another session - verifies its claims against the actual repo, grades TDD and hexagonal discipline, and reports severity-ranked findings without writing the fix. Triggers on "review this spec/plan/implementation", "second opinion on", "check this design"…
engineering-craft
Use when writing or changing any production code or tests — new features, bug fixes, refactors, or test authoring, in any language, by any model on any CLI.
tdd
Use when implementing features or bug fixes test-first.