一键导入
speckit-05-testify
Generate test specifications from requirements before implementation (TDD support)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate test specifications from requirements before implementation (TDD support)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create feature specification from natural language description
Identify underspecified areas and ask targeted clarification questions
Create technical implementation plan from feature specification
Generate domain-specific quality checklists for requirements validation
Generate actionable task breakdown from plan and specification
Validate cross-artifact consistency between spec, plan, and tasks
| name | speckit-05-testify |
| description | Generate test specifications from requirements before implementation (TDD support) |
Generate test specifications from requirement artifacts before implementation begins. This skill enables Test-Driven Development (TDD) by creating test specs that serve as acceptance criteria for the implementation phase.
$ARGUMENTS
This skill accepts no user input parameters - it reads artifacts automatically (FR-013).
Before ANY action, load and analyze the project constitution for TDD requirements:
Read constitution:
cat .specify/memory/constitution.md 2>/dev/null || echo "NO_CONSTITUTION"
If file doesn't exist:
ERROR: Project constitution not found at .specify/memory/constitution.md
Cannot proceed without constitution.
Run: /speckit-00-constitution
TDD Assessment - Analyze constitution for TDD indicators:
Strong indicators (high confidence):
Moderate indicators (medium confidence):
Implicit indicators (low confidence):
Prohibition indicators:
No indicators:
Output TDD Assessment:
╭─────────────────────────────────────────────────────╮
│ TDD ASSESSMENT │
├─────────────────────────────────────────────────────┤
│ Determination: [mandatory | optional | forbidden] │
│ Confidence: [high | medium | low] │
│ Evidence: "[quoted constitutional text]" │
│ Reasoning: [explanation] │
╰─────────────────────────────────────────────────────╯
If determination is "forbidden":
ERROR: Constitution prohibits test-first development.
Evidence: "[quoted text]"
Testify cannot proceed. The constitution explicitly requires test-after
or prohibits TDD practices.
Run prerequisites check:
.tessl/tiles/tessl-labs/spec-kit/skills/speckit-01-specify/scripts/bash/check-prerequisites.sh --json
Parse JSON for FEATURE_DIR and AVAILABLE_DOCS.
Verify required artifacts exist:
If plan.md missing:
ERROR: plan.md not found in feature directory.
Testify requires a completed plan.
Run: /speckit-03-plan
If spec.md missing:
ERROR: spec.md not found in feature directory.
Testify requires a completed specification.
Run: /speckit-01-specify
Before generating tests, validate that spec.md has acceptance scenarios:
Search spec.md for acceptance scenario patterns:
If NO acceptance scenarios found:
ERROR: spec.md has no acceptance scenarios.
Test specifications require acceptance scenarios to derive tests from.
Run: /speckit-02-clarify to add acceptance scenarios to the specification.
Read from FEATURE_DIR:
spec.md (acceptance scenarios, functional requirements)plan.md (API contracts, technical decisions)data-model.md (entity constraints, validation rules)Create FEATURE_DIR/tests/test-specs.md with the following structure:
For each acceptance scenario in spec.md:
spec.md:[User Story]:[scenario number]acceptanceExample transformation:
Input (from spec.md):
### User Story 1 - Login (Priority: P1)
**Acceptance Scenarios**:
1. **Given** a registered user, **When** they enter valid credentials, **Then** they are logged in.
Output (in test-specs.md):
### TS-001: Login with valid credentials
**Source**: spec.md:User Story 1:scenario-1
**Type**: acceptance
**Priority**: P1
**Given**: a registered user
**When**: they enter valid credentials
**Then**: they are logged in
**Traceability**: FR-001, US-001-scenario-1
For each API endpoint or interface defined in plan.md:
contractplan.md:[section]:[endpoint]For each entity with validation rules in data-model.md:
validationdata-model.md:[entity]:[constraint]Include clear markers in the generated test-specs.md:
<!--
DO NOT MODIFY TEST ASSERTIONS
These test specifications define the expected behavior derived from requirements.
During implementation:
- Fix code to pass tests, don't modify test assertions
- Structural changes (file organization, naming) are acceptable with justification
- Logic changes to assertions require explicit justification and re-review
If requirements change, re-run /speckit-05-testify to regenerate test specs.
-->
If tests/test-specs.md already exists:
Output semantic diff:
╭─────────────────────────────────────────────────────╮
│ TEST SPEC UPDATE │
├─────────────────────────────────────────────────────┤
│ Preserved: X tests (unchanged requirements) │
│ Added: Y tests (new requirements) │
│ Removed: Z tests (requirements removed) │
╰─────────────────────────────────────────────────────╯
Create the tests directory if it doesn't exist:
mkdir -p FEATURE_DIR/tests
CRITICAL: After writing test-specs.md, store a hash of the assertion content to prevent tampering.
Store hash in BOTH locations for defense in depth:
Unix/macOS/Linux:
# Store in context.json (primary)
.tessl/tiles/tessl-labs/spec-kit/skills/speckit-01-specify/scripts/bash/testify-tdd.sh store-hash "FEATURE_DIR/tests/test-specs.md" ".specify/context.json"
# Store as git note (tamper-resistant backup)
.tessl/tiles/tessl-labs/spec-kit/skills/speckit-01-specify/scripts/bash/testify-tdd.sh store-git-note "FEATURE_DIR/tests/test-specs.md"
Windows (PowerShell):
# Store in context.json (primary)
pwsh .tessl/tiles/tessl-labs/spec-kit/skills/speckit-01-specify/scripts/powershell/testify-tdd.ps1 store-hash "FEATURE_DIR/tests/test-specs.md" ".specify/context.json"
# Store as git note (tamper-resistant backup)
pwsh .tessl/tiles/tessl-labs/spec-kit/skills/speckit-01-specify/scripts/powershell/testify-tdd.ps1 store-git-note "FEATURE_DIR/tests/test-specs.md"
This stores a SHA256 hash of all Given/When/Then assertion lines in two locations:
The implement skill will verify this hash before proceeding, blocking execution if assertions were tampered with.
Output a clear report showing what was generated:
╭─────────────────────────────────────────────────────╮
│ TESTIFY COMPLETE │
├─────────────────────────────────────────────────────┤
│ TDD Assessment: [mandatory | optional] │
│ │
│ Test Specifications Generated: │
│ From spec.md: X acceptance tests │
│ From plan.md: Y contract tests │
│ From data-model.md: Z validation tests │
│ ───────────────────────────────── │
│ Total: N test specifications │
│ │
│ Output: FEATURE_DIR/tests/test-specs.md │
│ │
│ Assertion Integrity: │
│ Hash: [first 12 chars of hash]... │
│ Status: LOCKED │
╰─────────────────────────────────────────────────────╯
Note: The assertion hash ensures test integrity. If test-specs.md assertions are modified without re-running testify, the implement skill will detect the tampering and refuse to proceed.
The generated tests/test-specs.md follows this template:
# Test Specifications: [Feature Name]
**Generated**: [timestamp]
**Feature**: [spec.md](./spec.md) | **Plan**: [plan.md](./plan.md)
## TDD Assessment
**Determination**: [mandatory | optional | forbidden]
**Confidence**: [high | medium | low]
**Evidence**: [quoted constitutional statements or "No TDD indicators found"]
**Reasoning**: [explanation of determination]
---
<!--
DO NOT MODIFY TEST ASSERTIONS
[full marker text]
-->
## From spec.md (Acceptance Tests)
### TS-001: [Test Name]
[test spec content]
---
## From plan.md (Contract Tests)
### TS-XXX: [Test Name]
[test spec content]
---
## From data-model.md (Validation Tests)
### TS-XXX: [Test Name]
[test spec content]
---
## Summary
| Source | Count | Types |
|--------|-------|-------|
| spec.md | X | acceptance |
| plan.md | Y | contract |
| data-model.md | Z | validation |
| **Total** | **N** | |
| Condition | Detection | Response |
|---|---|---|
| No constitution | File not found | ERROR with "Run /speckit-00-constitution" |
| TDD forbidden | Prohibition indicators found | ERROR with quoted evidence |
| No plan.md | File not found | ERROR with "Run /speckit-03-plan" |
| No spec.md | File not found | ERROR with "Run /speckit-01-specify" |
| No acceptance scenarios | Pattern not found in spec.md | ERROR with "Run /speckit-02-clarify" |
After generating test specifications:
/speckit-06-tasks to generate tasks that reference the test specs/speckit-07-analyze to validate cross-artifact consistencySuggest to user:
Test specifications generated! Next steps:
- /speckit-06-tasks - Generate task breakdown (tasks can now reference test specs)
- /speckit-07-analyze - (Optional) Validate consistency
Note: When TDD is mandatory, /speckit-08-implement will verify test specs exist before proceeding.