green

A step in test-driven development (TDD), where you write only enough code to make one failing test pass.

In plain words
What is it for?
Use it to implement the simplest solution for the current failing test, confirm the tests pass, and postpone optimisation and cleanup.
Why use it?
It keeps the change small and focused, so you do not build features before they are required.

Command for Claude 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.

agentmods
npx agentmods add commands/marcoemrich/exact-coding-exercises/green
Clone the repo
git clone --depth 1 https://github.com/marcoemrich/EXACT-Coding-Exercises

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,002 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.00000 $0.01002
Opus 5 $0.00000 $0.00501
Sonnet 5 $0.00000 $0.00200
Haiku 4.5 $0.00000 $0.00100

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

Security

Grade A, and why

green 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 3d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

  • green — 88% identical, 7 lines differ
.claude/commands/green.md · 140 lines

How it starts

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

TDD Green Phase

You are now in the Green Phase of TDD. Follow these instructions to make the failing test pass with MINIMAL code.

Your Mission

  1. Implement the minimal code necessary to make the failing test pass
  2. Use the simplest possible solution (hardcoded values are acceptable)
  3. Avoid adding features for future tests
  4. Verify all tests pass
  5. NO optimization, NO refactoring yet

Context: $ARGUMENTS

Green Phase Rules

  • Minimal code only: Just enough to pass the current test
  • Baby steps: Make the smallest possible change
  • No future features: Don't implement what future tests might need
  • Simple is better: Hardcoded returns are perfectly fine
  • Tests must pass: Verify all tests are green
  • No refactoring yet: Save improvements for Refactor phase

Process

Step 1: Analyze the Failing Test

Understand what the test expects:

  • What input does the test provide?
  • What output does it expect?
  • What is the simplest way to produce that output?

Step 2: Write Minimal Implementation

Implement only what's needed to make the current test pass:

// For first test "should return 0 for empty input":
export const calculate = (input: string): number => {
  return 0; // Minimal - just make the test pass
};

// For second test "should return number for single input":
export const calculate = (input: string): number => {
  if (input === "") return 0;
  return parseInt(input); // Still simple
};

// For third test "should add two numbers":
export const calculate = (input: string): number => {
  if (input === "") return 0;
  const numbers = input.split(",");
  if (numbers.length === 1) return parseInt(numbers[0]);
  return parseInt(numbers[0]) + parseInt(numbers[1]); // Only now add logic
};

Step 3: Run Tests

Run npm test and verify:

  • Current test now passes ✅
  • All previous tests still pass ✅

Step 4: Verify No Over-Implementation

Check yourself:

  • ❓ Did I implement features for future tests? → Remove them
  • ❓ Did I add logic not demanded by current test? → Remove it
  • ❓ Did I optimize prematurely? → Simplify
  • ❓ Did I refactor existing code? → Revert, save for Refactor phase

Read the full file on GitHub · 140 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. 3d ago First seen · 140 lines · 0 tokens per session scan A 921593295b92

Subscribe to this mod's changes

green is a command published in the GitHub repository marcoemrich/EXACT-Coding-Exercises (13 stars, last pushed 13d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,002 tokens. 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-30.