Transform feature plans into test-driven implementation using Outside-In methodology...
Transform feature plans β test-driven implementation using Outside-In methodology.
Invoke when:
docs/plan/YYYY/MM/ to code.claude/skills/test-levels for Unit/Integration/E2E guidancedocs/plan/YYYY/MM/YYYY_MM_DD_HHmm__FEATURE_NAME.md| Skill | Location | Phase |
|---|---|---|
doc-navigator |
.claude/skills/doc-navigator |
Load/Design - find existing patterns |
uiux-toolkit |
.claude/skills/uiux-toolkit |
Verify - 9-domain UX evaluation |
test-levels |
.claude/skills/test-levels |
Plan/Execute - test distribution |
SYSTEM DESIGN β INTEGRATION TESTS (Red) β TDD UNITS β E2E VALIDATION
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. SYSTEM DESIGN β
β Components β Contracts β Dependencies β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β 2. INTEGRATION TESTS (Red) β
β Validate component contracts - tests FAIL β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β 3. TDD UNIT PHASE β
β Red β Green β Refactor per unit β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β 4. E2E VALIDATION β
β Complete user journey verification β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
Input: docs/plan/YYYY/MM/YYYY_MM_DD_HHmm__FEATURE_NAME.md
Extract:
Expected structure:
# Feature: [Name]
## User Story
As a [user], I want to [action] so that [benefit].
## Acceptance Criteria
- [ ] Criterion 1
- [ ] Criterion 2
## Components
- Component A: Description
- Component B: Description
## Data Flow
1. Step 1
2. Step 2
For each component boundary:
interface [Component]Contract {
input: {
type: string;
validation: string[];
source: string; // sender component
};
output: {
type: string;
successCase: string;
errorCases: string[];
};
dependencies: string[];
}
// tests/e2e/[feature].spec.ts
describe('[Feature] - User Journey', () => {
test('User can [action] successfully', async () => {
// Arrange β Act β Assert
});
test('User sees error when [condition]', async () => {
// Error path from user perspective
});
});
// tests/integration/[component].test.ts
describe('[ComponentA] β [ComponentB]', () => {
test('Contract: [description]', async () => {
// Validates the "arrow" in system design
});
test('Handles timeout gracefully', async () => {
// Test architectural assumptions
});
});
// tests/unit/[module].test.ts
describe('[Module]', () => {
test('returns [expected] when [condition]', () => {
// Red β Green β Refactor
});
test('throws [error] when [invalid input]', () => {
// Edge cases
});
});
1. Scaffold Create files & empty interfaces
β
2. E2E (Red) Failing E2E for user journey
β
3. Integration For each boundary:
(Red) - Failing integration test
- Validates contract
β
4. TDD Cycle For each unit:
(RedβGreenβ - Failing unit test
Refactor) - Min code to pass
- Refactor for clarity
β
5. Integration Run integration (should pass)
(Green)
β
6. E2E (Green) Run E2E (should pass)
β
7. Refactor Clean up, optimize
System design arrow becomes mock:
βββββββββββββββ βββββββββββββββ
β OrderServiceβββββΆβInventorySvcβ
βββββββββββββββ βββββββββββββββ
const mockInventoryService = {
checkStock: jest.fn(),
};
describe('OrderService', () => {
test('throws OutOfStockException when inventory = 0', () => {
mockInventoryService.checkStock.mockReturnValue(0);
expect(() => orderService.placeOrder(item))
.toThrow(OutOfStockException);
});
});
Key insight: TDD validates architectural contracts:
| Pain Signal | Design Issue | Fix |
|---|---|---|
| 50+ lines mock setup | Too coupled | Split into smaller services |
| Needs real DB | Missing abstraction | Add repository interface |
| Can't test isolated | Circular deps | Restructure dependency graph |
| Brittle tests | Leaky abstractions | Strengthen contracts |
When pain detected:
Generate in /docs/features/[feature]/:
DESIGN.md - System design docCONTRACTS.md - Interface contractsTEST-PLAN.md - Test structure & orderIMPLEMENTATION.md - Build plan w/ tasks# Load & parse plan
/load-plan [plan-path]
# Extract components
/extract-components [plan-path]
# Generate contracts
/define-contracts [plan-path]
# Generate test scaffolds
/generate-tests [plan-path]
# Start TDD w/ first red test
/tdd-start [plan-path]
# List plans
/list-plans
/list-plans --month 2024-03
| Level | Question | Location |
|---|---|---|
| Unit | "Does this fn work?" | tests/unit/ |
| Integration | "Do parts connect?" | tests/integration/ |
| E2E | "Does flow work?" | tests/e2e/ |
Pyramid: Many unit β Some integration β Few E2E