$npx -y skills add wrtnlabs/autobe --skill add-featureImplement new feature with self-testing loop until 100% pass
| 1 | # Add Feature |
| 2 | |
| 3 | Implement a new feature and iterate until all tests pass (100% success rate). |
| 4 | |
| 5 | ## FORBIDDEN |
| 6 | |
| 7 | **NEVER use:** |
| 8 | - `as` keyword (type assertion) |
| 9 | - `any` type |
| 10 | |
| 11 | --- |
| 12 | |
| 13 | ## Feature Description |
| 14 | |
| 15 | $ARGUMENTS |
| 16 | |
| 17 | --- |
| 18 | |
| 19 | ## Workflow Overview |
| 20 | |
| 21 | ``` |
| 22 | ┌─────────────────────────────────────┐ |
| 23 | │ Phase 1: Implementation │ |
| 24 | │ - Controller │ |
| 25 | │ - Provider │ |
| 26 | │ - Collector/Transformer │ |
| 27 | │ - Interface │ |
| 28 | └───────────────┬─────────────────────┘ |
| 29 | │ |
| 30 | ▼ |
| 31 | ┌─────────────────────────────────────┐ |
| 32 | │ Phase 2: Test Design │ |
| 33 | │ - Happy path tests │ |
| 34 | │ - Error case tests │ |
| 35 | │ - Edge case tests │ |
| 36 | └───────────────┬─────────────────────┘ |
| 37 | │ |
| 38 | ▼ |
| 39 | ┌─────────────────────────────────────┐ |
| 40 | │ Phase 3: Test Loop │ |
| 41 | │ while (pass_rate < 100%) { │ |
| 42 | │ run tests │ |
| 43 | │ analyze failures │ |
| 44 | │ fix code │ |
| 45 | │ } │ |
| 46 | └───────────────┬─────────────────────┘ |
| 47 | │ |
| 48 | ▼ |
| 49 | ┌─────────────────────────────────────┐ |
| 50 | │ Complete │ |
| 51 | │ All tests pass! │ |
| 52 | └─────────────────────────────────────┘ |
| 53 | ``` |
| 54 | |
| 55 | --- |
| 56 | |
| 57 | ## Phase 1: Implementation |
| 58 | |
| 59 | See: `flow-implement.md` |
| 60 | |
| 61 | 1. **Analyze Requirements** |
| 62 | - Understand the feature from `$ARGUMENTS` |
| 63 | - Identify affected entities |
| 64 | - Determine API endpoints needed |
| 65 | |
| 66 | 2. **Create/Update Interface** |
| 67 | - Define DTOs (ICreate, IUpdate, ISummary, IRequest) |
| 68 | - Add typia tags for validation |
| 69 | |
| 70 | 3. **Create/Update Collector** |
| 71 | - Transform ICreate → Prisma.CreateInput |
| 72 | |
| 73 | 4. **Create/Update Transformer** |
| 74 | - Transform Prisma record → Interface |
| 75 | |
| 76 | 5. **Create/Update Provider** |
| 77 | - Implement business logic |
| 78 | - Use Collector for create operations |
| 79 | - Use Transformer for responses |
| 80 | |
| 81 | 6. **Create/Update Controller** |
| 82 | - Define routes with TypedRoute |
| 83 | - Add authentication decorators |
| 84 | - Connect to Provider |
| 85 | |
| 86 | 7. **Verify Build** |
| 87 | ```bash |
| 88 | npm run build:main |
| 89 | ``` |
| 90 | |
| 91 | --- |
| 92 | |
| 93 | ## Phase 2: Test Design |
| 94 | |
| 95 | See: `flow-test-design.md` |
| 96 | |
| 97 | Design comprehensive test scenarios including: |
| 98 | |
| 99 | ### Happy Path (Normal Cases) |
| 100 | - ✅ Create entity successfully |
| 101 | - ✅ Read entity successfully |
| 102 | - ✅ Update entity successfully |
| 103 | - ✅ Delete entity successfully |
| 104 | - ✅ List entities with pagination |
| 105 | |
| 106 | ### Error Cases |
| 107 | - ❌ Create with missing required fields |
| 108 | - ❌ Create with invalid field format |
| 109 | - ❌ Read non-existent entity (404) |
| 110 | - ❌ Update non-existent entity (404) |
| 111 | - ❌ Delete non-existent entity (404) |
| 112 | - ❌ Unauthorized access (401) |
| 113 | - ❌ Forbidden action (403) |
| 114 | |
| 115 | ### Edge Cases |
| 116 | - ⚠️ Empty string input |
| 117 | - ⚠️ Null values for optional fields |
| 118 | - ⚠️ Maximum length strings |
| 119 | - ⚠️ Minimum/maximum numeric values |
| 120 | - ⚠️ Special characters in strings |
| 121 | - ⚠️ Duplicate creation attempt |
| 122 | - ⚠️ Concurrent modification |
| 123 | - ⚠️ Parent entity doesn't exist |
| 124 | - ⚠️ Circular reference attempt |
| 125 | - ⚠️ Soft-deleted entity access |
| 126 | |
| 127 | --- |
| 128 | |
| 129 | ## Phase 3: Test Loop |
| 130 | |
| 131 | See: `flow-test-loop.md` |
| 132 | |
| 133 | ``` |
| 134 | REPEAT: |
| 135 | 1. Build tests |
| 136 | npm run build:test |
| 137 | |
| 138 | 2. Run tests |
| 139 | npm run test -- --include "{feature}" |
| 140 | |
| 141 | 3. If all pass → DONE |
| 142 | |
| 143 | 4. If failures: |
| 144 | a. Analyze failure reason |
| 145 | b. Determine if test code issue or business logic issue |
| 146 | c. Fix the appropriate code |
| 147 | d. Go to step 1 |
| 148 | |
| 149 | UNTIL: 100% pass rate |
| 150 | ``` |
| 151 | |
| 152 | --- |
| 153 | |
| 154 | ## Exit Conditions |
| 155 | |
| 156 | ✅ **Success Criteria:** |
| 157 | - `npm run build:main` passes |
| 158 | - `npm run build:test` passes |
| 159 | - `npm run test` passes with 100% success rate |
| 160 | - All happy path tests pass |
| 161 | - All error case tests pass |
| 162 | - All edge case tests pass |
| 163 | |
| 164 | ❌ **Failure (requires manual intervention):** |
| 165 | - Circular dependency detected |
| 166 | - External service unavailable |
| 167 | - Database schema change required |
| 168 | - Requirements ambiguity |
| 169 | |
| 170 | --- |
| 171 | |
| 172 | ## Output |
| 173 | |
| 174 | When complete, provide: |
| 175 | |
| 176 | ```markdown |
| 177 | ## Feature Implementation Complete |
| 178 | |
| 179 | ### Summary |
| 180 | - Feature: {description} |
| 181 | - Files created/modified: X |
| 182 | - Test scenarios: Y |
| 183 | - Pass rate: 100% |
| 184 | |
| 185 | ### Files Changed |
| 186 | - src/api/structures/I{Entity}.ts |
| 187 | - src/controllers/{path}/{Controller}.ts |
| 188 | - src/providers/{provider}.ts |
| 189 | - src/collectors/{Collector}.ts |
| 190 | - src/transformers/{Transformer}.ts |
| 191 | - test/prepare/prepare_random_{entity}.ts |
| 192 | - test/generate/generate_random_{entity}.ts |
| 193 | - test/features/api/{entity}/*.ts |
| 194 | |
| 195 | ### Test Results |
| 196 | - Total: X tests |
| 197 | - Passed: X |
| 198 | - Failed: 0 |
| 199 | ``` |