red-green-refactor

red-green-refactor is a skill for Claude Code, Codex from rohitg00/skillkit. It costs 90 tokens per session (1,319 once invoked), scanned A, original, Apache-2.0.

A test-driven development method in which you write a failing test, add the smallest implementation that passes it, and then improve the code while keeping tests passing.

In plain words
What is it for?
Use it to develop features, fix bugs, or change behavior by following the red, green, and refactor steps.
Why use it?
It makes the required behavior explicit before implementation and helps catch regressions during refactoring.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to develop features, fix bugs, or change behavior by following the red, green, and refactor steps.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rohitg00/skillkit/red-green-refactor
About the project

SkillKit is a package manager for AI coding-agent skills that installs skills from many sources and translates them between the different formats used by coding agents. It helps developers share skills across agents such as Claude Code, Cursor, Copilot, and Codex.

rohitg00/skillkit · 1,558 stars · on GitHub · skillkit.sh

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 rohitg00/skillkit --skill red-green-refactor
Clone the repo
git clone --depth 1 https://github.com/rohitg00/skillkit

Made for: Claude Code, Codex.

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 red-green-refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/rohitg00/skillkit/red-green-refactor/github.svg)](https://agentmods.dev/skills/rohitg00/skillkit/red-green-refactor)
Your own site
<a href="https://agentmods.dev/skills/rohitg00/skillkit/red-green-refactor"><img src="https://agentmods.dev/badge/skills/rohitg00/skillkit/red-green-refactor/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 red-green-refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/rohitg00/skillkit/red-green-refactor"><img src="https://agentmods.dev/badge/skills/rohitg00/skillkit/red-green-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 90 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,319 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00090 $0.01319
Opus 5.5 $0.00036 $0.00528
Sonnet 5.5 $0.00018 $0.00264
Haiku 4.5 $0.00009 $0.00132

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

Security

Grade A, and why

red-green-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 1mo 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.

packages/core/src/methodology/packs/testing/red-green-refactor/SKILL.md · 169 lines

How it starts

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

Red-Green-Refactor Methodology

You are following the RED-GREEN-REFACTOR cycle for test-driven development. Every new feature, bug fix, or behavior change starts with a failing test.

The Cycle

1. RED Phase — Write a Failing Test

  1. Understand the requirement — what specific behavior must exist?
  2. Write one test asserting that behavior
  3. Run the test — it MUST fail (red)
  4. Verify the failure reason — not a syntax error, but a missing implementation

The test should be focused on ONE behavior, named descriptively, and use clear assertions.

Executable example (Jest):

// calculateTotal.test.js
const { calculateTotal } = require('./calculateTotal');

describe('calculateTotal', () => {
  it('should apply 10% discount when total exceeds 100', () => {
    const items = [{ price: 60 }, { price: 60 }]; // total = 120
    expect(calculateTotal(items)).toBe(108); // 120 * 0.90
  });
});

Running this now produces: Cannot find module './calculateTotal' — correct RED state.


2. GREEN Phase — Make the Test Pass

Write the minimum code needed to pass the test. Don't add anything extra.

// calculateTotal.js
function calculateTotal(items) {
  const total = items.reduce((sum, item) => sum + item.price, 0);
  return total > 100 ? total * 0.9 : total;
}
module.exports = { calculateTotal };

Run the test — it passes. GREEN achieved. Stop here; resist adding more logic.


3. REFACTOR Phase — Improve the Code

With a passing test as your safety net, clean up the implementation. Run tests after every change.

// calculateTotal.js — refactored for clarity
const DISCOUNT_THRESHOLD = 100;
const DISCOUNT_RATE = 0.9;

function calculateTotal(items) {
  const subtotal = items.reduce((sum, { price }) => sum + price, 0);
  return subtotal > DISCOUNT_THRESHOLD ? subtotal * DISCOUNT_RATE : subtotal;
}
module.exports = { calculateTotal };

Test still passes — GREEN maintained. Constants now communicate intent.


Read the full file on GitHub · 169 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. 1mo ago First seen · 169 lines · 90 tokens per session scan A a20e71fb1428

Subscribe to this mod's changes

red-green-refactor is a skill published in the GitHub repository rohitg00/skillkit (1,558 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 90 tokens to every session and 1,319 once invoked, about $0.0004 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-30.