Agent Skills
› kinncj/Heimdall
› tdd-workflow
tdd-workflow
GitHub遵循红绿重构TDD循环,先写失败测试再实现最小代码,最后重构。支持ATDD模式及Docker集成测试容器生命周期管理,强制测试前置、禁止弱断言和过度Mock,确保开发质量与回归安全。
Trigger Scenarios
实现新功能
编写单元测试或E2E测试
执行代码重构
Install
npx skills add kinncj/Heimdall --skill tdd-workflow -g -y
SKILL.md
Frontmatter
{
"name": "tdd-workflow",
"description": "Drive development with a red-green-refactor TDD cycle, ensuring tests are written before implementation. Use when implementing any new functionality."
}
SKILL: TDD Workflow
The RED → GREEN → REFACTOR Cycle
RED Phase (QA Agent)
- Read the acceptance criterion or task description.
- Write a test that will fail because the implementation doesn't exist.
- Run the test. It MUST fail with a meaningful error (not a syntax error).
- If the test passes immediately → the test is wrong. Rewrite it.
- Report: file path, test name, failure message.
GREEN Phase (Specialist Agent)
- Read the failing test file at the provided path.
- Implement the MINIMUM code to make ONLY that test pass.
- Do not implement anything not required by the test.
- Run the test. It must pass.
- Run the full unit suite to verify no regressions.
- If the test fails after 3 attempts → escalate to Orchestrator.
REFACTOR Phase (Specialist Agent)
- Look for: duplication, poor naming, long functions, complex conditionals.
- Clean up without changing behavior.
- Run the test again. It must still pass.
- Commit:
git commit -m "refactor: {what was cleaned up}"
ATDD Pattern (Acceptance Test-Driven Development)
- Write the E2E/acceptance test from the acceptance criterion (Given/When/Then).
- Watch it fail (RED).
- Drive out unit tests and implementation to make it pass (GREEN).
- Acceptance test goes green last.
Integration Test Container Lifecycle
# Before integration tests
docker compose -f docker-compose.test.yml up -d --wait
# Run integration tests
make test-integration
# After tests
docker compose -f docker-compose.test.yml down -v
Rules
- Test file is created BEFORE implementation file.
- Test name format: "should {expected outcome} when {condition}".
- Never weaken an assertion to make a test pass.
- Never mock what you can test with a real dependency (use containers).
- Implementation agent receives FILE PATH, not requirement text.
- Gate: test must fail before implementation, pass after.
Version History
- f4ea31f Current 2026-07-05 10:41


