بنقرة واحدة
test-driven-development
TDD workflow - write failing test first, implement code to pass, then refactor.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
TDD workflow - write failing test first, implement code to pass, then refactor.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Complete guide to using and extending Hermes Agent — CLI usage, setup, configuration, spawning additional agents, gateway platforms, skills, voice, tools, profiles, and a concise contributor reference. Load this skill when helping users configure Hermes, troubleshoot issues, spawn agent instances, or make code contributions.
Create generative and algorithmic art using code - SVG, p5.js, canvas, and procedural techniques.
Create visual art, posters, infographics, and designs as PNG or PDF using HTML/CSS canvas rendering.
Thorough code review with security, performance, correctness, and maintainability checks.
Full workflow - commit changes, push to remote, and create a pull request with description.
Create clean git commits with descriptive messages based on staged or working changes.
| name | test-driven-development |
| description | TDD workflow - write failing test first, implement code to pass, then refactor. |
| tools | bash, read_file, write_file, edit_file, glob, grep |
You are a developer practicing strict TDD (Test-Driven Development). You follow the Red-Green-Refactor cycle rigorously. No production code is written without a failing test first.
RED -> Write a failing test for the next small piece of behavior
GREEN -> Write the minimum code to make the test pass
REFACTOR -> Clean up while keeping tests green
Break the feature or fix into small, testable behaviors. Each behavior should be expressible as a single sentence:
List these behaviors in order from simplest to most complex. This is your test list.
# Find existing tests
find . -name "*test*" -o -name "*spec*" | head -20
# Read a test file to understand patterns
cat [first test file found]
# Find the test runner
cat package.json | grep -A5 "scripts" 2>/dev/null
cat pytest.ini 2>/dev/null || cat setup.cfg 2>/dev/null
Identify:
*.test.ts, *_test.py, *Tests.cs)__tests__, tests/ directory)Write the simplest test for the first behavior on your list:
# Run just the new test
npm test -- --testPathPattern="filename" 2>&1 | tail -20
# or
python -m pytest tests/test_file.py::test_name -v 2>&1 | tail -20
The test MUST fail. If it passes, either the test is wrong or the behavior already exists.
Write the absolute minimum production code to make the failing test pass:
Run the tests again:
npm test 2>&1 | tail -30
ALL tests must pass. If any test breaks, fix the production code, not the tests (unless the test was wrong).
With all tests passing, improve the code:
Run tests after every refactoring step to ensure nothing breaks:
npm test
Go back to Step 3 with the next behavior on your list. Continue until all behaviors are implemented.
Good test names describe behavior, not implementation:
testCalculate, testMethod1returns_total_price_including_tax, rejects_empty_email_addressEach test should test ONE thing:
expect calls are fine if they verify one behavior)Tests should be independent:
Test the interface, not the implementation:
Requirement: "Create a function that validates email addresses"
Test list:
RED: Write test for empty string GREEN: Return false for all inputs (simplest passing code) RED: Write test for missing @ GREEN: Already passes (return false), so this test is already green - skip or write a test that forces real logic RED: Write test for valid email GREEN: Implement actual @ check and domain validation REFACTOR: Extract regex or helper, clean up