codingbuddy-rules 4.5.0 → 5.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 (129) hide show
  1. package/.ai-rules/adapters/aider.md +374 -0
  2. package/.ai-rules/adapters/antigravity.md +6 -6
  3. package/.ai-rules/adapters/claude-code.md +68 -4
  4. package/.ai-rules/adapters/codex.md +5 -5
  5. package/.ai-rules/adapters/cursor.md +2 -2
  6. package/.ai-rules/adapters/kiro.md +8 -8
  7. package/.ai-rules/adapters/opencode.md +7 -7
  8. package/.ai-rules/adapters/q.md +2 -2
  9. package/.ai-rules/adapters/windsurf.md +395 -0
  10. package/.ai-rules/agents/README.md +66 -16
  11. package/.ai-rules/agents/accessibility-specialist.json +8 -1
  12. package/.ai-rules/agents/act-mode.json +8 -1
  13. package/.ai-rules/agents/agent-architect.json +14 -7
  14. package/.ai-rules/agents/ai-ml-engineer.json +7 -0
  15. package/.ai-rules/agents/architecture-specialist.json +7 -0
  16. package/.ai-rules/agents/auto-mode.json +10 -2
  17. package/.ai-rules/agents/backend-developer.json +7 -0
  18. package/.ai-rules/agents/code-quality-specialist.json +7 -0
  19. package/.ai-rules/agents/code-reviewer.json +86 -64
  20. package/.ai-rules/agents/data-engineer.json +14 -7
  21. package/.ai-rules/agents/data-scientist.json +16 -9
  22. package/.ai-rules/agents/devops-engineer.json +7 -0
  23. package/.ai-rules/agents/documentation-specialist.json +7 -0
  24. package/.ai-rules/agents/eval-mode.json +30 -19
  25. package/.ai-rules/agents/event-architecture-specialist.json +7 -0
  26. package/.ai-rules/agents/frontend-developer.json +7 -0
  27. package/.ai-rules/agents/i18n-specialist.json +8 -1
  28. package/.ai-rules/agents/integration-specialist.json +7 -0
  29. package/.ai-rules/agents/migration-specialist.json +7 -0
  30. package/.ai-rules/agents/mobile-developer.json +8 -10
  31. package/.ai-rules/agents/observability-specialist.json +7 -0
  32. package/.ai-rules/agents/parallel-orchestrator.json +352 -0
  33. package/.ai-rules/agents/performance-specialist.json +7 -0
  34. package/.ai-rules/agents/plan-mode.json +9 -1
  35. package/.ai-rules/agents/plan-reviewer.json +211 -0
  36. package/.ai-rules/agents/platform-engineer.json +7 -0
  37. package/.ai-rules/agents/security-engineer.json +15 -8
  38. package/.ai-rules/agents/security-specialist.json +8 -1
  39. package/.ai-rules/agents/seo-specialist.json +7 -0
  40. package/.ai-rules/agents/software-engineer.json +7 -0
  41. package/.ai-rules/agents/solution-architect.json +17 -10
  42. package/.ai-rules/agents/systems-developer.json +15 -8
  43. package/.ai-rules/agents/technical-planner.json +17 -10
  44. package/.ai-rules/agents/test-engineer.json +13 -6
  45. package/.ai-rules/agents/test-strategy-specialist.json +7 -0
  46. package/.ai-rules/agents/tooling-engineer.json +10 -3
  47. package/.ai-rules/agents/ui-ux-designer.json +7 -0
  48. package/.ai-rules/keyword-modes.json +4 -4
  49. package/.ai-rules/rules/clarification-guide.md +14 -14
  50. package/.ai-rules/rules/core.md +73 -0
  51. package/.ai-rules/rules/parallel-execution.md +217 -0
  52. package/.ai-rules/schemas/agent.schema.json +38 -0
  53. package/.ai-rules/skills/README.md +29 -1
  54. package/.ai-rules/skills/agent-design/SKILL.md +5 -0
  55. package/.ai-rules/skills/agent-design/examples/agent-template.json +55 -0
  56. package/.ai-rules/skills/agent-design/references/expertise-guidelines.md +112 -0
  57. package/.ai-rules/skills/agent-discussion/SKILL.md +199 -0
  58. package/.ai-rules/skills/agent-discussion-panel/SKILL.md +448 -0
  59. package/.ai-rules/skills/api-design/SKILL.md +5 -0
  60. package/.ai-rules/skills/api-design/examples/error-response.json +159 -0
  61. package/.ai-rules/skills/api-design/examples/openapi-template.yaml +393 -0
  62. package/.ai-rules/skills/build-fix/SKILL.md +234 -0
  63. package/.ai-rules/skills/code-explanation/SKILL.md +4 -0
  64. package/.ai-rules/skills/context-management/SKILL.md +1 -0
  65. package/.ai-rules/skills/cost-budget/SKILL.md +348 -0
  66. package/.ai-rules/skills/cross-repo-issues/SKILL.md +257 -0
  67. package/.ai-rules/skills/database-migration/SKILL.md +1 -0
  68. package/.ai-rules/skills/deepsearch/SKILL.md +214 -0
  69. package/.ai-rules/skills/deployment-checklist/SKILL.md +1 -0
  70. package/.ai-rules/skills/error-analysis/SKILL.md +1 -0
  71. package/.ai-rules/skills/finishing-a-development-branch/SKILL.md +281 -0
  72. package/.ai-rules/skills/frontend-design/SKILL.md +5 -0
  73. package/.ai-rules/skills/frontend-design/examples/component-template.tsx +203 -0
  74. package/.ai-rules/skills/frontend-design/references/css-patterns.md +243 -0
  75. package/.ai-rules/skills/git-master/SKILL.md +358 -0
  76. package/.ai-rules/skills/incident-response/SKILL.md +1 -0
  77. package/.ai-rules/skills/legacy-modernization/SKILL.md +1 -0
  78. package/.ai-rules/skills/mcp-builder/SKILL.md +7 -0
  79. package/.ai-rules/skills/mcp-builder/examples/resource-example.ts +233 -0
  80. package/.ai-rules/skills/mcp-builder/examples/tool-example.ts +198 -0
  81. package/.ai-rules/skills/mcp-builder/references/protocol-spec.md +215 -0
  82. package/.ai-rules/skills/onboard/SKILL.md +150 -0
  83. package/.ai-rules/skills/performance-optimization/SKILL.md +3 -0
  84. package/.ai-rules/skills/plan-and-review/SKILL.md +115 -0
  85. package/.ai-rules/skills/plan-to-issues/SKILL.md +318 -0
  86. package/.ai-rules/skills/pr-all-in-one/SKILL.md +15 -13
  87. package/.ai-rules/skills/pr-all-in-one/configuration-guide.md +7 -7
  88. package/.ai-rules/skills/pr-all-in-one/pr-templates.md +10 -10
  89. package/.ai-rules/skills/pr-review/SKILL.md +4 -0
  90. package/.ai-rules/skills/receiving-code-review/SKILL.md +347 -0
  91. package/.ai-rules/skills/refactoring/SKILL.md +1 -0
  92. package/.ai-rules/skills/requesting-code-review/SKILL.md +348 -0
  93. package/.ai-rules/skills/retrospective/SKILL.md +192 -0
  94. package/.ai-rules/skills/rule-authoring/SKILL.md +5 -0
  95. package/.ai-rules/skills/rule-authoring/examples/rule-template.md +142 -0
  96. package/.ai-rules/skills/rule-authoring/examples/trigger-patterns.md +126 -0
  97. package/.ai-rules/skills/security-audit/SKILL.md +4 -0
  98. package/.ai-rules/skills/ship/SKILL.md +242 -0
  99. package/.ai-rules/skills/skill-creator/SKILL.md +461 -0
  100. package/.ai-rules/skills/skill-creator/agents/analyzer.md +206 -0
  101. package/.ai-rules/skills/skill-creator/agents/comparator.md +167 -0
  102. package/.ai-rules/skills/skill-creator/agents/grader.md +152 -0
  103. package/.ai-rules/skills/skill-creator/assets/eval_review.html +568 -0
  104. package/.ai-rules/skills/skill-creator/assets/skill-template.md +43 -0
  105. package/.ai-rules/skills/skill-creator/eval-viewer/generate_review.py +496 -0
  106. package/.ai-rules/skills/skill-creator/references/frontmatter-guide.md +632 -0
  107. package/.ai-rules/skills/skill-creator/references/multi-tool-compat.md +480 -0
  108. package/.ai-rules/skills/skill-creator/references/schemas.md +784 -0
  109. package/.ai-rules/skills/skill-creator/scripts/aggregate_benchmark.py +302 -0
  110. package/.ai-rules/skills/skill-creator/scripts/init_skill.sh +196 -0
  111. package/.ai-rules/skills/skill-creator/scripts/run_loop.py +327 -0
  112. package/.ai-rules/skills/systematic-debugging/SKILL.md +1 -0
  113. package/.ai-rules/skills/tech-debt/SKILL.md +1 -0
  114. package/.ai-rules/skills/test-coverage-gate/SKILL.md +303 -0
  115. package/.ai-rules/skills/tmux-master/SKILL.md +491 -0
  116. package/.ai-rules/skills/using-git-worktrees/SKILL.md +368 -0
  117. package/.ai-rules/skills/verification-before-completion/SKILL.md +234 -0
  118. package/.ai-rules/skills/widget-slot-architecture/SKILL.md +6 -0
  119. package/.ai-rules/skills/widget-slot-architecture/examples/parallel-route-setup.tsx +206 -0
  120. package/.ai-rules/skills/widget-slot-architecture/examples/widget-component.tsx +250 -0
  121. package/.ai-rules/skills/writing-plans/SKILL.md +78 -0
  122. package/bin/cli.js +170 -0
  123. package/lib/init/detect-stack.js +162 -0
  124. package/lib/init/generate-config.js +31 -0
  125. package/lib/init/index.js +86 -0
  126. package/lib/init/prompt.js +60 -0
  127. package/lib/init/scaffold.js +67 -0
  128. package/lib/init/suggest-agent.js +57 -0
  129. package/package.json +10 -2
@@ -0,0 +1,257 @@
1
+ ---
2
+ name: cross-repo-issues
3
+ description: Use when a bug or feature request belongs in an upstream, parent, or dependency repository rather than the current one. Guides detection, mapping, and safe cross-repo issue creation with user confirmation.
4
+ ---
5
+
6
+ # Cross-Repo Issue Creation
7
+
8
+ ## Overview
9
+
10
+ Not every issue belongs in the repository where it was discovered. Bugs in forked code belong upstream. Problems in a monorepo dependency belong in that dependency's repo. Filing issues in the wrong place wastes maintainer time and delays fixes.
11
+
12
+ **Core principle:** ALWAYS confirm the target repository with the user before creating an issue elsewhere. Never auto-create issues in repositories you don't own.
13
+
14
+ **Iron Law:**
15
+
16
+ ```
17
+ NO CROSS-REPO ISSUE CREATION WITHOUT EXPLICIT USER CONFIRMATION
18
+ ```
19
+
20
+ ## When to Use
21
+
22
+ - Bug discovered in forked code that should be reported upstream
23
+ - Issue in a monorepo sub-package that belongs in the package's source repo
24
+ - Bug in a third-party dependency that should be filed in the library's repo
25
+ - Feature request that affects an upstream project
26
+ - Security vulnerability that needs to be reported to the upstream maintainer
27
+
28
+ **Use this ESPECIALLY when:**
29
+ - Working in a fork and the bug exists in the original repo
30
+ - A monorepo package wraps an external library and the bug is in the library
31
+ - You need to coordinate fixes across multiple repositories
32
+
33
+ ## When NOT to Use
34
+
35
+ - Issue is local to the current repository (use normal issue workflow)
36
+ - You don't have access to the target repository
37
+ - The upstream project is archived or unmaintained
38
+ - Simple configuration issues that are project-specific
39
+
40
+ ## Configuration
41
+
42
+ Add `upstreamRepos` to your `codingbuddy.config.json`:
43
+
44
+ ```json
45
+ {
46
+ "upstreamRepos": {
47
+ ".": "original-owner/original-repo",
48
+ "packages/ui": "design-system/ui-kit",
49
+ "dep:react": "facebook/react"
50
+ }
51
+ }
52
+ ```
53
+
54
+ ### Key Conventions
55
+
56
+ | Key Pattern | Meaning | Example |
57
+ |-------------|---------|---------|
58
+ | `"."` | Current repo is a fork of this upstream | `"original-owner/repo"` |
59
+ | `"packages/..."` | Monorepo package maps to external repo | `"org/package-repo"` |
60
+ | `"dep:<name>"` | npm/pip dependency maps to its source repo | `"facebook/react"` |
61
+
62
+ ### Minimal Configuration
63
+
64
+ For a simple fork, only one entry is needed:
65
+
66
+ ```json
67
+ {
68
+ "upstreamRepos": {
69
+ ".": "upstream-owner/upstream-repo"
70
+ }
71
+ }
72
+ ```
73
+
74
+ ## The Three Phases
75
+
76
+ ### Phase 1: Detect — Identify Where the Issue Belongs
77
+
78
+ **Determine if the issue should go to another repository:**
79
+
80
+ 1. **Check the code origin**
81
+ - Is the buggy code from an upstream repo? (`git log --follow <file>`)
82
+ - Is it in a vendored or forked dependency?
83
+ - Does `git remote -v` show an upstream remote?
84
+
85
+ 2. **Check the config mapping**
86
+ - Read `upstreamRepos` from `codingbuddy.config.json`
87
+ - Match the affected file path or package name to a mapping key
88
+ - If no mapping exists, ask the user for the target repo
89
+
90
+ 3. **Verify the issue doesn't already exist upstream**
91
+ - Search upstream issues: `gh issue list -R <upstream> --search "<keywords>"`
92
+ - Check for duplicates before creating
93
+
94
+ **Decision matrix:**
95
+
96
+ | Scenario | Target Repo | Key |
97
+ |----------|-------------|-----|
98
+ | Bug in forked code | Upstream repo | `"."` |
99
+ | Bug in monorepo sub-package's upstream | Package source repo | `"packages/<name>"` |
100
+ | Bug in third-party dependency | Library repo | `"dep:<package>"` |
101
+ | Bug in your own code | Current repo (stop here) | N/A |
102
+
103
+ **Completion criteria:**
104
+ - [ ] Target repository identified
105
+ - [ ] Duplicate check completed
106
+ - [ ] Issue is confirmed to belong upstream
107
+
108
+ ### Phase 2: Confirm — Get User Approval
109
+
110
+ **MANDATORY: Never skip this phase.**
111
+
112
+ Present the following to the user before proceeding:
113
+
114
+ ```
115
+ Cross-Repo Issue Detected:
116
+ Source: <current-repo> (<file-or-package>)
117
+ Target: <upstream-repo>
118
+ Reason: <why this belongs upstream>
119
+ Title: <proposed issue title>
120
+
121
+ Proceed with creating issue in <upstream-repo>? (y/n)
122
+ ```
123
+
124
+ **Include in the confirmation:**
125
+ - The exact target repository (`owner/repo`)
126
+ - Why the issue belongs there (not here)
127
+ - Proposed issue title and summary
128
+ - Whether user has write access to the target repo
129
+
130
+ **If user declines:**
131
+ - Offer to create the issue in the current repo instead
132
+ - Add a label like `upstream` or `external-dependency` for tracking
133
+
134
+ **Completion criteria:**
135
+ - [ ] User explicitly confirmed target repo
136
+ - [ ] User approved issue title and content
137
+
138
+ ### Phase 3: Create — File the Issue
139
+
140
+ **Create the issue in the confirmed target repository:**
141
+
142
+ 1. **Format the issue body**
143
+
144
+ ```markdown
145
+ ## Description
146
+
147
+ <Clear description of the issue>
148
+
149
+ ## Reproduction
150
+
151
+ - Repository: <your-repo> (discovered while working on <context>)
152
+ - File/Package: <affected file or package>
153
+ - Steps to reproduce: <steps>
154
+
155
+ ## Expected Behavior
156
+
157
+ <what should happen>
158
+
159
+ ## Actual Behavior
160
+
161
+ <what actually happens>
162
+
163
+ ## Environment
164
+
165
+ - Version: <upstream version in use>
166
+ - OS: <if relevant>
167
+
168
+ ## Additional Context
169
+
170
+ Discovered in downstream repo: <your-repo-url>
171
+ ```
172
+
173
+ 1. **Create the issue**
174
+
175
+ ```bash
176
+ gh issue create -R <owner/repo> \
177
+ --title "<title>" \
178
+ --body "<body>"
179
+ ```
180
+
181
+ 1. **Link back to current repo (optional)**
182
+ - Create a tracking issue in current repo referencing the upstream issue
183
+ - Add label: `blocked-upstream` or `waiting-upstream`
184
+
185
+ ```bash
186
+ gh issue create \
187
+ --title "Tracking: <upstream-owner/repo>#<number>" \
188
+ --body "Upstream issue: <url>\nBlocked until upstream fix is available." \
189
+ --label "blocked-upstream"
190
+ ```
191
+
192
+ **Completion criteria:**
193
+ - [ ] Issue created in target repository
194
+ - [ ] Issue URL shared with user
195
+ - [ ] (Optional) Tracking issue created in current repo
196
+
197
+ ## Quick Reference
198
+
199
+ | Phase | Action | Verification |
200
+ |-------|--------|-------------|
201
+ | **1. Detect** | Identify target repo from config or code origin | Target repo confirmed |
202
+ | **2. Confirm** | Present plan to user, get explicit approval | User said yes |
203
+ | **3. Create** | File issue via `gh`, link back if needed | Issue URL available |
204
+
205
+ ## Safety Checklist
206
+
207
+ Before creating any cross-repo issue:
208
+
209
+ - [ ] Target repo is correct (double-check `owner/repo`)
210
+ - [ ] Issue doesn't already exist upstream (searched)
211
+ - [ ] User explicitly approved the creation
212
+ - [ ] Issue body is professional and includes reproduction steps
213
+ - [ ] No sensitive/proprietary information in the issue body
214
+ - [ ] You have access to create issues in the target repo
215
+
216
+ ## Red Flags — STOP
217
+
218
+ | Thought | Reality |
219
+ |---------|---------|
220
+ | "I'll just create it, the user won't mind" | STOP. Always confirm. Cross-repo actions are visible to external maintainers. |
221
+ | "It's obviously an upstream bug" | Maybe. But confirm the target repo with the user first. |
222
+ | "I'll skip the duplicate check" | Duplicate issues waste maintainer time and hurt your credibility. |
223
+ | "The config mapping is enough confirmation" | Config maps repos, but the user must confirm each issue creation. |
224
+ | "I'll include our internal details for context" | STOP. Review for sensitive information before posting to external repos. |
225
+ | "No config? I'll guess the upstream repo" | Ask the user. Wrong repo = noise for unrelated maintainers. |
226
+
227
+ ## Examples
228
+
229
+ ### Fork → Upstream
230
+
231
+ ```
232
+ Config: { "upstreamRepos": { ".": "expressjs/express" } }
233
+
234
+ Detected: Bug in request parsing (inherited from upstream)
235
+ Target: expressjs/express
236
+ Action: Confirm with user → Create issue in expressjs/express
237
+ ```
238
+
239
+ ### Monorepo Package → Source Repo
240
+
241
+ ```
242
+ Config: { "upstreamRepos": { "packages/icons": "design-org/icon-library" } }
243
+
244
+ Detected: Missing icon in packages/icons (sourced from design-org/icon-library)
245
+ Target: design-org/icon-library
246
+ Action: Confirm with user → Create issue in design-org/icon-library
247
+ ```
248
+
249
+ ### Dependency → Library Repo
250
+
251
+ ```
252
+ Config: { "upstreamRepos": { "dep:zod": "colinhacks/zod" } }
253
+
254
+ Detected: Validation bug in zod usage
255
+ Target: colinhacks/zod
256
+ Action: Confirm with user → Search existing issues → Create if new
257
+ ```
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: database-migration
3
3
  description: Use when performing database schema changes, data migrations, large table modifications, or when zero-downtime deployment is required - guides systematic, reversible database changes with rollback planning
4
+ disable-model-invocation: true
4
5
  ---
5
6
 
6
7
  # Database Migration
@@ -0,0 +1,214 @@
1
+ ---
2
+ name: deepsearch
3
+ description: Use when simple grep/glob is insufficient and you need comprehensive, multi-pass codebase understanding
4
+ user-invocable: false
5
+ allowed-tools: Read, Grep, Glob, Bash
6
+ ---
7
+
8
+ # Deep Search
9
+
10
+ ## Overview
11
+
12
+ Single-pass searches miss connections. Grep finds strings, not understanding.
13
+
14
+ **Core principle:** ALWAYS search in multiple passes with increasing precision. A single query never gives the full picture.
15
+
16
+ **Violating the letter of this process is violating the spirit of thorough search.**
17
+
18
+ ## The Iron Law
19
+
20
+ ```
21
+ NO CONCLUSIONS WITHOUT CROSS-REFERENCED EVIDENCE FROM MULTIPLE PASSES
22
+ ```
23
+
24
+ If you haven't completed at least Phases 1-3, your understanding is incomplete.
25
+
26
+ ## When to Use
27
+
28
+ Use when simple grep/glob is **insufficient**:
29
+ - Understanding how a feature works end-to-end
30
+ - Tracing data flow across multiple files/modules
31
+ - Finding all usages and side effects before refactoring
32
+ - Detecting dead code or unused exports
33
+ - Mapping dependency chains
34
+ - Understanding implicit relationships (event emitters, dynamic imports, reflection)
35
+ - Auditing a pattern's usage across the codebase
36
+
37
+ **Use this ESPECIALLY when:**
38
+ - Initial search returns too many or too few results
39
+ - You need to understand "everything that touches X"
40
+ - The codebase uses indirection (dependency injection, plugins, event systems)
41
+ - You're about to make a breaking change
42
+ - You need confidence that nothing was missed
43
+
44
+ **Don't use when:**
45
+ - You know the exact file and symbol (use direct read)
46
+ - A single grep gives you the complete answer
47
+ - You're looking up a specific API signature
48
+
49
+ ## The Four Phases
50
+
51
+ You MUST complete each phase before drawing conclusions.
52
+
53
+ ### Phase 1: Broad Search — Cast a Wide Net
54
+
55
+ **Goal:** Discover all potentially relevant files and symbols.
56
+
57
+ 1. **Start with Multiple Search Strategies**
58
+ - Search by name: function names, class names, variable names
59
+ - Search by pattern: string literals, error messages, log statements
60
+ - Search by structure: file naming conventions, directory patterns
61
+ - Search by type: imports, exports, type definitions
62
+
63
+ 2. **Use Varied Query Terms**
64
+ - Don't stop at the first query term
65
+ - Try synonyms, abbreviations, related concepts
66
+ - Search for both the interface and the implementation
67
+ - Include test files — they reveal intended usage
68
+
69
+ 3. **Record Everything**
70
+ - Note every file that appears relevant
71
+ - Note unexpected hits — they often reveal hidden connections
72
+ - Note files that *should* have matched but didn't
73
+
74
+ **Output:** A list of all candidate files and symbols to investigate.
75
+
76
+ ### Phase 2: Narrow Focus — Understand Each Hit
77
+
78
+ **Goal:** Read and understand each candidate in context.
79
+
80
+ 1. **Classify Each Result**
81
+ - Definition vs. usage vs. re-export
82
+ - Direct dependency vs. indirect dependency
83
+ - Active code vs. dead code vs. test code
84
+
85
+ 2. **Read Surrounding Context**
86
+ - Don't just read the matching line — read the function/class
87
+ - Check imports at the top of the file
88
+ - Check exports at the bottom
89
+ - Read adjacent functions for related logic
90
+
91
+ 3. **Build a Symbol Map**
92
+ - Where is it defined?
93
+ - Where is it imported?
94
+ - Where is it called/used?
95
+ - What calls it? (reverse dependency)
96
+
97
+ 4. **Identify Indirection**
98
+ - Dynamic imports (`import()`, `require()`)
99
+ - String-based lookups (registries, plugin systems)
100
+ - Event-driven connections (emit/on patterns)
101
+ - Dependency injection (constructor injection, providers)
102
+ - Configuration-driven behavior (feature flags, env vars)
103
+
104
+ ### Phase 3: Cross-Reference — Connect the Dots
105
+
106
+ **Goal:** Map relationships between all discovered symbols and files.
107
+
108
+ 1. **Trace Data Flow**
109
+ - Follow data from source to sink
110
+ - Input → transform → output for each function in the chain
111
+ - Note where data shape changes (serialization, mapping)
112
+
113
+ 2. **Trace Control Flow**
114
+ - What triggers this code path?
115
+ - What conditions must be true?
116
+ - What error paths exist?
117
+ - What happens on failure?
118
+
119
+ 3. **Identify Dependency Chains**
120
+ - A imports B imports C — trace the full chain
121
+ - Circular dependencies — note them explicitly
122
+ - Shared dependencies — what else depends on the same module?
123
+
124
+ 4. **Check for Side Effects**
125
+ - Global state mutations
126
+ - File system operations
127
+ - Database writes
128
+ - External API calls
129
+ - Cache invalidation
130
+
131
+ 5. **Verify Completeness**
132
+ - For every "used by" reference, verify the reverse "depends on"
133
+ - Look for orphaned code that nothing references
134
+ - Check for dynamic/runtime references that static search misses
135
+
136
+ ### Phase 4: Validate — Confirm Your Understanding
137
+
138
+ **Goal:** Prove your mental model is correct.
139
+
140
+ 1. **Test Your Hypothesis**
141
+ - "If I change X, these files should be affected: [list]"
142
+ - "This function is called in these scenarios: [list]"
143
+ - "This code path is triggered by: [list]"
144
+ - Verify each claim with evidence from the code
145
+
146
+ 2. **Check for Gaps**
147
+ - Are there files you expected to find but didn't?
148
+ - Are there connections that seem missing?
149
+ - Does the architecture diagram match the actual code?
150
+
151
+ 3. **Look for Dead Code**
152
+ - Exported but never imported
153
+ - Defined but never called
154
+ - Imported but never used
155
+ - Behind feature flags that are always off
156
+
157
+ 4. **Verify with Tests**
158
+ - Do existing tests confirm your understanding?
159
+ - Do test descriptions match your mental model?
160
+ - Are there test cases for edge cases you identified?
161
+
162
+ 5. **Summarize Findings**
163
+ - List all files involved and their roles
164
+ - Draw the dependency graph (text or description)
165
+ - Note any risks, dead code, or inconsistencies found
166
+ - Provide confidence level: high / medium / low
167
+
168
+ ## Red Flags — STOP and Search Deeper
169
+
170
+ If you catch yourself thinking:
171
+ - "This is probably the only place it's used"
172
+ - "I found one result, that must be it"
173
+ - "The naming convention tells me everything"
174
+ - "I don't need to check test files"
175
+ - "Dynamic imports won't matter here"
176
+ - "This module is self-contained"
177
+ - "I can skip Phase 3, the connections are obvious"
178
+
179
+ **ALL of these mean: STOP. You're making assumptions. Return to Phase 1.**
180
+
181
+ ## Common Rationalizations
182
+
183
+ | Excuse | Reality |
184
+ |--------|---------|
185
+ | "Grep found it, I'm done" | Grep finds strings, not relationships. Continue to Phase 2. |
186
+ | "Only one file imports this" | Check for dynamic imports, re-exports, and test files. |
187
+ | "The naming is clear enough" | Names lie. Read the implementation. |
188
+ | "Tests aren't relevant" | Tests reveal intended behavior and edge cases. Always check. |
189
+ | "This is a small codebase" | Small codebases have hidden complexity too. Follow the process. |
190
+ | "I'll trace the rest later" | Incomplete understanding leads to broken refactors. Trace now. |
191
+
192
+ ## Quick Reference
193
+
194
+ | Phase | Key Activities | Success Criteria |
195
+ |-------|---------------|------------------|
196
+ | **1. Broad Search** | Multiple strategies, varied terms, record all | Complete candidate list |
197
+ | **2. Narrow Focus** | Classify, read context, build symbol map | Understand each hit |
198
+ | **3. Cross-Reference** | Trace data/control flow, find dependencies | Map all relationships |
199
+ | **4. Validate** | Test hypothesis, check gaps, verify with tests | Confirmed mental model |
200
+
201
+ ## Search Strategy Checklist
202
+
203
+ Use this checklist to ensure thorough coverage:
204
+
205
+ - [ ] Searched by symbol name (exact and substring)
206
+ - [ ] Searched by string literals and error messages
207
+ - [ ] Searched by file/directory naming patterns
208
+ - [ ] Checked imports and exports
209
+ - [ ] Checked test files for usage examples
210
+ - [ ] Checked configuration files
211
+ - [ ] Traced dynamic/runtime references
212
+ - [ ] Verified reverse dependencies
213
+ - [ ] Looked for event-driven connections
214
+ - [ ] Checked for dead/unused code
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: deployment-checklist
3
3
  description: Use before deploying to staging or production. Covers pre-deploy validation, environment verification, rollback planning, health checks, and post-deploy monitoring.
4
+ disable-model-invocation: true
4
5
  ---
5
6
 
6
7
  # Deployment Checklist
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: error-analysis
3
3
  description: Use when encountering error messages, stack traces, or unexpected application behavior. Provides structured analysis to understand root cause before attempting any fix.
4
+ allowed-tools: Read, Grep, Glob, Bash(git:*)
4
5
  ---
5
6
 
6
7
  # Error Analysis