codingbuddy-rules 2.4.2 → 3.0.2

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 (53) hide show
  1. package/.ai-rules/CHANGELOG.md +122 -0
  2. package/.ai-rules/agents/README.md +527 -11
  3. package/.ai-rules/agents/accessibility-specialist.json +0 -1
  4. package/.ai-rules/agents/act-mode.json +0 -1
  5. package/.ai-rules/agents/agent-architect.json +0 -1
  6. package/.ai-rules/agents/ai-ml-engineer.json +0 -1
  7. package/.ai-rules/agents/architecture-specialist.json +14 -2
  8. package/.ai-rules/agents/backend-developer.json +14 -2
  9. package/.ai-rules/agents/code-quality-specialist.json +0 -1
  10. package/.ai-rules/agents/data-engineer.json +0 -1
  11. package/.ai-rules/agents/devops-engineer.json +24 -2
  12. package/.ai-rules/agents/documentation-specialist.json +0 -1
  13. package/.ai-rules/agents/eval-mode.json +0 -1
  14. package/.ai-rules/agents/event-architecture-specialist.json +719 -0
  15. package/.ai-rules/agents/frontend-developer.json +14 -2
  16. package/.ai-rules/agents/i18n-specialist.json +0 -1
  17. package/.ai-rules/agents/integration-specialist.json +11 -1
  18. package/.ai-rules/agents/migration-specialist.json +676 -0
  19. package/.ai-rules/agents/mobile-developer.json +0 -1
  20. package/.ai-rules/agents/observability-specialist.json +747 -0
  21. package/.ai-rules/agents/performance-specialist.json +24 -2
  22. package/.ai-rules/agents/plan-mode.json +0 -1
  23. package/.ai-rules/agents/platform-engineer.json +0 -1
  24. package/.ai-rules/agents/security-specialist.json +27 -16
  25. package/.ai-rules/agents/seo-specialist.json +0 -1
  26. package/.ai-rules/agents/solution-architect.json +0 -1
  27. package/.ai-rules/agents/technical-planner.json +0 -1
  28. package/.ai-rules/agents/test-strategy-specialist.json +14 -2
  29. package/.ai-rules/agents/ui-ux-designer.json +0 -1
  30. package/.ai-rules/rules/core.md +25 -0
  31. package/.ai-rules/skills/README.md +35 -0
  32. package/.ai-rules/skills/database-migration/SKILL.md +531 -0
  33. package/.ai-rules/skills/database-migration/expand-contract-patterns.md +314 -0
  34. package/.ai-rules/skills/database-migration/large-scale-migration.md +414 -0
  35. package/.ai-rules/skills/database-migration/rollback-strategies.md +359 -0
  36. package/.ai-rules/skills/database-migration/validation-procedures.md +428 -0
  37. package/.ai-rules/skills/dependency-management/SKILL.md +381 -0
  38. package/.ai-rules/skills/dependency-management/license-compliance.md +282 -0
  39. package/.ai-rules/skills/dependency-management/lock-file-management.md +437 -0
  40. package/.ai-rules/skills/dependency-management/major-upgrade-guide.md +292 -0
  41. package/.ai-rules/skills/dependency-management/security-vulnerability-response.md +230 -0
  42. package/.ai-rules/skills/incident-response/SKILL.md +373 -0
  43. package/.ai-rules/skills/incident-response/communication-templates.md +322 -0
  44. package/.ai-rules/skills/incident-response/escalation-matrix.md +347 -0
  45. package/.ai-rules/skills/incident-response/postmortem-template.md +351 -0
  46. package/.ai-rules/skills/incident-response/severity-classification.md +256 -0
  47. package/.ai-rules/skills/performance-optimization/CREATION-LOG.md +87 -0
  48. package/.ai-rules/skills/performance-optimization/SKILL.md +76 -0
  49. package/.ai-rules/skills/performance-optimization/documentation-template.md +70 -0
  50. package/.ai-rules/skills/pr-review/SKILL.md +768 -0
  51. package/.ai-rules/skills/refactoring/SKILL.md +192 -0
  52. package/.ai-rules/skills/refactoring/refactoring-catalog.md +1377 -0
  53. package/package.json +1 -1
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: performance-optimization
3
+ description: Use when optimizing code performance, addressing slowness complaints, or measuring application speed improvements
4
+ ---
5
+
6
+ # Performance Optimization
7
+
8
+ **Iron Law:** `NO OPTIMIZATION WITHOUT PROFILING FIRST`
9
+
10
+ No exceptions - not for "obvious" bottlenecks, "quick wins", or "best practices".
11
+
12
+ **Use for:** Slow APIs, UI lag, high memory, slow builds, database queries, any "make it faster" request.
13
+
14
+ ## Five Phases
15
+
16
+ | Phase | Activity | Output |
17
+ |-------|----------|--------|
18
+ | **1. Profile** | Find hot paths with profiler | Bottlenecks with % of time |
19
+ | **2. Benchmark** | 5 warm-up + 10 measured runs | Baseline with mean, std, p95 |
20
+ | **3. Prioritize** | Apply Amdahl's Law | ROI-ranked list |
21
+ | **4. Optimize** | ONE change, verify | Measured improvement |
22
+ | **5. Prevent** | CI gates, monitoring | Regression detection |
23
+
24
+ ### Phase 1: Profile
25
+
26
+ 1. Clarify metrics ("It's slow" → p50? p95?)
27
+ 2. Select profiler:
28
+ - **CPU:** perf, py-spy, node --prof, Chrome DevTools
29
+ - **Memory:** heaptrack, memray, Chrome Memory
30
+ - **I/O:** strace, iostat, slow query log
31
+ - **Distributed:** OpenTelemetry, Jaeger, Datadog
32
+ - **Serverless:** AWS X-Ray, CloudWatch
33
+ - **Mobile:** Android Profiler, Xcode Instruments
34
+ 3. Profile cold AND warm cache
35
+ 4. **Flame graphs:** Wider bars = more time
36
+ 5. **Time-box:** Max 2 hours → Escalate if unclear
37
+
38
+ ### Phase 3: Prioritize (Amdahl's Law)
39
+
40
+ **Formula:** `Speedup = 1 / ((1 - P) + P/S)`
41
+
42
+ | Bottleneck % | Max Speedup | Action |
43
+ |--------------|-------------|--------|
44
+ | < 5% | < 1.05x | Skip |
45
+ | 5-20% | 1.05-1.25x | Low priority |
46
+ | 20-50% | 1.25-2x | Medium |
47
+ | > 50% | > 2x | **High priority** |
48
+
49
+ **Multiple similar %?** Optimize easiest first. Re-profile after each.
50
+
51
+ ### Phase 4: Optimize
52
+
53
+ 1. Write benchmark test first
54
+ 2. ONE change at a time
55
+ 3. Compare statistically
56
+ 4. **Rollback:** Separate commit, feature flags
57
+
58
+ ### Phase 5: Prevent
59
+
60
+ Add CI gate: `PERF_BUDGET_MS: 150` → fail build if exceeded
61
+
62
+ ## Red Flags - STOP
63
+
64
+ - "I know where the bottleneck is" → Profile first
65
+ - "Let's just add caching" → Measure first
66
+ - "One run is enough" → High variance
67
+ - "The fix is obvious" → Return to Phase 1
68
+
69
+ ## Rationalizations
70
+
71
+ | Excuse | Reality |
72
+ |--------|---------|
73
+ | "I know the bottleneck" | Profiling surprises 90% of time |
74
+ | "Micro-optimizations add up" | Amdahl's Law: 5% code = 95% time |
75
+
76
+ See `documentation-template.md` for before/after template.
@@ -0,0 +1,70 @@
1
+ # Performance Optimization Documentation Template
2
+
3
+ Use this template to document performance optimization work.
4
+
5
+ ```markdown
6
+ # Performance Optimization: [Component Name]
7
+
8
+ ## Problem Statement
9
+ [What was slow? How was it measured?]
10
+
11
+ ## Profiling Results
12
+ - Tool used: [profiler name]
13
+ - Hot path: [function/query] - [X]% of time
14
+ - Secondary: [function] - [Y]% of time
15
+
16
+ ## Baseline Benchmark
17
+ - Environment: [specs]
18
+ - Methodology: [warm-up] + [measured runs]
19
+ - Results:
20
+ - Mean: [X]ms (std: [Y]ms)
21
+ - p95: [Z]ms
22
+
23
+ ## Optimization Applied
24
+ [What changed and why]
25
+
26
+ ## Results
27
+ - Mean: [X]ms (std: [Y]ms) - [Z]% improvement
28
+ - p95: [X]ms - [Z]% improvement
29
+ - Bottleneck: [X]% -> [Y]% of total time
30
+
31
+ ## Regression Prevention
32
+ - [ ] Benchmark test added
33
+ - [ ] CI performance gate configured
34
+ - [ ] Production monitoring enabled
35
+ ```
36
+
37
+ ## Example: Database Query Optimization
38
+
39
+ ```markdown
40
+ # Performance Optimization: User Dashboard API
41
+
42
+ ## Problem Statement
43
+ Dashboard API endpoint taking 2.1s mean response time (p95: 3.2s) under 100 concurrent users.
44
+
45
+ ## Profiling Results
46
+ - Tool used: Datadog APM with distributed tracing
47
+ - Hot path: `getUserMetrics()` database query - 68% of time
48
+ - Secondary: JSON serialization - 12% of time
49
+
50
+ ## Baseline Benchmark
51
+ - Environment: AWS t3.medium, PostgreSQL RDS db.t3.medium
52
+ - Methodology: 5 warm-up + 10 measured runs, 100 concurrent users
53
+ - Results:
54
+ - Mean: 2100ms (std: 340ms)
55
+ - p95: 3200ms
56
+
57
+ ## Optimization Applied
58
+ Added composite index on (user_id, created_at) for metrics table.
59
+ Query plan changed from Seq Scan to Index Scan.
60
+
61
+ ## Results
62
+ - Mean: 450ms (std: 65ms) - 78% improvement
63
+ - p95: 680ms - 79% improvement
64
+ - Bottleneck: 68% -> 22% of total time
65
+
66
+ ## Regression Prevention
67
+ - [x] Benchmark test added: `api.bench.ts`
68
+ - [x] CI performance gate: fail if > 800ms p95
69
+ - [x] Production monitoring: Datadog dashboard with p95 alert > 1s
70
+ ```