# Red green refactor

> Writes a failing test first, then the fix, so each bug fix and change comes with proof the code works.

- Page: https://youraiskill.com/skill/addyosmani-test-driven-development
- What it does: Drives development with tests using the red-green-refactor loop. Use when implementing any logic, fixing any bug, or changing any behavior. Use when you need to prove that code works, when a bug report arrives, or when you're about to modify existing functionality. Use when asked to add tests to a function, fix a bug in it or change its behavior, even when the code is pasted inline, the request does not mention tests and the answer looks obvious from reading it. The skill writes the failing test first and changes the function second, never the change alone.
- Niches: coding, testing
- Licence: MIT
- Status: Checked: open licence, author credited, passed the YourAISkill safety scan. Can be added to a paid pack.
- Contents: instructions and reference files only (2 files)

To add it, see https://youraiskill.com/guides/how-to-add-a-skill-to-claude
