testing-new-code

testing-new-code is a skill for Claude Code from gg-mo/repo-hygiene. It costs 56 tokens per session (1,029 once invoked), scanned A, original, MIT.

A testing rule for new or changed business logic, branching code, public API, or bug fixes. It requires tests before the change is committed; TDD means writing a failing test first, then the code that makes it pass.

In plain words
What is it for?
Use it when adding behavior, changing an existing function, fixing a bug, or adding a command, HTTP route, GraphQL field, or exported function.
Why use it?
Manual checks do not protect the behavior during later changes, so bugs can return without a recorded test.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the repo-hygiene plugin — 9 skills, 1 hook shipped together

Good fit Use it when adding behavior, changing an existing function, fixing a bug, or adding a command, HTTP route, GraphQL field, or exported function.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/gg-mo/repo-hygiene/testing-new-code
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.

Any agent
npx skills add gg-mo/repo-hygiene --skill testing-new-code
Clone the repo
git clone --depth 1 https://github.com/gg-mo/repo-hygiene

Made for: Claude Code.

Or install repo-hygiene, the plugin that ships this one along with the rest of its 9 skills, 1 hook.

Wrote 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.

agentmods badge for testing-new-code

README.md
[![agentmods](https://agentmods.dev/badge/skills/gg-mo/repo-hygiene/testing-new-code/github.svg)](https://agentmods.dev/skills/gg-mo/repo-hygiene/testing-new-code)
Your own site
<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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for testing-new-code

Your own site · 80×15
<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="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,029 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00056 $0.01029
Opus 5.5 $0.00022 $0.00412
Sonnet 5.5 $0.00011 $0.00206
Haiku 4.5 $0.00006 $0.00103

Measured 3mo ago against content hash 6fc211a17598, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 3mo 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.

skills/testing-new-code/SKILL.md · 107 lines

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:

  1. Write the test against the pre-fix code → should FAIL
  2. Apply the fix → test should PASS
  3. Revert the fix once → test should fail again (proves it covers the bug)
  4. 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

Read the full file on GitHub · 107 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. 3mo ago First seen · 107 lines · 56 tokens per session scan A 6fc211a17598

Subscribe to this mod's changes

testing-new-code is a skill published in the GitHub repository gg-mo/repo-hygiene (3 stars, last pushed 6mo ago), licensed MIT. It adds 56 tokens to every session and 1,029 once invoked, about $0.0002 per session on Opus 5.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

testing-new-code compared with skills from other repositories

testing-new-code next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
testing-new-codegg-mo/repo-hygieneSkill36mo agoMITA56Claude Code
testing-principlesshinpr/claude-code-workflowsSkill725yesterdayMITA49Claude Code
plangreglas75/zuvoSkill7todayMITA53Claude Code
engineering-craftmickeyyaya/evolve-loopSkill8todayApache-2.0A40Claude Code
tddmickeyyaya/evolve-loopSkill8todayApache-2.0A47Claude Code
unbiased-reviewkarsten-s-nielsen/mad-scientist-skillsSkill31mo agoMITA84Claude Code
testing-guideakaszubski/autonomous-devSkill3510d agononeA74Claude Code