xiaohongshu
xiaohongshu
derive
Derive BDD scenarios and TDD test skeletons from approved SDD specifications. ATDD acceptance test tables are optional output for specialized needs. Use when: spec is approved, starting BDD/TDD implementation, generating test structures. Keywords: forward derivation, spec to test, BDD generation,...
Full skill instructions
Language: English | 繁體中文
Version: 2.0.0 Last Updated: 2026-01-25 Applicability: Claude Code Skills
Core Standard: This skill implements Forward Derivation Standards. For comprehensive methodology documentation accessible by any AI tool, refer to the core standard.
This skill guides you through deriving BDD scenarios and TDD test skeletons from approved SDD specifications, with strict adherence to Anti-Hallucination standards.
Note: ATDD test tables are optional and available via
/derive-atdd. BDD scenarios already serve as executable acceptance tests, making ATDD tables redundant for most use cases.
Forward Derivation is the symmetrical counterpart to Reverse Engineering:
┌─────────────────────────────────────────────────────────────────┐
│ Forward Derivation Workflow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ 1️⃣ SPEC Parsing (AI Automated) │
│ ├─ Read approved specification │
│ ├─ Extract Acceptance Criteria (GWT or bullet) │
│ └─ Validate SPEC structure and completeness │
│ │
│ 2️⃣ Derivation (AI Automated) │
│ ├─ AC → BDD Gherkin scenarios │
│ ├─ AC → TDD test skeletons with TODOs │
│ └─ (Optional) AC → ATDD acceptance test tables │
│ │
│ 3️⃣ Human Review (Required) │
│ ├─ Verify generated scenarios match AC intent │
│ ├─ Fill in [TODO] sections │
│ └─ Refine step definitions if needed │
│ │
└─────────────────────────────────────────────────────────────────┘
| Command | Input | Output | Purpose |
|---|---|---|---|
/derive-bdd | SPEC-XXX.md | .feature | AC → Gherkin scenarios |
/derive-tdd | SPEC-XXX.md | .test.ts | AC → Test skeletons |
/derive-all | SPEC-XXX.md | .feature + .test.ts | Full derivation pipeline |
/derive-atdd | SPEC-XXX.md | acceptance.md | AC → Acceptance test tables (optional) |
CRITICAL: Only derive content that exists in the specification. Never add scenarios, tests, or features beyond what the Acceptance Criteria explicitly define.
# Anti-Hallucination Rule
Input: SPEC with N Acceptance Criteria
Output: Exactly N scenarios (BDD)
Exactly N test groups (TDD)
Exactly N acceptance tests (ATDD, if requested)
If output count ≠ input count → VIOLATION
Every generated item MUST include traceability:
# Generated from: specs/SPEC-001.md
# AC: AC-1
@SPEC-001 @AC-1
Scenario: User login with valid credentials
This skill uses Derivation Tags for generating new content from specifications. See Anti-Hallucination Standards for the complete tag reference.
| Tag | Use When | Example |
|---|---|---|
[Source] | Direct content from SPEC | Feature title, AC text |
[Derived] | Transformed from SPEC content | GWT from bullet AC |
[Generated] | AI-generated structure | Test skeleton |
[TODO] | Requires human implementation | Assertions, step definitions |
Input: Approved specification file Output: Structured Acceptance Criteria list
Actions:
Validation Checklist:
Input: Parsed Acceptance Criteria Output: Gherkin .feature file
Transformation Rules:
| AC Format | Transformation |
|---|---|
| Given-When-Then | Direct mapping to Gherkin |
| Bullet points | Convert using GWT pattern matching |
| Checklist | Convert conditions → Given, actions → When, outcomes → Then |
Example:
# Input AC (Bullet)
- [ ] User can login with email and password
- [ ] Login shows error for invalid credentials
# Output BDD
@SPEC-001 @AC-1
Scenario: User login with email and password
Given a user with valid credentials
When the user submits login form
Then the user is logged in successfully
@SPEC-001 @AC-2
Scenario: Login shows error for invalid credentials
Given a user with invalid credentials
When the user submits login form
Then an error message is displayed
Input: Parsed Acceptance Criteria Output: Test skeleton file
Actions:
Parameters:
| Parameter | Options | Default |
|---|---|---|
--lang | typescript, javascript, python, java, go | typescript |
--framework | vitest, jest, pytest, junit, go-test | vitest |
Note: ATDD test tables are optional. BDD scenarios already serve as executable acceptance tests. Use ATDD tables only when:
- Manual testing workflows are required
- Stakeholders prefer tabular test documentation
- Regulatory compliance requires specific test evidence format
Input: Parsed Acceptance Criteria Output: Acceptance test table document
Actions:
Input: Generated files Output: Reviewed and refined files
Review Checklist:
# Generated from: specs/SPEC-001.md
# Generator: /derive-bdd v1.0.0
# Generated at: 2026-01-19T10:00:00Z
@SPEC-001
Feature: User Authentication
[Source] From SPEC-001 Summary
@AC-1 @happy-path
Scenario: User login with valid credentials
# [Source] From SPEC-001 AC-1
Given a registered user with valid credentials
When the user submits login form
Then the user is redirected to dashboard
@AC-2 @error-handling
Scenario: Login fails with invalid credentials
# [Source] From SPEC-001 AC-2
Given a user with invalid credentials
When the user submits login form
Then an error message is displayed
/**
* Tests for SPEC-001: User Authentication
* Generated from: specs/SPEC-001.md
* Generated at: 2026-01-19T10:00:00Z
* AC Coverage: AC-1, AC-2
*/
describe('SPEC-001: User Authentication', () => {
describe('AC-1: User login with valid credentials', () => {
it('should redirect to dashboard on successful login', async () => {
// Arrange
// [TODO] Set up registered user with valid credentials
// Act
// [TODO] Submit login form
// Assert
// [TODO] Verify redirect to dashboard
expect(true).toBe(true); // Placeholder
});
});
describe('AC-2: Login fails with invalid credentials', () => {
it('should display error message', async () => {
// Arrange
// [TODO] Set up user with invalid credentials
// Act
// [TODO] Submit login form
// Assert
// [TODO] Verify error message is displayed
expect(true).toBe(true); // Placeholder
});
});
});
Generated via
/derive-atddwhen ATDD test tables are needed.
# SPEC-001 Acceptance Tests
**Specification**: SPEC-001
**Generated**: 2026-01-19
**Status**: Pending
## AT-001: User login with valid credentials
**Source**: AC-1
| Step | Action | Expected | Pass/Fail |
|------|--------|----------|-----------|
| 1 | Navigate to login page | Login form displayed | [ ] |
| 2 | Enter valid credentials | Fields accept input | [ ] |
| 3 | Click Login | Form submitted | [ ] |
| 4 | Verify redirect | Dashboard displayed | [ ] |
**Tester**: _______________
**Date**: _______________
**Result**: [ ] Pass / [ ] Fail
/spec workflow/derive-all to generate test structures/derive-bdd/bdd/derive-tddForward Derivation fits in the Integrated Flow methodology:
spec-review (approved) → forward-derivation → discovery (BDD)
│
├─→ .feature files for BDD
└─→ .test.ts skeletons for TDD
Optional: /derive-atdd → acceptance.md for manual testing
┌─────────────────────────────────────────────────────────────────────────┐
│ Complete Forward Derivation Pipeline │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ Approved SPEC │
│ │ │
│ ▼ │
│ /derive-all specs/SPEC-XXX.md │
│ │ │
│ ├─→ /derive-bdd │
│ │ └─→ features/SPEC-XXX.feature │
│ │ │
│ └─→ /derive-tdd │
│ └─→ tests/SPEC-XXX.test.ts │
│ │
│ Optional: /derive-atdd specs/SPEC-XXX.md │
│ └─→ acceptance/SPEC-XXX-acceptance.md │
│ │
│ Human Review │
│ │ │
│ ├─→ Verify 1:1 AC mapping │
│ ├─→ Fill [TODO] sections │
│ └─→ Refine step definitions │
│ │
└─────────────────────────────────────────────────────────────────────────┘
# Generate BDD scenarios
/derive-bdd specs/SPEC-001.md
# Generate TDD skeleton with Python/pytest
/derive-tdd specs/SPEC-001.md --lang python --framework pytest
# Generate all test structures
/derive-all specs/SPEC-001.md
# Preview without creating files
/derive-all specs/SPEC-001.md --dry-run
# Specify output directory
/derive-all specs/SPEC-001.md --output-dir ./generated
Adding Extra Scenarios
Deriving from Draft SPEC
/derive-all on unapproved specSkipping Source Attribution
Over-Specifying Technical Details
Given database connection is established using PostgreSQL driverGiven user data exists in the systemTreating Skeletons as Complete
This skill auto-detects project configuration:
specs/ directory structure| Version | Date | Changes |
|---|---|---|
| 2.0.0 | 2026-01-25 | ATDD changed from required to optional output; /derive-all now outputs BDD + TDD only |
| 1.1.0 | 2026-01-25 | Added: Reference to Unified Tag System |
| 1.0.0 | 2026-01-19 | Initial release |
This skill is released under CC BY 4.0.
Source: universal-dev-standards
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience