Test-Driven Development (TDD) workflow for ultrawork tasks with approach: "tdd". Enforces RED-GREEN-REFACTOR cycle with gate hooks and evidence requirements. Required knowledge for worker agents implementing TDD tasks.
Enforces TDD workflow with evidence tracking and gate hooks for RED-GREEN-REFACTOR cycle.
npx claudepluginhub mnthe/hardworker-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Test-Driven Development (TDD) workflow for tasks marked with approach: "tdd".
CRITICAL: TDD tasks MUST follow this exact sequence. Gate hooks will block out-of-order operations.
During TDD phases (RED/GREEN/REFACTOR):
During VERIFICATION phase:
npm test without scope)Why scoped execution?
When task has test_scope field, use it for scoped execution:
# Read test_scope from task
TEST_SCOPE=$(bun "{SCRIPTS_PATH}/task-get.js" --session ${CLAUDE_SESSION_ID} --id {TASK_ID} --field test_scope)
# Run scoped test
npm test -- {test_scope}
Example task.json:
{
"id": "3",
"subject": "Add input validation",
"approach": "tdd",
"test_scope": "tests/validation.test.ts"
}
If test_scope is not set, use the test file path you created.
# Record test creation
bun "{SCRIPTS_PATH}/task-update.js" --session ${CLAUDE_SESSION_ID} --id {TASK_ID} \
--add-evidence "TDD-RED: Created test file tests/validateUser.test.ts"
# Run SCOPED test - MUST FAIL
npm test -- tests/validateUser.test.ts
# Record failure (expected)
bun "{SCRIPTS_PATH}/task-update.js" --session ${CLAUDE_SESSION_ID} --id {TASK_ID} \
--add-evidence "TDD-RED: npm test -- tests/validateUser.test.ts (exit code 1)"
Evidence Required:
# Record implementation
bun "{SCRIPTS_PATH}/task-update.js" --session ${CLAUDE_SESSION_ID} --id {TASK_ID} \
--add-evidence "TDD-GREEN: Implemented src/validateUser.ts"
# Run SCOPED test - MUST PASS
npm test -- tests/validateUser.test.ts
# Record success
bun "{SCRIPTS_PATH}/task-update.js" --session ${CLAUDE_SESSION_ID} --id {TASK_ID} \
--add-evidence "TDD-GREEN: npm test -- tests/validateUser.test.ts (exit code 0)"
Evidence Required:
# Run SCOPED test after refactoring
npm test -- tests/validateUser.test.ts
# Record refactoring
bun "{SCRIPTS_PATH}/task-update.js" --session ${CLAUDE_SESSION_ID} --id {TASK_ID} \
--add-evidence "TDD-REFACTOR: Renamed variables, npm test -- tests/validateUser.test.ts (exit code 0)"
A complete TDD task MUST have this evidence sequence:
1. TDD-RED: Test file created
2. TDD-RED: Scoped test execution failed (exit code 1, includes test scope)
3. TDD-GREEN: Implementation created
4. TDD-GREEN: Scoped test execution passed (exit code 0, includes test scope)
5. (Optional) TDD-REFACTOR: Improvements made, scoped tests still pass
Evidence format MUST include:
npm test -- tests/feature.test.ts)Verification will FAIL if:
The gate-enforcement.js hook blocks out-of-order TDD operations:
During EXECUTION phase (TDD tasks only):
*.test.*, *.spec.*, __tests__/*)Detection Logic:
approach: "tdd"Error Message:
TDD gate: Cannot write implementation before RED phase
Required evidence: "TDD-RED: Test fails as expected (exit code 1)"
Current file: src/validateUser.ts (non-test file)
After all phases complete:
bun "{SCRIPTS_PATH}/task-update.js" --session ${CLAUDE_SESSION_ID} --id {TASK_ID} \
--status resolved \
--add-evidence "TDD complete: RED→GREEN→REFACTOR cycle finished"
| Phase | Action | Evidence Prefix | Exit Code |
|---|---|---|---|
| RED | Write test, verify failure | TDD-RED: ... | 1 (fail) |
| GREEN | Write minimal impl, verify pass | TDD-GREEN: ... | 0 (pass) |
| REFACTOR | Improve code, tests still pass | TDD-REFACTOR: ... | 0 (pass) |
{
"evidence": [
"TDD-RED: Created test file tests/auth.test.ts",
"TDD-RED: npm test -- tests/auth.test.ts (exit code 1)",
"TDD-GREEN: Implemented src/auth.ts",
"TDD-GREEN: npm test -- tests/auth.test.ts (exit code 0)",
"TDD-REFACTOR: Extracted helper, npm test -- tests/auth.test.ts (exit code 0)"
]
}
Note: Full test suite (npm test without scope) is run only during VERIFICATION phase by the verifier agent.
Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.