|
| 1 | +--- |
| 2 | +name: feature-pipeline |
| 3 | +description: Complete pipeline for adding new features (design → implement → test → review) |
| 4 | +argument-hint: "<feature-description>" |
| 5 | +level: 4 |
| 6 | +triggers: |
| 7 | + - "add feature" |
| 8 | + - "new feature" |
| 9 | + - "implement feature" |
| 10 | +pipeline: [api-designer, test-writer, code-reviewer] |
| 11 | +--- |
| 12 | + |
| 13 | +# Feature Pipeline Skill |
| 14 | + |
| 15 | +Complete end-to-end workflow for adding new features to Android Image Cropper. |
| 16 | + |
| 17 | +## Pipeline Stages |
| 18 | + |
| 19 | +### Stage 1: API Design (api-designer agent) |
| 20 | +**Goal**: Design the public API before implementation |
| 21 | + |
| 22 | +1. Analyze feature requirements |
| 23 | +2. Design API following Kotlin best practices |
| 24 | +3. Evaluate ≥2 alternatives with trade-offs |
| 25 | +4. Document API contract with KDoc |
| 26 | +5. Create usage examples |
| 27 | +6. Output: API design document with rationale |
| 28 | + |
| 29 | +**Success Gate**: Design reviewed and approved |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +### Stage 2: Implementation (manual or executor) |
| 34 | +**Goal**: Implement the designed API |
| 35 | + |
| 36 | +1. Read the API design document |
| 37 | +2. Implement in `cropper/` module |
| 38 | +3. Follow code style (2-space indent, trailing commas) |
| 39 | +4. Update `CropImageOptions` if adding configuration |
| 40 | +5. Add to sample app for demonstration |
| 41 | +6. Update CHANGELOG.md under "In development" |
| 42 | + |
| 43 | +**Success Gate**: Implementation matches design spec |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +### Stage 3: Test Writing (test-writer agent) |
| 48 | +**Goal**: Comprehensive test coverage with minimal mocking |
| 49 | + |
| 50 | +1. Write public API contract tests |
| 51 | +2. Write behavior verification tests |
| 52 | +3. Write edge case tests |
| 53 | +4. Test on multiple SDK versions (21, 28, 34) |
| 54 | +5. Ensure ≥80% coverage on public APIs |
| 55 | +6. Use real code, not mocks |
| 56 | + |
| 57 | +**Success Gate**: All tests pass, coverage ≥80% |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +### Stage 4: Code Review (code-reviewer agent) |
| 62 | +**Goal**: Quality gate before merge |
| 63 | + |
| 64 | +1. Review code quality and style |
| 65 | +2. Check API compatibility (no breaking changes) |
| 66 | +3. Verify test coverage |
| 67 | +4. Check security (URI validation, input validation) |
| 68 | +5. Verify documentation (CHANGELOG, README if needed) |
| 69 | +6. Identify trade-offs and risks |
| 70 | + |
| 71 | +**Success Gate**: Review APPROVE or issues resolved |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +### Stage 5: Final Verification |
| 76 | +**Goal**: Everything passes before merge |
| 77 | + |
| 78 | +**Commands to run**: |
| 79 | +```bash |
| 80 | +# Format code |
| 81 | +./gradlew ktlintFormat |
| 82 | + |
| 83 | +# Run all checks |
| 84 | +./gradlew licensee ktlint testDebug build --stacktrace |
| 85 | + |
| 86 | +# Test sample app |
| 87 | +./gradlew :sample:installDebug |
| 88 | +``` |
| 89 | + |
| 90 | +**Checklist**: |
| 91 | +- [ ] ktlint passes |
| 92 | +- [ ] All tests pass |
| 93 | +- [ ] Sample app demonstrates feature |
| 94 | +- [ ] CHANGELOG.md updated |
| 95 | +- [ ] README.md updated (if user-facing) |
| 96 | +- [ ] No breaking API changes (or properly deprecated) |
| 97 | +- [ ] Code review approved |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## Usage Examples |
| 102 | + |
| 103 | +### Example 1: Simple Feature |
| 104 | +``` |
| 105 | +User: "Use the feature-pipeline skill to add a resetZoom() method" |
| 106 | +
|
| 107 | +Stage 1 (API Designer): |
| 108 | +- Designs API: fun resetZoom() |
| 109 | +- Provides alternatives: resetZoom() vs resetScale() |
| 110 | +- Documents behavior |
| 111 | +
|
| 112 | +Stage 2 (Implementation): |
| 113 | +- Adds method to CropImageView |
| 114 | +- Updates CHANGELOG.md |
| 115 | +
|
| 116 | +Stage 3 (Test Writer): |
| 117 | +- Writes API contract test |
| 118 | +- Writes behavior test |
| 119 | +- Tests on SDK 21, 28, 34 |
| 120 | +
|
| 121 | +Stage 4 (Code Reviewer): |
| 122 | +- Reviews implementation |
| 123 | +- Checks test coverage |
| 124 | +- Approves |
| 125 | +
|
| 126 | +Stage 5 (Verification): |
| 127 | +- Runs all checks |
| 128 | +- Tests sample app |
| 129 | +``` |
| 130 | + |
| 131 | +### Example 2: Complex Feature with Options |
| 132 | +``` |
| 133 | +User: "Use feature-pipeline to add custom crop shapes beyond rectangle and oval" |
| 134 | +
|
| 135 | +Stage 1 (API Designer): |
| 136 | +- Designs CropImageOptions extension |
| 137 | +- Evaluates Shape enum vs sealed class |
| 138 | +- Documents API with examples |
| 139 | +- Considers backward compatibility |
| 140 | +
|
| 141 | +Stage 2 (Implementation): |
| 142 | +- Extends CropImageOptions |
| 143 | +- Updates CropOverlayView rendering |
| 144 | +- Adds to sample app |
| 145 | +
|
| 146 | +Stage 3 (Test Writer): |
| 147 | +- API contract tests for new options |
| 148 | +- Rendering tests (snapshot tests) |
| 149 | +- Edge cases (custom paths) |
| 150 | +
|
| 151 | +Stage 4 (Code Reviewer): |
| 152 | +- Reviews complexity |
| 153 | +- Checks performance impact |
| 154 | +- Verifies tests |
| 155 | +
|
| 156 | +Stage 5 (Verification): |
| 157 | +- Full build passes |
| 158 | +- Sample app works |
| 159 | +- README.md updated |
| 160 | +``` |
| 161 | + |
| 162 | +--- |
| 163 | + |
| 164 | +## Pipeline Coordination |
| 165 | + |
| 166 | +### Agent Handoffs |
| 167 | + |
| 168 | +**API Designer → Implementation**: |
| 169 | +- Handoff: API design document |
| 170 | +- Implementation reads design spec |
| 171 | +- Implementation must match designed API contract |
| 172 | + |
| 173 | +**Implementation → Test Writer**: |
| 174 | +- Handoff: Implemented code |
| 175 | +- Test writer verifies all public methods |
| 176 | +- Test writer creates contract tests |
| 177 | + |
| 178 | +**Test Writer → Code Reviewer**: |
| 179 | +- Handoff: Code + tests |
| 180 | +- Reviewer checks coverage |
| 181 | +- Reviewer verifies test quality |
| 182 | + |
| 183 | +### State Management |
| 184 | + |
| 185 | +Track progress through pipeline: |
| 186 | +1. **Design Complete**: API design document exists |
| 187 | +2. **Implementation Complete**: Code written, CHANGELOG updated |
| 188 | +3. **Tests Complete**: Tests written, coverage ≥80% |
| 189 | +4. **Review Complete**: Code review approved |
| 190 | +5. **Verified**: All checks pass, ready to merge |
| 191 | + |
| 192 | +### Failure Handling |
| 193 | + |
| 194 | +**If API design rejected**: |
| 195 | +- Revise design |
| 196 | +- Re-evaluate alternatives |
| 197 | +- Get stakeholder input |
| 198 | + |
| 199 | +**If implementation doesn't match design**: |
| 200 | +- Fix implementation to match spec |
| 201 | +- Or revise design if requirements changed |
| 202 | + |
| 203 | +**If tests fail**: |
| 204 | +- Fix implementation bugs |
| 205 | +- Or fix incorrect tests |
| 206 | + |
| 207 | +**If code review finds issues**: |
| 208 | +- Address CRITICAL and HIGH severity |
| 209 | +- Consider MEDIUM suggestions |
| 210 | +- Document trade-off decisions |
| 211 | + |
| 212 | +--- |
| 213 | + |
| 214 | +## Integration with Workflows |
| 215 | + |
| 216 | +### Adding to Common Workflows (README) |
| 217 | + |
| 218 | +```markdown |
| 219 | +#### Adding a New Feature |
| 220 | +1. 🎯 Use **feature-pipeline** skill (orchestrates entire workflow) |
| 221 | + OR manually: |
| 222 | + 1. 🎨 Use **API Designer** to design the API |
| 223 | + 2. Implement the feature |
| 224 | + 3. 🧪 Use **Test Writer** to add comprehensive tests |
| 225 | + 4. ✅ Use **Run Tests** to verify |
| 226 | + 5. 🎨 Use **Check Code Style** to format |
| 227 | + 6. 📝 Use **Update CHANGELOG** to document |
| 228 | + 7. 🔍 Use **Code Reviewer** before submitting PR |
| 229 | +``` |
| 230 | + |
| 231 | +--- |
| 232 | + |
| 233 | +## Best Practices |
| 234 | + |
| 235 | +### 1. Design First |
| 236 | +Never skip API design stage. Bad APIs are hard to change in a published library. |
| 237 | + |
| 238 | +### 2. Test During Development |
| 239 | +Don't wait until the end to write tests. Test-driven development catches issues early. |
| 240 | + |
| 241 | +### 3. Incremental Reviews |
| 242 | +Review code as you go, not all at once at the end. |
| 243 | + |
| 244 | +### 4. Documentation Discipline |
| 245 | +Update CHANGELOG.md immediately when implementation is done. Update README.md for user-facing features. |
| 246 | + |
| 247 | +### 5. Sample App Demonstration |
| 248 | +Always add feature to sample app. It's the best documentation and manual test. |
| 249 | + |
| 250 | +### 6. Backward Compatibility |
| 251 | +This is a published library serving thousands of apps. Breaking changes require deprecation cycle. |
| 252 | + |
| 253 | +--- |
| 254 | + |
| 255 | +## Anti-Patterns to Avoid |
| 256 | + |
| 257 | +### ❌ Implementing Before Designing |
| 258 | +``` |
| 259 | +BAD: "I'll just code it and see how it looks" |
| 260 | +GOOD: "Let me design the API first, evaluate alternatives" |
| 261 | +``` |
| 262 | + |
| 263 | +### ❌ Skipping Tests |
| 264 | +``` |
| 265 | +BAD: "I'll add tests later" |
| 266 | +GOOD: "Tests are part of the feature, not optional" |
| 267 | +``` |
| 268 | + |
| 269 | +### ❌ Self-Approval |
| 270 | +``` |
| 271 | +BAD: Same agent/person designs, implements, and approves |
| 272 | +GOOD: Separate design, implementation, and review roles |
| 273 | +``` |
| 274 | + |
| 275 | +### ❌ Weak Test Coverage |
| 276 | +``` |
| 277 | +BAD: One happy-path test with mocks |
| 278 | +GOOD: Contract tests, behavior tests, edge cases with real code |
| 279 | +``` |
| 280 | + |
| 281 | +--- |
| 282 | + |
| 283 | +*Complete pipeline ensures quality and consistency across all features.* |
0 commit comments