Agent skill · Testing & QA

red-green-refactor

Guides the red-green-refactor TDD workflow: write a failing test first, implement the minimum code to make it pass, then refactor while keeping tests green. Use when a user asks to practice TDD, write tests first, follow red-green-refactor, do test-driven development, write failing tests before code, or phrases like 'make the test pass', 'test coverage', or 'unit tests before implementation'.

Rohit Ghumare73,165★ · +3,601/wk · 3 repos on radarProfile →
codexcursorApache-2.0
Install
npx skills add rohitg00/skillkit --skill red-green-refactor --agent codex

Same command for any agent — swap --agent for claude-code, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 5 KB
Bundled scripts: none
Version: 1.0.0
Path: packages/core/src/methodology/packs/testing/red-green-refactor/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 1,422
Language: TypeScript

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 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):** ```js // 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. ```js // calculateTotal.js function calculateTotal(items) { const total = i

What's inside
Steps it walks through
  1. The Cycle
  2. 1. RED Phase — Write a Failing Test
  3. 2. GREEN Phase — Make the Test Pass
  4. 3. REFACTOR Phase — Improve the Code
  5. End-to-End Example: Adding a New Behavior
  6. Workflow Steps
  7. Decision Points
  8. Write a new test when:
  9. Don't write a test when:
  10. Verification Checklist
  11. Common Mistakes to Avoid
  12. Integration with Other Skills
More from skillkit
All skills →
About this skill
What does the red-green-refactor skill do?

Guides the red-green-refactor TDD workflow: write a failing test first, implement the minimum code to make it pass, then refactor while keeping tests green. Use when a user asks to practice TDD, write tests first, follow red-green-refactor, do test-driven development, write failing tests before code, or phrases like 'make the test pass', 'test coverage', or 'unit tests before implementation'.

How do I install it?

Run `npx skills add rohitg00/skillkit --skill red-green-refactor --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From rohitg00/skillkit, a repository with 1,422 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going