tdd-strict
Test-Driven Development (Strict) skill for the ikigai project
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Test-Driven Development (Strict)
Description
Strict TDD methodology for coverage phase. 90% coverage is non-negotiable.
Details
ABSOLUTE RULE: NEVER WRITE CODE BEFORE YOU HAVE A TEST THAT NEEDS IT
Follow strict Red/Green/Verify cycle:
1. Red: Write a failing test first
- Write the test code that calls the new function
- Add function declaration to header file
- Add stub implementation that compiles but does nothing (e.g.,
return OK(NULL);) - IMPORTANT: A compilation error is NOT a failing test - you need a stub that compiles and runs
- Verify the test actually fails with assertion failures (e.g., wrong output)
- NO CODE exists until a test demands it
2. Green: Write minimal code to make the test pass
- Implement ONLY what the test requires
- STOP immediately when the test passes
- DO NOT write "helper functions" before they're called
- DO NOT write code "because you'll need it later"
- DO NOT refactor for complexity until
make lintactually fails
3. Verify: Run quality checks
-
make check- All tests must pass -
make lint- Code complexity under threshold -
make check-coverage- 90% coverage is MANDATORY
Coverage Phase Requirements
Hunt every branch. During coverage phase:
- Test all error paths (use mocks to trigger failures)
- Test assertion violations (
tcase_add_test_raise_signalwith SIGABRT) - Test edge cases (empty, null, boundary conditions)
- Only use
LCOV_EXCLmarkers when genuinely untestable (OOM, impossible states)
WARNING: Writing code before tests wastes tokens, time, and money by:
- Generating premature code
- Debugging unnecessary coverage gaps
- Reverting unused code
- Violating the core methodology
The test MUST come first. No exceptions.
If writing a helper function, ask: "Does a passing test call this right now?" If no, DELETE IT.
If a branch is uncovered, ask: "Can I write a test for this?" If yes, WRITE IT.
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!