원클릭으로
tdd-guidelines
Strict Test-Driven Development workflow rules, anti-patterns, and the Red-Green-Refactor cycle.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Strict Test-Driven Development workflow rules, anti-patterns, and the Red-Green-Refactor cycle.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Companion skill for the /open workflow. Automates workspace diagnostic steps when starting a new session on a project. Collects active session status, project contracts, active task metrics, compact memory presence, roadmap phases, pending brainstorms, and git status.
Sidecar data for /brainstorm workflow — Brainstorm (open), Decision (finalized), and Research document templates loaded just-in-time.
Sidecar data for /docs workflow — document templates loaded just-in-time when generating docs.
Modular HTML rendering engine for PARA Workspace. Converts Markdown documents, code graphs, and standalone files into interactive, self-contained HTML pages with consistent Notion-inspired theming. Triggers when the user asks to compile docs to HTML, render graph visualization, export markdown to HTML, view docs statically, or preview documents.
Sidecar data for /plan workflow — Detail Plan and Roadmap templates loaded just-in-time.
Sidecar data for /qa workflow — Red Team personas, dimension checklists, and QA report templates loaded just-in-time.
| name | TDD Guidelines |
| description | Strict Test-Driven Development workflow rules, anti-patterns, and the Red-Green-Refactor cycle. |
| source | user |
Context: This skill governs execution-time behavior for AI Agents when writing code. It prevents hallucinations, bloated code, and missing test coverage by enforcing strict TDD principles.
Load this reference when: The user requests TDD, the active plan specifies strict TDD/testing, you are writing tests, or you are refactoring existing code.
⛔ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST.
This rule is absolute. If you are instructed to implement a feature, you MUST write the test first, observe it fail, and only then write the production code. If you find yourself writing production code without a corresponding failing test, STOP. Delete the code. Write the test.
Do not attempt to write 500 lines of code at once. Break the work into 5-minute bite-sized cycles:
Write a test for the exact behavior you are about to implement.
⛔ FALSE RED GUARD: A valid RED state means the test fails because the logic is missing (e.g., Assertion Error: Expected A but got B, or TypeError: function is not defined). If the test fails due to a Syntax Error or Missing Import in the test file itself, you MUST fix the test structure before proceeding. It is NOT a valid RED if the test code is simply broken.
⛔ NO WATCH MODE: When executing tests in the terminal, Agent MUST use one-shot execution commands (e.g.,
CI=true npm testornpm run test:run) and MUST NOT use watch mode (--watch). Watch mode will block the terminal process and break the workflow.
destroy(), resetState()) just to make the test teardown easier.When acting as an implementing Agent, you MUST:
GREEN phase.test:, feat:, refactor:).If you are executing tasks from a TDD Plan (e.g., generated via detail-plan-tdd.md), you MUST strictly tick the [ ] checkboxes in the Plan file as you progress through the RED, GREEN, and REFACTOR cycles. Do not mark a task as completely Done until all its TDD cycle checkboxes are ticked and the corresponding code is committed. This guarantees the Walkthrough Completion Gate can be audited.
When executing a TDD Plan, Agent MUST use the evidence logger script instead of running test commands directly. This creates an on-disk audit trail that survives conversation truncation.
The script path .agents/skills/tdd/scripts/tdd-test.sh is relative to the workspace root (directory containing .para-workspace.yml). Since Agent typically runs commands from Projects/<name>/repo/, the relative path varies depending on depth.
Agent MUST resolve the script path before invocation:
.para-workspace.yml (usually 3 levels up from repo/).<workspace-root>/.agents/skills/tdd/scripts/tdd-test.shExamples by Cwd:
# Cwd = workspace root (/)
bash .agents/skills/tdd/scripts/tdd-test.sh npm test --run test/foo.test.ts
# Cwd = Projects/<name>/repo/ (most common during plan execution)
bash ../../../.agents/skills/tdd/scripts/tdd-test.sh npm test --run test/foo.test.ts
# Cwd = Projects/<name>/ (project root)
bash ../../.agents/skills/tdd/scripts/tdd-test.sh npm test --run test/foo.test.ts
Cross-platform notes:
⛔ SCRIPT NOT FOUND GUARD: If
tdd-test.shreturns exit code 127 (command not found), Agent MUST:
- Re-read this skill to verify the correct path
- Try resolving from workspace root (find
.agents/directory)- STOP and report if still not found — DO NOT fall back to raw test commands
Running tests without the evidence logger is a TDD compliance violation (Anti-Pattern: "Skipped evidence logger").
The script:
artifacts/tests/tdd-evidence.log.Before committing, Agent MUST read artifacts/tests/tdd-evidence.log and verify:
status: FAIL entry exists for the test file before the status: PASS entry.| Event | Action |
|---|---|
| Plan starts | Script creates artifacts/tests/tdd-evidence.log on first run |
| During plan | Evidence entries accumulate (append-only) |
Session ends (/end) | Agent runs Quarantine hook to move artifacts/tests/* to tmp/ and appends .bak. This prevents sandbox trash buildup while preserving audit trails. |
| Plan done (Status → ✅ Done) | Agent renames to artifacts/tests/tdd-evidence-<version>.log (e.g., tdd-evidence-v0.13.2.log) |
| Next plan starts | Fresh artifacts/tests/tdd-evidence.log created automatically |
.gitignore | artifacts/tests/ should be ignored |
| Resource | Relative Path | Description |
|---|---|---|
| TDD Evidence Logger | scripts/tdd-test.sh | Bash wrapper that logs test FAIL/PASS to artifacts/tests/tdd-evidence.log for TDD Gate verification |
| Transcript Telemetry Parser | scripts/parse-transcript.py | Python script to parse Antigravity session transcript locally for tool counts, commands, and mutated files |
When executing TDD Drift Verification & Cleanup or auditing session telemetry, run this script to parse conversation transcripts locally without context bloat:
python3 .agents/skills/tdd/scripts/parse-transcript.py [path_to_transcript_or_directory]
To protect the active workspace from configuration pollution (junk files) and avoid committing ad-hoc test scripts to the open-source templates repository, Agent MUST follow the Isolated TDD Protocol:
para install or raw install.sh).artifacts/tests/tmp/sandbox/).repo/ repository.artifacts/tests/tmp/ folder.test-tmp-[YYYY-MM-DD]-[topic].sh.
test-tmp-[YYYY-MM-DD]-[topic]-[index].sh (e.g., test-tmp-2026-05-29-sync-01.sh)..gitignore to prevent polluting the OSS template repository.git status --ignored --porcelain or a file structure log) and save it to artifacts/tests/tdd-repo-before-[date].log. This serves as the Ground Truth Before.
tdd-repo-before-[date]-[index].log (e.g., tdd-repo-before-2026-05-29-01.log).To implement this protocol, a TDD-hardened plan MUST include the following tasks:
Phase 0 (Start Snapshot):
- [ ] 0.X 🤖 **TDD Repo Before Snapshot** (run `git status --ignored --porcelain` & `git log -n 1 --oneline` and save to `artifacts/tests/tdd-repo-before-[date].log`)
At the end of intermediate phases (Phase 1, Phase 2, Phase 3...):
- [ ] X.Y 🤖 **Compare Git Drift** (compare current repo state with `artifacts/tests/tdd-repo-before-[date].log` to identify newly generated untracked/ignored files in this phase)
Pre-commit Gate (before Git Commit task):
- [ ] X.N 🤖 **Compare Git Drift (Pre-commit)** (compare final changes against snapshot before commit to prevent committing junk)
Walkthrough (Final Post-Release Audit):
- [ ] **TDD Drift Verification & Cleanup:** Compare current repo state with `artifacts/tests/tdd-repo-before-[date].log` and completely clean up any junk files generated during local TDD/testing before completion.