codex-workflows 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/.agents/skills/ai-development-guide/SKILL.md +283 -0
  2. package/.agents/skills/ai-development-guide/agents/openai.yaml +7 -0
  3. package/.agents/skills/ai-development-guide/references/frontend.md +135 -0
  4. package/.agents/skills/coding-rules/SKILL.md +98 -0
  5. package/.agents/skills/coding-rules/agents/openai.yaml +7 -0
  6. package/.agents/skills/coding-rules/references/typescript.md +220 -0
  7. package/.agents/skills/documentation-criteria/SKILL.md +127 -0
  8. package/.agents/skills/documentation-criteria/agents/openai.yaml +7 -0
  9. package/.agents/skills/documentation-criteria/references/adr-template.md +64 -0
  10. package/.agents/skills/documentation-criteria/references/design-template.md +327 -0
  11. package/.agents/skills/documentation-criteria/references/plan-template.md +131 -0
  12. package/.agents/skills/documentation-criteria/references/prd-template.md +119 -0
  13. package/.agents/skills/documentation-criteria/references/task-template.md +38 -0
  14. package/.agents/skills/documentation-criteria/references/ui-spec-template.md +145 -0
  15. package/.agents/skills/implementation-approach/SKILL.md +145 -0
  16. package/.agents/skills/implementation-approach/agents/openai.yaml +7 -0
  17. package/.agents/skills/integration-e2e-testing/SKILL.md +125 -0
  18. package/.agents/skills/integration-e2e-testing/agents/openai.yaml +7 -0
  19. package/.agents/skills/integration-e2e-testing/references/e2e-design.md +86 -0
  20. package/.agents/skills/recipe-add-integration-tests/SKILL.md +128 -0
  21. package/.agents/skills/recipe-add-integration-tests/agents/openai.yaml +7 -0
  22. package/.agents/skills/recipe-build/SKILL.md +119 -0
  23. package/.agents/skills/recipe-build/agents/openai.yaml +7 -0
  24. package/.agents/skills/recipe-design/SKILL.md +90 -0
  25. package/.agents/skills/recipe-design/agents/openai.yaml +7 -0
  26. package/.agents/skills/recipe-diagnose/SKILL.md +187 -0
  27. package/.agents/skills/recipe-diagnose/agents/openai.yaml +7 -0
  28. package/.agents/skills/recipe-front-build/SKILL.md +127 -0
  29. package/.agents/skills/recipe-front-build/agents/openai.yaml +7 -0
  30. package/.agents/skills/recipe-front-design/SKILL.md +90 -0
  31. package/.agents/skills/recipe-front-design/agents/openai.yaml +7 -0
  32. package/.agents/skills/recipe-front-plan/SKILL.md +68 -0
  33. package/.agents/skills/recipe-front-plan/agents/openai.yaml +7 -0
  34. package/.agents/skills/recipe-front-review/SKILL.md +101 -0
  35. package/.agents/skills/recipe-front-review/agents/openai.yaml +7 -0
  36. package/.agents/skills/recipe-fullstack-build/SKILL.md +139 -0
  37. package/.agents/skills/recipe-fullstack-build/agents/openai.yaml +7 -0
  38. package/.agents/skills/recipe-fullstack-implement/SKILL.md +151 -0
  39. package/.agents/skills/recipe-fullstack-implement/agents/openai.yaml +7 -0
  40. package/.agents/skills/recipe-implement/SKILL.md +125 -0
  41. package/.agents/skills/recipe-implement/agents/openai.yaml +7 -0
  42. package/.agents/skills/recipe-plan/SKILL.md +73 -0
  43. package/.agents/skills/recipe-plan/agents/openai.yaml +7 -0
  44. package/.agents/skills/recipe-reverse-engineer/SKILL.md +212 -0
  45. package/.agents/skills/recipe-reverse-engineer/agents/openai.yaml +7 -0
  46. package/.agents/skills/recipe-review/SKILL.md +115 -0
  47. package/.agents/skills/recipe-review/agents/openai.yaml +7 -0
  48. package/.agents/skills/recipe-task/SKILL.md +74 -0
  49. package/.agents/skills/recipe-task/agents/openai.yaml +7 -0
  50. package/.agents/skills/recipe-update-doc/SKILL.md +156 -0
  51. package/.agents/skills/recipe-update-doc/agents/openai.yaml +7 -0
  52. package/.agents/skills/subagents-orchestration-guide/SKILL.md +354 -0
  53. package/.agents/skills/subagents-orchestration-guide/agents/openai.yaml +7 -0
  54. package/.agents/skills/subagents-orchestration-guide/references/monorepo-flow.md +124 -0
  55. package/.agents/skills/task-analyzer/SKILL.md +142 -0
  56. package/.agents/skills/task-analyzer/agents/openai.yaml +7 -0
  57. package/.agents/skills/task-analyzer/references/skills-index.yaml +162 -0
  58. package/.agents/skills/testing/SKILL.md +324 -0
  59. package/.agents/skills/testing/agents/openai.yaml +7 -0
  60. package/.agents/skills/testing/references/typescript.md +224 -0
  61. package/.codex/agents/acceptance-test-generator.toml +310 -0
  62. package/.codex/agents/code-reviewer.toml +228 -0
  63. package/.codex/agents/code-verifier.toml +231 -0
  64. package/.codex/agents/design-sync.toml +265 -0
  65. package/.codex/agents/document-reviewer.toml +367 -0
  66. package/.codex/agents/integration-test-reviewer.toml +178 -0
  67. package/.codex/agents/investigator.toml +197 -0
  68. package/.codex/agents/prd-creator.toml +250 -0
  69. package/.codex/agents/quality-fixer-frontend.toml +356 -0
  70. package/.codex/agents/quality-fixer.toml +249 -0
  71. package/.codex/agents/requirement-analyzer.toml +172 -0
  72. package/.codex/agents/rule-advisor.toml +186 -0
  73. package/.codex/agents/scope-discoverer.toml +248 -0
  74. package/.codex/agents/solver.toml +212 -0
  75. package/.codex/agents/task-decomposer.toml +262 -0
  76. package/.codex/agents/task-executor-frontend.toml +312 -0
  77. package/.codex/agents/task-executor.toml +314 -0
  78. package/.codex/agents/technical-designer-frontend.toml +492 -0
  79. package/.codex/agents/technical-designer.toml +474 -0
  80. package/.codex/agents/ui-spec-designer.toml +150 -0
  81. package/.codex/agents/verifier.toml +228 -0
  82. package/.codex/agents/work-planner.toml +251 -0
  83. package/README.md +365 -0
  84. package/bin/cli.js +249 -0
  85. package/package.json +35 -0
@@ -0,0 +1,283 @@
1
+ ---
2
+ name: ai-development-guide
3
+ description: "Anti-pattern detection, debugging techniques, quality check workflow, and implementation completeness assurance. Use when: fixing bugs, reviewing code quality, refactoring, making technical decisions, or performing quality assurance."
4
+ ---
5
+
6
+ # AI Developer Guide - Technical Decision Criteria and Anti-pattern Collection
7
+
8
+ ## Language-Specific References
9
+
10
+ For frontend-specific anti-patterns, debugging, and quality checks:
11
+ - **React/TypeScript Frontend**: [references/frontend.md](references/frontend.md)
12
+
13
+ ## Technical Anti-patterns (Red Flag Patterns) [MANDATORY]
14
+
15
+ **IMMEDIATELY stop and reconsider design** when detecting the following patterns:
16
+
17
+ ### Code Quality Anti-patterns
18
+ 1. **Writing similar code 3 or more times** - Violates Rule of Three
19
+ 2. **Multiple responsibilities mixed in a single file** - Violates Single Responsibility Principle (SRP)
20
+ 3. **Defining same content in multiple files** - Violates DRY principle
21
+ 4. **Making changes without checking dependencies** - Potential for unexpected impacts
22
+ 5. **Disabling code with comments** - Should use version control
23
+ 6. **Error suppression** - Hiding problems creates technical debt
24
+ 7. **Bypassing safety mechanisms (type systems, validation, contracts)** - Circumventing correctness guarantees
25
+
26
+ ### Design Anti-patterns
27
+ - **"Make it work for now" thinking** - Accumulation of technical debt
28
+ - **Patchwork implementation** - Unplanned additions to existing code
29
+ - **Optimistic implementation of uncertain technology** - EVALUATE unknown elements with minimal verification code first
30
+ - **Symptomatic fixes** - Identify root cause with 5 Whys instead of applying surface-level patches
31
+ - **Unplanned large-scale changes** - Use incremental approach with phased implementation
32
+
33
+ **ENFORCEMENT**: Detecting ANY anti-pattern requires IMMEDIATE design review before proceeding
34
+
35
+ ## Fail-Fast Fallback Design Principles
36
+
37
+ ### Core Principle [MANDATORY]
38
+ Make errors explicit with full context. Prioritize primary code reliability over fallback implementations. Silent fallbacks are PROHIBITED.
39
+
40
+ ### Implementation Guidelines
41
+
42
+ #### Default Approach [MANDATORY]
43
+ - **Prohibit unconditional fallbacks**: NEVER automatically return default values on errors
44
+ - **Make failures explicit**: Errors MUST be visible and traceable
45
+ - **Preserve error context**: Include original error information when re-throwing
46
+
47
+ #### When Fallbacks Are Acceptable
48
+ - **Only with explicit Design Doc approval**: Document why fallback is necessary
49
+ - **Business-critical continuity**: When partial functionality is better than none
50
+ - **Graceful degradation paths**: Clearly defined degraded service levels
51
+
52
+ #### Layer Responsibilities
53
+ - **Infrastructure Layer**: Always throw errors upward; no business logic decisions; provide detailed error context
54
+ - **Application Layer**: Make business-driven error handling decisions; implement fallbacks only when specified in requirements; log all fallback activations
55
+
56
+ ### Error Masking Detection
57
+
58
+ **Review Triggers** (require design review):
59
+ - Writing 3rd error handler in the same feature
60
+ - Multiple error handling blocks in single function/method
61
+ - Nested error handling structures
62
+ - Error handlers that return default values without logging
63
+
64
+ **Before Implementing Any Fallback** [MANDATORY]:
65
+ **STEP 1**: Verify Design Doc explicitly defines this fallback
66
+ **STEP 2**: Document the business justification
67
+ **STEP 3**: Ensure error is logged with full context
68
+ **STEP 4**: Add monitoring/alerting for fallback activation
69
+
70
+ **ENFORCEMENT**: Fallbacks without Design Doc approval are PROHIBITED
71
+
72
+ ### Implementation Pattern
73
+
74
+ ```
75
+ AVOID: Silent fallback that hides errors
76
+ <handle error>:
77
+ return DEFAULT_VALUE // Error hidden, debugging impossible
78
+
79
+ PREFERRED: Explicit failure with context
80
+ <handle error>:
81
+ log_error('Operation failed', context, error)
82
+ <propagate error> // Re-throw, return Error type, return error tuple
83
+ ```
84
+
85
+ ## Rule of Three - Criteria for Code Duplication
86
+
87
+ How to handle duplicate code based on Martin Fowler's "Refactoring":
88
+
89
+ | Duplication Count | Action | Reason |
90
+ |-------------------|--------|--------|
91
+ | 1st time | Inline implementation | Cannot predict future changes |
92
+ | 2nd time | Consider future consolidation | Pattern beginning to emerge |
93
+ | 3rd time | Implement commonalization | Pattern established |
94
+
95
+ ### Criteria for Commonalization
96
+
97
+ **Cases for Commonalization**:
98
+ - Business logic duplication
99
+ - Complex processing algorithms
100
+ - Areas likely requiring bulk changes
101
+ - Validation rules
102
+
103
+ **Cases to Avoid Commonalization**:
104
+ - Accidental matches (coincidentally same code)
105
+ - Possibility of evolving in different directions
106
+ - Significant readability decrease from commonalization
107
+ - Simple helpers in test code
108
+
109
+ ## Common Failure Patterns and Avoidance Methods
110
+
111
+ ### Pattern 1: Error Fix Chain
112
+ **Symptom**: Fixing one error causes new errors
113
+ **Cause**: Surface-level fixes without understanding root cause
114
+ **Avoidance**: Identify root cause with 5 Whys before fixing
115
+
116
+ ### Pattern 2: Circumventing Correctness Guarantees
117
+ **Symptom**: Bypassing safety mechanisms (type systems, validation, contracts)
118
+ **Cause**: Impulse to avoid correctness errors
119
+ **Avoidance**: Use language-appropriate safety mechanisms
120
+
121
+ ### Pattern 3: Implementation Without Sufficient Testing
122
+ **Symptom**: Many bugs after implementation
123
+ **Cause**: Ignoring Red-Green-Refactor process
124
+ **Avoidance**: Always start with failing tests
125
+
126
+ ### Pattern 4: Ignoring Technical Uncertainty
127
+ **Symptom**: Frequent unexpected errors when introducing new technology
128
+ **Cause**: Assuming things work without prior investigation
129
+ **Avoidance**:
130
+ - Record certainty evaluation at the beginning of task files
131
+ - For low certainty cases, create minimal verification code first
132
+
133
+ ### Pattern 5: Insufficient Existing Code Investigation
134
+ **Symptom**: Duplicate implementations, architecture inconsistency, integration failures
135
+ **Cause**: Insufficient understanding of existing code before implementation
136
+ **Avoidance**:
137
+ - Before implementation, always search for similar functionality
138
+ - Similar functionality found: Use that implementation (do not create new)
139
+ - Similar functionality is technical debt: Create ADR improvement proposal
140
+ - No similar functionality: Implement following existing design philosophy
141
+
142
+ ## Debugging Techniques
143
+
144
+ ### 1. Error Analysis Procedure
145
+ 1. Read error message (first line) accurately
146
+ 2. Focus on first and last of stack trace
147
+ 3. Identify first line where your code appears
148
+
149
+ ### 2. 5 Whys - Root Cause Analysis
150
+ ```
151
+ Example:
152
+ Symptom: Build error
153
+ Why1: Contract definitions don't match
154
+ Why2: Interface was updated
155
+ Why3: Dependency change
156
+ Why4: Package update impact
157
+ Why5: Major version upgrade with breaking changes
158
+ Root cause: Inappropriate version specification in dependency manifest
159
+ ```
160
+
161
+ ### 3. Minimal Reproduction Code
162
+ To isolate problems, attempt reproduction with minimal code:
163
+ - Remove unrelated parts
164
+ - Replace external dependencies with mocks
165
+ - Create minimal configuration that reproduces problem
166
+
167
+ ### 4. Debug Log Output
168
+ ```
169
+ Pattern: Structured logging with context
170
+ {
171
+ context: 'operation-name',
172
+ input: { relevant, input, data },
173
+ state: currentState,
174
+ timestamp: current_time_ISO8601
175
+ }
176
+ ```
177
+
178
+ ## Quality Check Workflow [MANDATORY]
179
+
180
+ Universal quality assurance phases applicable to all languages:
181
+
182
+ ### Phase 1: Static Analysis
183
+ 1. **Code Style Checking**: Verify adherence to style guidelines
184
+ 2. **Code Formatting**: Ensure consistent formatting
185
+ 3. **Unused Code Detection**: Identify dead code and unused imports/variables
186
+ 4. **Static Type Checking**: Verify type correctness (for statically typed languages)
187
+ 5. **Static Analysis**: Detect potential bugs, security issues, code smells
188
+
189
+ ### Phase 2: Build Verification
190
+ 1. **Compilation/Build**: Verify code builds successfully
191
+ 2. **Dependency Resolution**: Ensure all dependencies are available and compatible
192
+ 3. **Resource Validation**: Check configuration files, assets are valid
193
+
194
+ ### Phase 3: Testing
195
+ 1. **Unit Tests**: Run all unit tests
196
+ 2. **Integration Tests**: Run integration tests
197
+ 3. **Test Coverage**: Measure and verify coverage meets standards
198
+ 4. **E2E Tests**: Run end-to-end tests
199
+
200
+ ### Phase 4: Final Quality Gate [MANDATORY]
201
+ All checks MUST pass before proceeding:
202
+ - Zero static analysis errors
203
+ - Build succeeds
204
+ - All tests pass
205
+ - Coverage meets threshold
206
+
207
+ **ENFORCEMENT**: Cannot proceed with ANY quality check failures — fix ALL errors before marking task complete
208
+
209
+ ## Situations Requiring Technical Decisions
210
+
211
+ ### Timing of Abstraction
212
+ - Extract patterns after writing concrete implementation 3 times (Rule of Three)
213
+ - Apply YAGNI — implement only currently needed features
214
+ - Prioritize current simplicity over future extensibility
215
+
216
+ ### Performance vs Readability
217
+ - Prioritize readability unless clear bottleneck exists
218
+ - **Measure first** — profile before optimizing (no guessing)
219
+ - Document reason with comments when optimizing
220
+
221
+ ### Granularity of Contracts and Interfaces
222
+ - Overly detailed contracts reduce maintainability
223
+ - Design interfaces that appropriately express domain
224
+ - Use abstraction mechanisms to reduce duplication
225
+
226
+ ## Implementation Completeness Assurance
227
+
228
+ ### Impact Analysis: Mandatory 3-Stage Process [MANDATORY]
229
+
230
+ Complete these stages sequentially before any implementation:
231
+
232
+ **1. Discovery** - Identify all affected code:
233
+ - Implementation references (imports, calls, instantiations)
234
+ - Interface dependencies (contracts, types, data structures)
235
+ - Test coverage
236
+ - Configuration (build configs, env settings, feature flags)
237
+ - Documentation (comments, docs, diagrams)
238
+
239
+ **2. Understanding** - Analyze each discovered location:
240
+ - Role and purpose in the system
241
+ - Dependency direction (consumer or provider)
242
+ - Data flow (origin to transformations to destination)
243
+ - Coupling strength
244
+
245
+ **3. Identification** - Produce structured report:
246
+ ```
247
+ ## Impact Analysis
248
+ ### Direct Impact
249
+ - [Unit]: [Reason and modification needed]
250
+
251
+ ### Indirect Impact
252
+ - [System]: [Integration path and reason]
253
+
254
+ ### Data Flow
255
+ [Source] -> [Transformation] -> [Consumer]
256
+
257
+ ### Risk Assessment
258
+ - High: [Complex dependencies, fragile areas]
259
+ - Medium: [Moderate coupling, test gaps]
260
+ - Low: [Isolated, well-tested areas]
261
+
262
+ ### Implementation Order
263
+ 1. [Start with lowest risk or deepest dependency]
264
+ 2. [...]
265
+ ```
266
+
267
+ **ENFORCEMENT**: CANNOT implement until all 3 stages are documented
268
+
269
+ ### Unused Code Deletion
270
+
271
+ When unused code is detected:
272
+ - Will it be used in this work? Yes: Implement now | No: Delete now (Git preserves)
273
+ - Applies to: Code, tests, docs, configs, assets
274
+
275
+ ### Existing Code Modification
276
+
277
+ ```
278
+ In use? No -> Delete
279
+ Yes -> Working? No -> Delete + Reimplement
280
+ Yes -> Fix/Extend
281
+ ```
282
+
283
+ **Principle**: Prefer clean implementation over patching broken code
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "AI Development Guide"
3
+ short_description: "Anti-patterns and quality workflow"
4
+ default_prompt: "Use $ai-development-guide to check for anti-patterns in my code."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,135 @@
1
+ # Frontend-Specific AI Development Guide (React/TypeScript)
2
+
3
+ ## Frontend Anti-patterns (Additional Red Flags)
4
+
5
+ In addition to the general anti-patterns in SKILL.md, detect these frontend-specific patterns:
6
+
7
+ 1. **Excessive use of type assertions (`as`)** - Abandoning type safety; use `unknown` + type guards instead
8
+ 2. **Prop drilling through 3+ levels** - Use Context API or state management
9
+ 3. **Massive components (300+ lines)** - Split into smaller, focused components
10
+ 4. **Commented-out JSX or component code** - Delete it; Git preserves history
11
+
12
+ ## Frontend Commonalization Criteria
13
+
14
+ **Cases for Commonalization** (in addition to general criteria):
15
+ - Component patterns (form fields, cards, modals, etc.)
16
+ - Custom hooks with shared logic
17
+ - Validation rules for form inputs
18
+
19
+ **Implementation Example**:
20
+ ```typescript
21
+ // Bad: Immediate commonalization on 1st duplication
22
+ function UserEmailInput() { /* ... */ }
23
+ function ContactEmailInput() { /* ... */ }
24
+
25
+ // Good: Commonalize on 3rd occurrence
26
+ function EmailInput({ context }: { context: 'user' | 'contact' | 'admin' }) { /* ... */ }
27
+ ```
28
+
29
+ ## Frontend Fallback Design
30
+
31
+ ### Layer Responsibilities (React-specific)
32
+ - **Component Layer**: Use Error Boundary for error handling
33
+ - **Hook Layer**: Implement decisions based on business requirements
34
+ - **API Layer**: Convert fetch errors to domain errors
35
+
36
+ ### Detection of Excessive Fallbacks
37
+ - Require design review when writing the 3rd catch statement in the same feature
38
+ - Verify Design Doc definition before implementing fallbacks
39
+ - Log errors explicitly and make failures visible
40
+
41
+ ## Frontend Debugging Techniques
42
+
43
+ ### Error Analysis (React-specific)
44
+ 1. Read error message (first line) accurately
45
+ 2. Focus on first and last of stack trace
46
+ 3. Identify first line where your code appears
47
+ 4. **Check React DevTools for component hierarchy**
48
+
49
+ ### 5 Whys Example (Frontend)
50
+ ```
51
+ Symptom: Component not rendering
52
+ Why1: Props are undefined
53
+ Why2: Parent component didn't pass props
54
+ Why3: Parent using old prop names
55
+ Why4: Component interface was updated
56
+ Why5: No update to parent after refactoring
57
+ Root cause: Incomplete refactoring, missing call-site updates
58
+ ```
59
+
60
+ ### Minimal Reproduction (React-specific)
61
+ - Remove unrelated components
62
+ - Replace API calls with mocks
63
+ - Create minimal configuration that reproduces the problem
64
+ - Use React DevTools to inspect component tree
65
+
66
+ ### Debug Log Pattern (Frontend)
67
+ ```typescript
68
+ console.log('DEBUG:', {
69
+ context: 'user-form-submission',
70
+ props: { email, name },
71
+ state: currentState,
72
+ timestamp: new Date().toISOString()
73
+ })
74
+ ```
75
+
76
+ ## Frontend Quality Check Workflow
77
+
78
+ Use the appropriate run command based on the `packageManager` field in package.json.
79
+
80
+ ### Common Commands
81
+ - `dev` - Development server
82
+ - `build` - Production build
83
+ - `preview` - Preview production build
84
+ - `type-check` - Type check (no emit)
85
+
86
+ ### Quality Check Phases
87
+ **Phase 1-3: Basic Checks**
88
+ - `check` - Linter + formatter (Biome, ESLint, Prettier, etc.)
89
+ - `build` - TypeScript build
90
+
91
+ **Phase 4-5: Tests and Final Confirmation**
92
+ - `test` - Test execution
93
+ - `test:coverage:fresh` - Coverage measurement (fresh cache)
94
+ - `check:all` - Overall integrated check
95
+
96
+ ### Troubleshooting
97
+ - **Port in use error**: Run `cleanup:processes` script if available
98
+ - **Cache issues**: Run tests with fresh cache option
99
+ - **Dependency errors**: Clean reinstall dependencies
100
+
101
+ ## Frontend Technical Decisions
102
+
103
+ ### Component/Type Granularity
104
+ - Overly detailed components/types reduce maintainability
105
+ - Design components that appropriately express UI patterns
106
+ - Use composition over inheritance
107
+
108
+ ### Performance vs Readability
109
+ - Prioritize readability unless clear bottleneck exists
110
+ - Measure before optimizing (use React DevTools Profiler, not guesses)
111
+ - Document reason with comments when optimizing
112
+
113
+ ## Frontend Impact Analysis
114
+
115
+ ### Discovery (React-specific search)
116
+ ```bash
117
+ # Search for component, hook, and type references
118
+ grep -rn "ComponentName\|hookName" --include="*.tsx" --include="*.ts"
119
+ grep -rn "importedFunction" --include="*.tsx" --include="*.ts"
120
+ grep -rn "propsType\|StateType" --include="*.tsx" --include="*.ts"
121
+ ```
122
+
123
+ ### Understanding (React-specific)
124
+ Read all discovered files and analyze:
125
+ - Caller's purpose and context
126
+ - Component hierarchy
127
+ - Data flow: Props -> State -> Event handlers -> Callbacks
128
+
129
+ ### Identification (React-specific)
130
+ ```
131
+ ## Impact Analysis
132
+ ### Direct Impact: ComponentA, ComponentB (with reasons)
133
+ ### Indirect Impact: FeatureX, PageY (with integration paths)
134
+ ### Processing Flow: Props -> Render -> Events -> Callbacks
135
+ ```
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: coding-rules
3
+ description: "Language-agnostic coding standards for maintainability, readability, and quality. Use when: implementing features, refactoring code, reviewing code quality, or writing functions."
4
+ ---
5
+
6
+ # Coding Rules
7
+
8
+ ## Language-Specific References
9
+
10
+ For language-specific rules, also read:
11
+ - **TypeScript/React**: [references/typescript.md](references/typescript.md)
12
+
13
+ ## Core Philosophy [MANDATORY]
14
+
15
+ 1. **Maintainability over Speed**: Prioritize long-term code health
16
+ 2. **Simplicity First**: YAGNI principle — simplest solution that meets requirements
17
+ 3. **Explicit over Implicit**: Clear intentions through code structure and naming
18
+ 4. **Delete over Comment**: Remove unused code instead of commenting it out
19
+
20
+ **ENFORCEMENT**: Every code change MUST align with these principles
21
+
22
+ ## Code Quality [MANDATORY]
23
+
24
+ - Refactor as you go — eliminate technical debt immediately
25
+ - Use meaningful, descriptive names from the problem domain
26
+ - Extract magic numbers and strings into named constants
27
+ - Keep code self-documenting
28
+
29
+ ## Function Design [MANDATORY]
30
+
31
+ - **0-2 parameters** per function (use objects for 3+)
32
+ - Single responsibility — each function MUST do one thing well
33
+ - Keep functions < 50 lines
34
+ - Use pure functions where possible — separate data transformation from side effects
35
+ - Use early returns to keep nesting ≤ 3 levels
36
+ - **Inject external dependencies explicitly** — pass as parameters for testability
37
+
38
+ ## Error Handling [MANDATORY]
39
+
40
+ - **Always handle errors**: Log with context or propagate explicitly — error suppression is PROHIBITED
41
+ - **Fail fast**: Detect and report errors early
42
+ - **Protect sensitive data**: Mask passwords, tokens, PII from logs
43
+ - Use language-appropriate error handling mechanisms
44
+ - Include error context when re-throwing
45
+
46
+ **ENFORCEMENT**: Zero silent error suppression — every error MUST have log output and appropriate handling
47
+
48
+ ## Dependency Management
49
+
50
+ - **Inject external dependencies explicitly** — pass as parameters for testability
51
+ - Depend on abstractions, not concrete implementations
52
+ - Minimize inter-module dependencies
53
+
54
+ ## Performance
55
+
56
+ - **Measure first**: Profile before optimizing — no premature optimization
57
+ - Focus on algorithms over micro-optimizations
58
+ - Choose data structures based on access patterns
59
+
60
+ ## Code Organization
61
+
62
+ - One primary responsibility per file
63
+ - Group related functionality together
64
+ - Separate concerns: domain logic, data access, presentation
65
+ - Keep files ≤ 500 lines
66
+
67
+ ## Commenting Principles
68
+
69
+ - Document "what" and "why", not "how"
70
+ - No historical information — use version control
71
+ - Remove commented-out code
72
+ - Keep comments concise and timeless
73
+
74
+ ## Refactoring [SAFE CHANGE PROTOCOL]
75
+
76
+ **STEP 1**: Understand current state
77
+ **STEP 2**: Make one small change
78
+ **STEP 3**: Run tests — confirm all pass
79
+ **STEP 4**: Repeat from STEP 2
80
+
81
+ **Triggers**: duplication, functions > 50 lines, complex conditionals
82
+
83
+ **ENFORCEMENT**: Each step MUST maintain working state
84
+
85
+ ## Security
86
+
87
+ - Store secrets in environment variables or secret managers
88
+ - Validate all external input
89
+ - Use parameterized queries for databases
90
+ - Follow principle of least privilege
91
+
92
+ ## Version Control [MANDATORY]
93
+
94
+ - Atomic, focused commits with clear messages
95
+ - Commit working code that passes all tests
96
+ - Never commit debug code or secrets
97
+
98
+ **ENFORCEMENT**: Code MUST pass all quality checks before commit
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Coding Rules"
3
+ short_description: "Clean, maintainable code standards"
4
+ default_prompt: "Use $coding-rules to apply coding standards to my implementation."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true