|
| 1 | +# Generate Feature Specification & E2E Test Index |
| 2 | + |
| 3 | +You are a senior engineer tasked with generating a detailed technical specification |
| 4 | +for the **$ARGUMENTS** feature in this codebase. This spec will serve two purposes: |
| 5 | + |
| 6 | +1. Onboard Claude (or any engineer) instantly when $ARGUMENTS-related changes are needed |
| 7 | +2. Drive a comprehensive E2E test case suite |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Instructions — follow this sequence strictly |
| 12 | + |
| 13 | +### Step 1 — Locate the feature |
| 14 | + |
| 15 | +Search the codebase for all files related to the **$ARGUMENTS** feature: |
| 16 | + |
| 17 | +- Match by folder name, file name, component name, and route path |
| 18 | +- List every file found with its path and a one-line description |
| 19 | +- Confirm the feature boundary with me before proceeding |
| 20 | + |
| 21 | +Do not read file contents yet. Output the file list and wait for my approval. |
| 22 | + |
| 23 | +--- |
| 24 | + |
| 25 | +### Step 2 — Deep codebase audit (no writing yet) |
| 26 | + |
| 27 | +After approval, read every file in the $ARGUMENTS feature. For each file, extract: |
| 28 | + |
| 29 | +- Component name, responsibility, and line count |
| 30 | +- Props interface and their types |
| 31 | +- Internal state shape and what drives state changes |
| 32 | +- Events emitted / callbacks exposed |
| 33 | +- API calls made: endpoint, method, payload shape, response shape |
| 34 | +- Validation rules (field-level and form-level) |
| 35 | +- Error states and how they are surfaced to the user |
| 36 | +- Loading states and skeleton/fallback UI |
| 37 | +- User flows: what sequence of actions does this component enable |
| 38 | +- Dependencies on other features, shared components, or global state |
| 39 | + |
| 40 | +Output the audit summary and wait for my approval before writing any files. |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +### Step 3 — Generate the specification (after audit approval) |
| 45 | + |
| 46 | +Write a markdown file saved as `docs/specs/$ARGUMENTS-feature.md` with these sections: |
| 47 | + |
| 48 | +#### 1. Feature overview |
| 49 | + |
| 50 | +- Purpose and business context of the $ARGUMENTS feature |
| 51 | +- High-level user journey (start to finish) |
| 52 | +- Key actors and entry points |
| 53 | + |
| 54 | +#### 2. Architecture map |
| 55 | + |
| 56 | +- Module/folder structure with one-line description per file |
| 57 | +- Component hierarchy tree (parent → child relationships) |
| 58 | +- Data flow diagram in text form (what feeds what) |
| 59 | +- Shared dependencies (contexts, stores, hooks used across the feature) |
| 60 | + |
| 61 | +#### 3. Component specifications |
| 62 | + |
| 63 | +For every component, document: |
| 64 | + |
| 65 | +- Purpose (one sentence) |
| 66 | +- Props (name, type, required/optional, description) |
| 67 | +- Internal state (name, type, initial value, what triggers change) |
| 68 | +- User interactions (action → what happens) |
| 69 | +- Rendered output variants (default, loading, error, empty) |
| 70 | +- Edge cases and known constraints |
| 71 | + |
| 72 | +#### 4. API contract |
| 73 | + |
| 74 | +For every API call in the feature: |
| 75 | + |
| 76 | +- Endpoint and HTTP method |
| 77 | +- Request payload (field, type, required/optional) |
| 78 | +- Success response shape |
| 79 | +- Error response shape and codes |
| 80 | +- How errors are handled in the UI |
| 81 | +- Any polling, retry, or timeout logic |
| 82 | + |
| 83 | +#### 5. Validation rules |
| 84 | + |
| 85 | +- Every form field with its validation rules listed explicitly |
| 86 | +- Cross-field validation dependencies |
| 87 | +- When validation triggers (on blur, on submit, on change) |
| 88 | +- Error message copy for each rule |
| 89 | + |
| 90 | +#### 6. State and data flow |
| 91 | + |
| 92 | +- Global state slices used (Redux/Zustand/Context — whatever applies) |
| 93 | +- How state is initialized, mutated, and cleaned up |
| 94 | +- Any derived state or memoized selectors |
| 95 | +- State reset conditions (on cancel, on complete, on error) |
| 96 | + |
| 97 | +#### 7. User flows (for E2E test generation) |
| 98 | + |
| 99 | +Document every user flow as a numbered sequence: |
| 100 | + |
| 101 | +- Flow name |
| 102 | +- Preconditions |
| 103 | +- Step-by-step user actions |
| 104 | +- Expected system response at each step |
| 105 | +- Success condition |
| 106 | +- Failure conditions and fallback behavior |
| 107 | + |
| 108 | +Include flows for: |
| 109 | + |
| 110 | +- Happy path (full successful $ARGUMENTS flow) |
| 111 | +- Validation failures |
| 112 | +- API errors at each stage |
| 113 | +- Cancellation and resumption |
| 114 | +- Edge cases (empty states, single item, maximum items) |
| 115 | + |
| 116 | +#### 8. Known constraints and assumptions |
| 117 | + |
| 118 | +- Browser/environment requirements |
| 119 | +- Feature flags or conditional behavior |
| 120 | +- Performance considerations |
| 121 | +- Accessibility requirements |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +### Step 4 — E2E test case index |
| 126 | + |
| 127 | +After the spec is approved, generate a second file saved as |
| 128 | +`docs/specs/$ARGUMENTS-e2e-test-index.md` with: |
| 129 | + |
| 130 | +For every user flow in Section 7, produce a test case entry: |
| 131 | + |
| 132 | +- Test case ID (e.g. FEAT-001 where FEAT is a short uppercase prefix for $ARGUMENTS) |
| 133 | +- Test name |
| 134 | +- Preconditions |
| 135 | +- Test steps (numbered — action + expected result per step) |
| 136 | +- Pass criteria |
| 137 | +- Fail criteria |
| 138 | +- Priority (critical / high / medium / low) |
| 139 | +- Tags (happy-path, error-handling, validation, edge-case) |
| 140 | + |
| 141 | +Group test cases by category: |
| 142 | + |
| 143 | +- Smoke tests (must pass before any release) |
| 144 | +- Happy path tests |
| 145 | +- Validation tests |
| 146 | +- Error handling tests |
| 147 | +- Edge case tests |
| 148 | + |
| 149 | +--- |
| 150 | + |
| 151 | +## Output files |
| 152 | + |
| 153 | +- `docs/specs/$ARGUMENTS-feature.md` — full technical specification |
| 154 | +- `docs/specs/$ARGUMENTS-e2e-test-index.md` — E2E test case index |
| 155 | + |
| 156 | +Start with Step 1. List all files related to the $ARGUMENTS feature and wait |
| 157 | +for my approval before reading any file contents. |
0 commit comments