Test-Driven Development skill for the ikigai project
TDD methodology for development phase. Focus on testing what you build.
Core principle: Write tests for the code you write.
Follow Red/Green/Verify cycle:
return OK(NULL);)check-unit --file=PATH - Test must passcheck-filesize --file=PATH - File size under 16KBcheck-complexity --file=PATH - Function complexity under thresholdTest what you build. During development:
Coverage gaps are OK during development. They will be closed in a dedicated coverage phase before release.
The test should come first - but don't let perfect coverage slow down feature development.
If writing a helper function, ask: "Does a passing test call this right now?" If no, DELETE IT.
ABSOLUTE RULE: NEVER WRITE CODE BEFORE YOU HAVE A TEST THAT NEEDS IT.
When closing coverage gaps, the verify step adds:
check-coverage — 90% coverage is MANDATORYHunt every branch:
tcase_add_test_raise_signal with SIGABRT)LCOV_EXCL markers when genuinely untestable (OOM, impossible states)If a branch is uncovered, ask: "Can I write a test for this?" If yes, WRITE IT.