|
| 1 | +--- |
| 2 | +description: Optimize rule changes for maximum AI execution accuracy |
| 3 | +--- |
| 4 | + |
| 5 | +Change request: $ARGUMENTS |
| 6 | + |
| 7 | +**THINK DEEPLY AND SYSTEMATICALLY** Extract the TRUE INTENT behind user's change request and implement with MAXIMUM PRECISION to eliminate ALL ambiguity: |
| 8 | + |
| 9 | +## 9 Optimization Perspectives |
| 10 | +1. Context efficiency vs execution accuracy - Maximum accuracy with minimal description |
| 11 | +2. Deduplication - Consistency within and across rule files |
| 12 | +3. Proper responsibility aggregation - Group related content (minimize read operations) |
| 13 | +4. Clear decision criteria - Measurable standards |
| 14 | +5. Transform negatives to recommendations - Recommended format (background: including NG examples) |
| 15 | +6. Consistent notation - Unified expressions |
| 16 | +7. Explicit prerequisites - Make implicit assumptions visible |
| 17 | +8. Optimized description order - Most important first, exceptions last |
| 18 | +9. Clear scope boundaries - What's covered vs what's not |
| 19 | + |
| 20 | +## Execution Flow |
| 21 | + |
| 22 | +### 1. Understand the Request |
| 23 | + |
| 24 | +Question template when unspecified: |
| 25 | +``` |
| 26 | +1. Which rule file to modify? |
| 27 | + e.g.: typescript.md / ai-development-guide.md / documentation-criteria.md |
| 28 | +
|
| 29 | +2. Select change type: |
| 30 | + a) Add new rule (add new criteria) |
| 31 | + b) Modify existing rule (clarify ambiguous descriptions) |
| 32 | + c) Delete rule (remove obsolete criteria) |
| 33 | +
|
| 34 | +3. Specific changes: |
| 35 | + e.g.: "Add rule prohibiting 'any' type usage" |
| 36 | + e.g.: "Clarify error handling criteria" |
| 37 | + [User input] |
| 38 | +``` |
| 39 | + |
| 40 | +### 2. Create Design Proposal |
| 41 | + |
| 42 | +Target file identification and current state check: |
| 43 | + |
| 44 | +``` |
| 45 | +# Tool selection criteria (measurable decisions) |
| 46 | +if file path is explicitly provided: |
| 47 | + Read: Direct file read (background: Skip Glob to save context) |
| 48 | +else if partial filename known: |
| 49 | + Glob: docs/rules/*{keyword}*.md search |
| 50 | + Read: Check identified file's current state |
| 51 | +else: |
| 52 | + Glob: docs/rules/*.md for full scan (background: comprehensive search when unclear) |
| 53 | + Confirm target file selection with user |
| 54 | +``` |
| 55 | + |
| 56 | +Design template: |
| 57 | +``` |
| 58 | +【Current】 |
| 59 | +"Handle errors appropriately" (ambiguous: "appropriately" undefined) |
| 60 | +
|
| 61 | +【Understanding User Request】 |
| 62 | +"Want stricter error handling" → Set measurable criteria |
| 63 | +
|
| 64 | +【Proposal】 |
| 65 | +"Error handling implementation criteria: |
| 66 | +1. try-catch required for: |
| 67 | + - External API calls (fetch, axios, etc.) |
| 68 | + - File I/O operations (fs.readFile, etc.) |
| 69 | + - Parsing operations (JSON.parse, parseInt, etc.) |
| 70 | +2. Required error log items: |
| 71 | + - error.name (error type) |
| 72 | + - error.stack (location) |
| 73 | + - Timestamp (ISO 8601 format) |
| 74 | +3. User notification criteria: |
| 75 | + - No technical details (NG: stack trace display) |
| 76 | + - Clear action items (recommended: "Please try again")" |
| 77 | +
|
| 78 | +Proceed with this design? (y/n) |
| 79 | +``` |
| 80 | + |
| 81 | +### 3. Three-Pass Review Process |
| 82 | + |
| 83 | +#### Pass 1: Add for Maximum Accuracy【Addition-Only Mode】 |
| 84 | +**MANDATORY DECLARATION**: "Pass 1: Addition mode execution. Deletions are STRICTLY PROHIBITED." |
| 85 | +**REQUIRED ACTIONS**: |
| 86 | +- CONVERT all ambiguous expressions → measurable criteria |
| 87 | + Example: "large" → "100+ lines" "5+ files" |
| 88 | +- MAKE all implicit prerequisites explicit |
| 89 | + Example: "In TypeScript environment" "Within async functions" |
| 90 | +- DEFINE all exceptions and edge cases |
| 91 | + Example: "When null/undefined" "For empty arrays" |
| 92 | +**MANDATORY REPORT**: Count added items (MINIMUM 5 items required) |
| 93 | + |
| 94 | +#### Pass 2: Critical Modification to Reduce Redundancy【Actual Modification Mode】 |
| 95 | +**MANDATORY DECLARATION**: "Pass 2: Critical modification mode execution. ACTUALLY DELETE and CONSOLIDATE redundant parts." |
| 96 | + |
| 97 | +**REQUIRED MODIFICATION WORK**: |
| 98 | +1. CRITICALLY REVIEW all Pass 1 additions |
| 99 | +2. APPLY modifications using these EXACT criteria: |
| 100 | + - Duplicate concepts → MUST consolidate |
| 101 | + - Overly detailed explanations → MUST simplify |
| 102 | + - Overlap with other rules → MUST replace with references |
| 103 | +3. RECORD complete before/after diff (deletion reasons REQUIRED) |
| 104 | + |
| 105 | +Report format: |
| 106 | +``` |
| 107 | +Modified locations: X items |
| 108 | +Deleted/consolidated content: |
| 109 | +- [Before]: "Detailed description" |
| 110 | + [After]: "Concise description" |
| 111 | + [Reason]: Redundancy elimination |
| 112 | +``` |
| 113 | + |
| 114 | +#### Pass 3: Accuracy Assurance via Diff Evaluation【Restoration Decision Mode】 |
| 115 | +**MANDATORY DECLARATION**: "Pass 3: Diff evaluation mode execution. REVIEW all Pass 2 modifications and RESTORE if accuracy compromised." |
| 116 | + |
| 117 | +**REQUIRED VERIFICATION WORK**: |
| 118 | +1. EVALUATE EACH Pass 2 modification against these criteria: |
| 119 | + - Does deletion create implementation ambiguity? YES = RESTORE |
| 120 | + - Are ALL edge cases still covered? NO = RESTORE |
| 121 | +2. Action mapping: |
| 122 | + - Deletions with accuracy risks → MUST restore |
| 123 | + - Valid deletions → KEEP |
| 124 | + |
| 125 | +**MANDATORY FINAL CONFIRMATION** (MUST answer explicitly): |
| 126 | +"Are necessary and sufficient conditions present for accurate implementation of user requirements? YES/NO with justification" |
| 127 | + |
| 128 | +**MANDATORY REPORT**: Number of restored items AND final reduction percentage |
| 129 | + |
| 130 | +### 4. Get Approval |
| 131 | + |
| 132 | +Present before/after comparison for user approval. |
| 133 | + |
| 134 | +### 5. Implementation |
| 135 | + |
| 136 | +1. Apply changes with appropriate tool (after user approval) |
| 137 | +2. Final verification with git diff |
| 138 | +3. Suggest `/sync-rules` execution |
| 139 | + |
| 140 | +## Decision Criteria Checklist |
| 141 | +- [ ] Expressible in "if-then" format ("if X then Y") |
| 142 | +- [ ] Measurable by numbers/counts/states (eliminate subjective judgment) |
| 143 | +- [ ] Related content aggregated in single file (minimize read operations) |
| 144 | +- [ ] Relationships with other rules specified (dependencies/references/delegation) |
| 145 | +- [ ] NG examples included as background information |
| 146 | +- [ ] All prerequisites explicitly stated |
| 147 | + |
| 148 | +## Reduction Pattern Examples |
| 149 | +| Pattern | Before | After | |
| 150 | +|---------|--------|-------| |
| 151 | +| Emotional expressions | "must always" | "execute when (background: build error if skipped)" | |
| 152 | +| Time expressions | "immediately" | "execute first after error detection" | |
| 153 | +| Implicit prerequisites | "implement error handling" | "TypeScript async function error handling" | |
| 154 | +| Unclear order | "consider: A, B, C" | "Priority: 1.A (required), 2.B (recommended), 3.C (optional)" | |
| 155 | +| Redundant explanation | "ensure type safety by defining types, checking types, and preventing type errors" | "type safety (define・check・prevent errors)" | |
| 156 | +| Ambiguous scope | "write tests" | "write unit tests (see test-guide for E2E tests)" | |
| 157 | + |
| 158 | +## Output Example |
| 159 | + |
| 160 | +``` |
| 161 | +=== Change Implementation Complete === |
| 162 | +
|
| 163 | +【User Request】 |
| 164 | +"Strengthen TypeScript error handling rules" |
| 165 | +
|
| 166 | +【Changes】 |
| 167 | +Target: docs/rules/typescript.md |
| 168 | +Section: ## Error Handling |
| 169 | +
|
| 170 | +Before: |
| 171 | +"Handle errors appropriately" |
| 172 | +
|
| 173 | +After (3-pass review complete): |
| 174 | +"Error handling implementation criteria: |
| 175 | +1. try-catch block required for: |
| 176 | + - External API calls (fetch, axios, etc.) |
| 177 | + - File I/O operations (fs.readFile, fs.writeFile, etc.) |
| 178 | + - Exception-prone operations (JSON.parse, parseInt, etc.) |
| 179 | +2. Required error log items: |
| 180 | + - error.name (error type) |
| 181 | + - error.stack (location) |
| 182 | + - new Date().toISOString() (timestamp) |
| 183 | +3. User-facing messages: |
| 184 | + - No technical details (NG: stack trace display) |
| 185 | + - Clear action items (recommended: "Please try again")" |
| 186 | +
|
| 187 | +【Improvement Metrics】 |
| 188 | +- Decision clarity: 0% → 100% (all measurable) |
| 189 | +- Ambiguous expressions: 1 → 0 |
| 190 | +- NG examples included as background |
| 191 | +
|
| 192 | +Run /sync-rules for metadata synchronization. |
| 193 | +``` |
| 194 | + |
| 195 | +## Execution Order |
| 196 | +1. Understand user request |
| 197 | +2. Analyze current state |
| 198 | +3. Design changes with 9 perspectives |
| 199 | +4. 3-pass review process |
| 200 | +5. User approval |
| 201 | +6. Apply changes |
| 202 | +7. Suggest sync-rules |
| 203 | + |
| 204 | +**Scope**: Understanding user change requests and implementing with maximum accuracy |
| 205 | + |
| 206 | +## Error Handling |
| 207 | +- **File not found**: Display available rule list |
| 208 | +- **Large change detected**: Suggest phased implementation for 50%+ changes |
0 commit comments