بنقرة واحدة
tdd
Used when user wants to build features or fix bugs using TDD or red-green-refactor loop.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Used when user wants to build features or fix bugs using TDD or red-green-refactor loop.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when writing or modifying ZSH functions.
Use when user says "ralph <dir>" or "ralph this". Implements the highest-priority issue from state.json in the given directory using TDD, updates docs, runs review in a subagent, fixes actionable feedback, then stops for user to commit. Argument is the directory containing state.json and GUIDANCE.md.
Use when user says "sidequest". Compact conversation context into a document for a fresh agent to pick up.
Use when writing or modifying JavaScript code. Apply when adding functions, fixing bugs, or implementing features.
Use when writing or modifying Python code. Apply when adding functions, fixing bugs, or implementing features.
Use when creating or updating skills.
| name | tdd |
| description | Used when user wants to build features or fix bugs using TDD or red-green-refactor loop. |
Build features and fix bugs using the red-green-refactor loop: write a failing test first, write minimal code to pass it, then refactor.
Use Behavioral tests for behavioral testing, and Scaffolding tests for structural architecture.
Apply the London School of TDD for mocking. Each unit is tested in isolation by mocking its immediate collaborators.
Goal: Agree on interface, behaviors to test, and test strategy before writing any code.
Exit criterion: User has approved the plan and test strategy is declared (scaffold/behavioral and what to mock).
When exploring the codebase, use the project's domain glossary so that test names and interface vocabulary match the project's language.
Apply the pivot question for each test:
"If I rewrote the internals from scratch while keeping the same public API, would this test still pass?"
Ask yourself "What should the public interface look like? Which behaviors are most important to test?"
You can't test everything. Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.
Goal: Prove the test infrastructure works with one failing test and one minimal implementation.
Exit criterion: One test is RED, then GREEN — the path works end-to-end.
Write ONE test that confirms ONE thing about the system:
RED: Write test for first behavior → test fails
GREEN: Write minimal code to pass → test passes
This is your tracer bullet — proves the path works end-to-end.
DO NOT write all tests first, then all implementation. This is "horizontal slicing" — treating RED as "write all tests" and GREEN as "write all code."
This produces crap tests:
Correct approach: Vertical slices via tracer bullets. One test → one implementation → repeat.
WRONG (horizontal):
RED: test1, test2, test3, test4, test5
GREEN: impl1, impl2, impl3, impl4, impl5
RIGHT (vertical):
RED→GREEN: test1→impl1
RED→GREEN: test2→impl2
RED→GREEN: test3→impl3
...
Goal: Cover all planned behaviors one test at a time.
Exit criterion: All planned behaviors have a passing test, no speculative features added.
For each remaining behavior:
RED: Write next test → fails
GREEN: Minimal code to pass → passes
Rules:
zsh-writer, js-writer, etc.) if it existsGoal: Improve the design without changing behavior.
Exit criterion: No duplication, clean names, all tests still green.
After all tests pass, look for refactor candidates:
Never refactor while RED. Get to GREEN first.
| Rationalization | Reality |
|---|---|
| "Private methods shouldn't be tested directly" | private controls API visibility, not testability. Complex logic deserves a test regardless of exposure. |
| "Mocking internal collaborators couples tests to implementation" | Mocking immediate collaborators is isolation, not coupling. Coupling is reaching inside your collaborator. |
| "Testing at the public interface is always enough" | No. Complex private helpers should also be tested. |
| "I'll write the test after to go faster" | Tests-after prove nothing. Delete the code. Start with RED. |
| "I should write all tests first, then implement" | That's horizontal slicing. It produces tests of imagined behavior. Do vertical tracer bullets instead. |
zsh-writer, js-writer, etc)