chanwit/tdg
Overview
This skill implements Test-Driven Generation (TDG) workflows that drive development in Red-Green-Refactor loops. It detects keywords like tdg or TDG to activate and enforces traceable commit messages and safe helper-script execution. The skill coordinates test discovery, coverage baseline recording, test-driven coding steps, and strict commit practices.
How this skill works
The skill first ensures a project TDG manifest exists and reads it to determine testing framework, build and test commands, and coverage steps. It inspects branch names and the user message to find an issue reference, prompts for one if missing, and stores it for all commits. For phase control it verifies a helper script checksum (sha256) before executing the phase probe and then follows the appropriate RED, GREEN, or REFACTOR workflow steps.
When to use it
- When you want to drive development strictly by tests using TDD cycles.
- When you need traceable commits tied to issue numbers for auditing.
- When introducing or expanding unit test coverage in a repo.
- When you want step-by-step guidance enforcing red/green/refactor discipline.
- When you must ensure helper scripts are executed only after integrity checks.
Best practices
- Always identify or create an issue number before committing; include it in every commit message.
- Run test coverage and record the baseline before making changes in unknown or refactor phases.
- Follow small incremental work: one test case at a time, skip remaining cases until ready.
- Verify helper script integrity via sha256sum and do not execute if the digest differs.
- Commit only the files you edited and prefix messages with red:, green:, or refactor:.
Example use cases
- Add a new function using TDG: draft spec, write a failing unit test (red), implement code (green), then refactor.
- Increase coverage on a legacy module: run coverage baseline, create focused tests, then refactor safely.
- Fix a bug: associate work with an issue, write a regression test first, then implement the fix.
- Onboarding: teach team members disciplined commit messages and TDD loops enforced by the skill.
- Automated safety: prevent accidental execution of helper scripts by validating sha256sum before running.
FAQ
The skill will prompt you to provide one. If you don't have one, it can help draft a precise issue and use CLI tools to create it before committing.
What happens if the helper script checksum doesn't match?
The script must not be executed. The workflow will skip running it and notify you to verify or replace the script to ensure integrity.