TDD: red → green → refactor

Deliver one behavior at a time with visible failing and passing test evidence.

Read this prompt as Markdown or plain text

When to use it

Each requested behavior gets an observable red and green signal, while the refactor boundary prevents speculative cleanup from hiding inside the feature diff.

Prompt

Implement [BEHAVIOR OR ISSUE] using strict red → green → refactor cycles.

First, read the issue/specification, repository guidance, existing implementation, and nearby tests. Convert the requested behavior into a short checklist of externally observable outcomes.

For each outcome, one at a time:
1. RED — write the smallest meaningful test for that behavior. Run it and confirm it fails for the expected behavioral reason, not because of setup, import, or syntax errors. Show the test name and concise failure.
2. GREEN — make the minimum production change needed to pass that test. Run the targeted test and show the passing result.
3. REFACTOR — improve names or structure only while the tests remain green. Do not add unrelated abstractions or features.

After all cycles:
- Run the relevant full suite and project checks.
- Cross-check every acceptance criterion against a test or an explicit verification step.
- Report cycles completed, behaviors covered, commands/results, and anything intentionally left untested with the reason.

Never modify a test merely to make an incorrect implementation pass. If the specification conflicts with existing behavior, stop and describe the conflict before choosing a side.

Adapt it to your task

Combined and condensed from the red, green, and refactor agents in GitHub Awesome Copilot.

Third-party prompt. Source review does not establish benchmark performance or guarantee an outcome.

Source and license

Contributor: @aaronpowell. Repository: github/awesome-copilot.

License: MIT. Pinned commit: b95e24caae4f25c5985f8527fd092ccfed039c36.

Review: source-reviewed, . Compared with the commit-pinned source and adapted into a tool-neutral, copy/paste request. This is a non-visual task, so no output artifact is required.

How Refyne turns a rough coding request into a brief