codingbuddy-rules 4.3.0 → 4.4.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.
- package/.ai-rules/adapters/antigravity.md +648 -160
- package/.ai-rules/adapters/codex.md +500 -10
- package/.ai-rules/adapters/cursor.md +252 -8
- package/.ai-rules/adapters/kiro.md +551 -93
- package/.ai-rules/adapters/opencode-skills.md +179 -188
- package/.ai-rules/adapters/opencode.md +245 -44
- package/.ai-rules/skills/README.md +92 -24
- package/.ai-rules/skills/agent-design/SKILL.md +269 -0
- package/.ai-rules/skills/code-explanation/SKILL.md +259 -0
- package/.ai-rules/skills/context-management/SKILL.md +244 -0
- package/.ai-rules/skills/deployment-checklist/SKILL.md +233 -0
- package/.ai-rules/skills/documentation-generation/SKILL.md +293 -0
- package/.ai-rules/skills/error-analysis/SKILL.md +250 -0
- package/.ai-rules/skills/legacy-modernization/SKILL.md +292 -0
- package/.ai-rules/skills/mcp-builder/SKILL.md +356 -0
- package/.ai-rules/skills/prompt-engineering/SKILL.md +318 -0
- package/.ai-rules/skills/rule-authoring/SKILL.md +273 -0
- package/.ai-rules/skills/security-audit/SKILL.md +241 -0
- package/.ai-rules/skills/tech-debt/SKILL.md +224 -0
- package/package.json +1 -1
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentation-generation
|
|
3
|
+
description: Use when creating or updating README, API docs, architecture docs, or CHANGELOG. Generates clear, accurate documentation from code structure and context.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Documentation Generation
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Good documentation is the gift you give your future self and your team. It is NOT optional.
|
|
11
|
+
|
|
12
|
+
**Core principle:** Documentation describes behavior, not code. If the code changes, update the docs.
|
|
13
|
+
|
|
14
|
+
**Iron Law:**
|
|
15
|
+
```
|
|
16
|
+
DOCS ARE OUTDATED THE MOMENT THEY ARE WRITTEN — AUTOMATE OR ACCEPT THE DEBT
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## When to Use
|
|
20
|
+
|
|
21
|
+
- Creating a new project README
|
|
22
|
+
- Documenting new API endpoints
|
|
23
|
+
- Generating CHANGELOG entries
|
|
24
|
+
- Writing architecture decision records (ADRs)
|
|
25
|
+
- Creating onboarding guides for new team members
|
|
26
|
+
- Documenting AI rules for multi-tool projects
|
|
27
|
+
|
|
28
|
+
## Document Types & Templates
|
|
29
|
+
|
|
30
|
+
### 1. README.md
|
|
31
|
+
|
|
32
|
+
A good README answers: What is this? How do I run it? How do I use it?
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
# Project Name
|
|
36
|
+
|
|
37
|
+
One-sentence description of what this does and who it's for.
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
\`\`\`bash
|
|
42
|
+
npm install
|
|
43
|
+
npm run dev
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- Feature 1: Brief description
|
|
49
|
+
- Feature 2: Brief description
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
\`\`\`bash
|
|
54
|
+
# Prerequisites
|
|
55
|
+
node >= 18
|
|
56
|
+
npm >= 9
|
|
57
|
+
|
|
58
|
+
# Install
|
|
59
|
+
npm install
|
|
60
|
+
|
|
61
|
+
# Configure
|
|
62
|
+
cp .env.example .env
|
|
63
|
+
# Edit .env with your values
|
|
64
|
+
|
|
65
|
+
# Run
|
|
66
|
+
npm start
|
|
67
|
+
\`\`\`
|
|
68
|
+
|
|
69
|
+
## Configuration
|
|
70
|
+
|
|
71
|
+
| Variable | Required | Default | Description |
|
|
72
|
+
|----------|----------|---------|-------------|
|
|
73
|
+
| `PORT` | No | `3000` | Server port |
|
|
74
|
+
| `DATABASE_URL` | Yes | — | PostgreSQL connection string |
|
|
75
|
+
|
|
76
|
+
## API Reference
|
|
77
|
+
|
|
78
|
+
See [API Documentation](./docs/api.md) for full reference.
|
|
79
|
+
|
|
80
|
+
## Contributing
|
|
81
|
+
|
|
82
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 2. API Documentation
|
|
90
|
+
|
|
91
|
+
````markdown
|
|
92
|
+
# API Reference
|
|
93
|
+
|
|
94
|
+
## Authentication
|
|
95
|
+
|
|
96
|
+
All endpoints require Bearer token:
|
|
97
|
+
\`\`\`
|
|
98
|
+
Authorization: Bearer <token>
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
## Endpoints
|
|
102
|
+
|
|
103
|
+
### GET /users
|
|
104
|
+
|
|
105
|
+
List all users.
|
|
106
|
+
|
|
107
|
+
**Parameters:**
|
|
108
|
+
| Name | Type | Required | Description |
|
|
109
|
+
|------|------|----------|-------------|
|
|
110
|
+
| `page` | integer | No | Page number (default: 1) |
|
|
111
|
+
| `limit` | integer | No | Per-page count (default: 20, max: 100) |
|
|
112
|
+
|
|
113
|
+
**Response:**
|
|
114
|
+
\`\`\`json
|
|
115
|
+
{
|
|
116
|
+
"data": [{ "id": "123", "email": "user@example.com" }],
|
|
117
|
+
"meta": { "total": 42, "page": 1 }
|
|
118
|
+
}
|
|
119
|
+
\`\`\`
|
|
120
|
+
|
|
121
|
+
**Errors:**
|
|
122
|
+
| Code | Status | Description |
|
|
123
|
+
|------|--------|-------------|
|
|
124
|
+
| `UNAUTHORIZED` | 401 | Missing or invalid token |
|
|
125
|
+
| `FORBIDDEN` | 403 | Insufficient permissions |
|
|
126
|
+
````
|
|
127
|
+
|
|
128
|
+
### 3. Architecture Decision Record (ADR)
|
|
129
|
+
|
|
130
|
+
```markdown
|
|
131
|
+
# ADR-001: Use NestJS for MCP Server
|
|
132
|
+
|
|
133
|
+
**Date:** 2024-01-15
|
|
134
|
+
**Status:** Accepted
|
|
135
|
+
|
|
136
|
+
## Context
|
|
137
|
+
|
|
138
|
+
We need a Node.js framework for the MCP server with dependency injection and testability.
|
|
139
|
+
|
|
140
|
+
## Decision
|
|
141
|
+
|
|
142
|
+
Use NestJS with TypeScript.
|
|
143
|
+
|
|
144
|
+
## Rationale
|
|
145
|
+
|
|
146
|
+
- Built-in dependency injection for testable code
|
|
147
|
+
- Decorator-based approach matches MCP patterns
|
|
148
|
+
- Strong TypeScript support
|
|
149
|
+
- Module system aligns with MCP's separation of concerns
|
|
150
|
+
|
|
151
|
+
## Consequences
|
|
152
|
+
|
|
153
|
+
- Higher initial complexity than Express
|
|
154
|
+
- Requires understanding of NestJS modules
|
|
155
|
+
- Excellent testing support out of the box
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 4. CHANGELOG
|
|
159
|
+
|
|
160
|
+
Follow [Keep a Changelog](https://keepachangelog.com) format:
|
|
161
|
+
|
|
162
|
+
```markdown
|
|
163
|
+
# Changelog
|
|
164
|
+
|
|
165
|
+
## [Unreleased]
|
|
166
|
+
|
|
167
|
+
### Added
|
|
168
|
+
- New feature X
|
|
169
|
+
|
|
170
|
+
## [1.2.0] - 2024-01-15
|
|
171
|
+
|
|
172
|
+
### Added
|
|
173
|
+
- Support for SSE transport mode
|
|
174
|
+
- Bearer token authentication for SSE
|
|
175
|
+
|
|
176
|
+
### Changed
|
|
177
|
+
- Improved error messages for invalid rules
|
|
178
|
+
|
|
179
|
+
### Fixed
|
|
180
|
+
- Memory leak in rule file watcher
|
|
181
|
+
|
|
182
|
+
### Security
|
|
183
|
+
- Fixed token exposure in debug logs
|
|
184
|
+
|
|
185
|
+
## [1.1.0] - 2024-01-01
|
|
186
|
+
...
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Generation Process
|
|
190
|
+
|
|
191
|
+
### Step 1: Gather Context
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# Understand the project structure
|
|
195
|
+
ls -la
|
|
196
|
+
cat package.json
|
|
197
|
+
git log --oneline -20 # Recent changes for CHANGELOG
|
|
198
|
+
|
|
199
|
+
# Find existing documentation
|
|
200
|
+
find . -name "*.md" -not -path "*/node_modules/*"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Step 2: Extract Information from Code
|
|
204
|
+
|
|
205
|
+
For TypeScript projects, extract JSDoc/TSDoc:
|
|
206
|
+
```typescript
|
|
207
|
+
/**
|
|
208
|
+
* Search rules by query string.
|
|
209
|
+
* @param query - Search term to match against rule content
|
|
210
|
+
* @param options - Optional filters
|
|
211
|
+
* @returns Matching rules sorted by relevance
|
|
212
|
+
*/
|
|
213
|
+
async searchRules(query: string, options?: SearchOptions): Promise<Rule[]>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
For configuration:
|
|
217
|
+
```typescript
|
|
218
|
+
// Extract environment variables
|
|
219
|
+
grep -rn "process.env\." src/ | grep -o "process\.env\.[A-Z_]*" | sort -u
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Step 3: Write Documentation
|
|
223
|
+
|
|
224
|
+
**Principles:**
|
|
225
|
+
- **Show, don't just tell** — Include working examples for every major feature
|
|
226
|
+
- **Start with Why** — First sentence explains purpose, not mechanism
|
|
227
|
+
- **One job per section** — Each section answers one question
|
|
228
|
+
- **Concrete over abstract** — Specific examples beat generic descriptions
|
|
229
|
+
|
|
230
|
+
### Step 4: Verify Accuracy
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
- [ ] All code examples are runnable
|
|
234
|
+
- [ ] Environment variables list matches .env.example
|
|
235
|
+
- [ ] API endpoints match actual routes
|
|
236
|
+
- [ ] Prerequisites match actual requirements
|
|
237
|
+
- [ ] Links are not broken
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Documentation Checklist by Type
|
|
241
|
+
|
|
242
|
+
### README
|
|
243
|
+
- [ ] One-line description at top
|
|
244
|
+
- [ ] Quick Start (< 5 steps to run)
|
|
245
|
+
- [ ] Configuration table (all env vars)
|
|
246
|
+
- [ ] At least one working code example
|
|
247
|
+
- [ ] Link to full docs / contributing guide
|
|
248
|
+
|
|
249
|
+
### API Docs
|
|
250
|
+
- [ ] Authentication documented
|
|
251
|
+
- [ ] All endpoints listed
|
|
252
|
+
- [ ] Request/response examples for each
|
|
253
|
+
- [ ] Error codes documented
|
|
254
|
+
- [ ] Rate limits documented
|
|
255
|
+
|
|
256
|
+
### CHANGELOG
|
|
257
|
+
- [ ] Follows semver (MAJOR.MINOR.PATCH)
|
|
258
|
+
- [ ] Added / Changed / Deprecated / Removed / Fixed / Security sections
|
|
259
|
+
- [ ] Each entry links to issue/PR
|
|
260
|
+
- [ ] Unreleased section at top
|
|
261
|
+
|
|
262
|
+
### ADR
|
|
263
|
+
- [ ] Context explains why decision was needed
|
|
264
|
+
- [ ] Alternatives considered
|
|
265
|
+
- [ ] Decision and rationale clear
|
|
266
|
+
- [ ] Consequences (positive and negative) listed
|
|
267
|
+
|
|
268
|
+
## Common Mistakes
|
|
269
|
+
|
|
270
|
+
| Mistake | Fix |
|
|
271
|
+
|---------|-----|
|
|
272
|
+
| Documenting code, not behavior | Describe what it does, not how |
|
|
273
|
+
| Outdated examples | Add docs to definition of done |
|
|
274
|
+
| No quick start | First 5 minutes → working system |
|
|
275
|
+
| Wall of text | Use tables, code blocks, lists |
|
|
276
|
+
| Missing error docs | Document failure modes |
|
|
277
|
+
| Internal jargon | Write for a new team member |
|
|
278
|
+
|
|
279
|
+
## Tools to Accelerate
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
# TypeScript → API docs
|
|
283
|
+
npx typedoc --out docs/api src/
|
|
284
|
+
|
|
285
|
+
# Markdown linting
|
|
286
|
+
npx markdownlint-cli "**/*.md"
|
|
287
|
+
|
|
288
|
+
# Link checking
|
|
289
|
+
npx markdown-link-check README.md
|
|
290
|
+
|
|
291
|
+
# CHANGELOG generation from git log
|
|
292
|
+
npx conventional-changelog-cli -p angular
|
|
293
|
+
```
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: error-analysis
|
|
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
|
+
---
|
|
5
|
+
|
|
6
|
+
# Error Analysis
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Errors are information. Stack traces are maps. Reading them carefully reveals root cause faster than guessing.
|
|
11
|
+
|
|
12
|
+
**Core principle:** Classify the error before diagnosing it. Different error classes have different diagnostic approaches.
|
|
13
|
+
|
|
14
|
+
**Relationship to systematic-debugging:** Use `error-analysis` to understand WHAT the error is and WHERE it originates. Use `systematic-debugging` to find WHY it happens and implement the fix.
|
|
15
|
+
|
|
16
|
+
**Iron Law:**
|
|
17
|
+
```
|
|
18
|
+
READ THE ENTIRE STACK TRACE BEFORE FORMING ANY HYPOTHESIS
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The answer is almost always in the error message. Most debugging failures are reading failures.
|
|
22
|
+
|
|
23
|
+
## When to Use
|
|
24
|
+
|
|
25
|
+
- Encountering a new error message
|
|
26
|
+
- Stack trace from production logs
|
|
27
|
+
- Unexpected application behavior (silent failure)
|
|
28
|
+
- CI/CD pipeline failures
|
|
29
|
+
- Type errors, runtime errors, build errors
|
|
30
|
+
|
|
31
|
+
## Error Classification
|
|
32
|
+
|
|
33
|
+
First, classify the error type:
|
|
34
|
+
|
|
35
|
+
| Class | Symptoms | Common Causes |
|
|
36
|
+
|-------|----------|--------------|
|
|
37
|
+
| **Syntax Error** | Fails at parse/compile time | Typo, missing bracket, wrong syntax |
|
|
38
|
+
| **Type Error** | TypeScript compiler error | Wrong type, missing null check |
|
|
39
|
+
| **Runtime Error** | Fails during execution | Null reference, division by zero |
|
|
40
|
+
| **Logic Error** | Wrong output, no crash | Algorithm mistake, off-by-one |
|
|
41
|
+
| **Network Error** | Connection failures | Service down, timeout, firewall |
|
|
42
|
+
| **Config Error** | App won't start | Missing env var, wrong path |
|
|
43
|
+
| **Concurrency Error** | Intermittent failures | Race condition, deadlock |
|
|
44
|
+
| **Memory Error** | Growing memory, crash | Memory leak, large allocation |
|
|
45
|
+
|
|
46
|
+
## Reading Stack Traces
|
|
47
|
+
|
|
48
|
+
### Anatomy of a Stack Trace
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
Error: Cannot read properties of undefined (reading 'name') ← Error type + message
|
|
52
|
+
at RulesService.getRule (/app/src/rules/rules.service.ts:42:18) ← Closest to error
|
|
53
|
+
at McpService.handleTool (/app/src/mcp/mcp.service.ts:87:32)
|
|
54
|
+
at McpModule.dispatch (/app/src/mcp/mcp.module.ts:23:12) ← Furthest from error
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Reading order:**
|
|
58
|
+
1. **Error message** — WHAT went wrong
|
|
59
|
+
2. **First frame** — WHERE it broke (your code closest to error)
|
|
60
|
+
3. **Subsequent frames** — HOW we got there (call chain)
|
|
61
|
+
4. **Last frame** — ENTRY POINT that triggered the chain
|
|
62
|
+
|
|
63
|
+
### Stack Trace Analysis Template
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
## Error Analysis
|
|
67
|
+
|
|
68
|
+
**Error type:** [TypeError / ReferenceError / etc.]
|
|
69
|
+
**Error message:** [Exact message]
|
|
70
|
+
**File:** [filename:line:column]
|
|
71
|
+
**Function:** [function where error occurred]
|
|
72
|
+
|
|
73
|
+
**Call chain:** (read bottom to top)
|
|
74
|
+
1. Entry: [how it started]
|
|
75
|
+
2. → [intermediate call]
|
|
76
|
+
3. → [proximate cause]
|
|
77
|
+
|
|
78
|
+
**Initial hypothesis:** [What do I think is undefined/null/wrong?]
|
|
79
|
+
**Evidence needed:** [What do I need to verify the hypothesis?]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Common Error Patterns
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
// ❌ "Cannot read properties of undefined (reading 'X')"
|
|
86
|
+
// → Something is undefined that you expected to exist
|
|
87
|
+
// → Look at the line: what object is being accessed?
|
|
88
|
+
// → Trace back: where was this object supposed to come from?
|
|
89
|
+
|
|
90
|
+
const user = await getUser(id);
|
|
91
|
+
console.log(user.name); // → user is undefined when id not found
|
|
92
|
+
// Fix: check if user exists before accessing properties
|
|
93
|
+
|
|
94
|
+
// ❌ "is not a function"
|
|
95
|
+
// → Called something that isn't a function
|
|
96
|
+
// → Often: wrong import, undefined module, this binding issue
|
|
97
|
+
import { something } from './module'; // wrong path → undefined
|
|
98
|
+
something(); // → TypeError: something is not a function
|
|
99
|
+
|
|
100
|
+
// ❌ "Cannot find module"
|
|
101
|
+
// → Module doesn't exist at specified path
|
|
102
|
+
// → Check: path correct? file exists? compiled?
|
|
103
|
+
|
|
104
|
+
// ❌ "ENOENT: no such file or directory"
|
|
105
|
+
// → File system path doesn't exist
|
|
106
|
+
// → Check: relative vs absolute path, working directory
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Diagnostic Process
|
|
110
|
+
|
|
111
|
+
### Phase 1: Classify and Locate
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
1. What class of error is this? (see table above)
|
|
115
|
+
2. What file and line number? (first frame in stack)
|
|
116
|
+
3. What was the application doing when it failed?
|
|
117
|
+
(context: which API endpoint, which user action, which test)
|
|
118
|
+
4. Is it reproducible? (always / sometimes / once)
|
|
119
|
+
5. When did it start? (new error or regression?)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Phase 2: Understand the Context
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
// For "Cannot read properties of undefined"
|
|
126
|
+
// Add temporary logging to understand what's actually there:
|
|
127
|
+
|
|
128
|
+
// Before:
|
|
129
|
+
const result = await this.rulesService.getRule(name);
|
|
130
|
+
return result.content; // ← crashes
|
|
131
|
+
|
|
132
|
+
// Add logging:
|
|
133
|
+
const result = await this.rulesService.getRule(name);
|
|
134
|
+
console.error('DEBUG result:', JSON.stringify(result, null, 2));
|
|
135
|
+
return result.content;
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Common context questions:**
|
|
139
|
+
- What is the actual value vs expected value?
|
|
140
|
+
- What are the function inputs?
|
|
141
|
+
- What state was the application in?
|
|
142
|
+
- Is this error path tested?
|
|
143
|
+
|
|
144
|
+
### Phase 3: Trace to Origin
|
|
145
|
+
|
|
146
|
+
Follow the error backward through the call chain:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
Frame 1: rules.service.ts:42 — result.content crashes
|
|
150
|
+
→ result is undefined
|
|
151
|
+
→ What could make getRule return undefined?
|
|
152
|
+
|
|
153
|
+
Frame 2: rules.service.ts:35 — find() returns undefined when no match
|
|
154
|
+
→ Why didn't it find the rule?
|
|
155
|
+
|
|
156
|
+
Frame 3: rules.service.ts:28 — rules array
|
|
157
|
+
→ How was rules array populated?
|
|
158
|
+
→ Ah: readRulesDirectory() failed silently on missing directory
|
|
159
|
+
→ ROOT CAUSE: directory path wrong, no error thrown
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Phase 4: Form Hypothesis
|
|
163
|
+
|
|
164
|
+
```markdown
|
|
165
|
+
**Hypothesis:** [Specific, testable statement]
|
|
166
|
+
|
|
167
|
+
Example: "The rules directory path is built from `__dirname` which
|
|
168
|
+
resolves to the dist/ folder in production, but .ai-rules is at
|
|
169
|
+
the project root, so the path is wrong."
|
|
170
|
+
|
|
171
|
+
**Evidence to gather:**
|
|
172
|
+
- Log the actual `rulesDir` path at startup
|
|
173
|
+
- Check if directory exists at that path in production
|
|
174
|
+
|
|
175
|
+
**Falsification:** If the path is correct, this hypothesis is wrong
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Error Catalog
|
|
179
|
+
|
|
180
|
+
### TypeScript Errors
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
// TS2345: Argument of type 'X' is not assignable to parameter of type 'Y'
|
|
184
|
+
// → Type mismatch. Use explicit casting only if you know the type is correct.
|
|
185
|
+
|
|
186
|
+
// TS2339: Property 'X' does not exist on type 'Y'
|
|
187
|
+
// → Accessing property that doesn't exist. Check interface definition.
|
|
188
|
+
|
|
189
|
+
// TS7006: Parameter 'X' implicitly has an 'any' type
|
|
190
|
+
// → TypeScript strict mode requires explicit types. Add the type.
|
|
191
|
+
|
|
192
|
+
// TS2532: Object is possibly 'undefined'
|
|
193
|
+
// → Add null check: if (x !== undefined) or use optional chaining x?.y
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Node.js Runtime Errors
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
ECONNREFUSED → Service not running or wrong port
|
|
200
|
+
EADDRINUSE → Port already in use
|
|
201
|
+
ENOENT → File/directory doesn't exist
|
|
202
|
+
EMFILE → Too many open file handles (leak)
|
|
203
|
+
ENOMEM → Out of memory
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### NestJS / MCP Errors
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
// "Nest can't resolve dependencies"
|
|
210
|
+
// → Circular dependency or missing provider in module
|
|
211
|
+
// → Check: is the service in the module's providers array?
|
|
212
|
+
|
|
213
|
+
// "Cannot GET /endpoint" (404)
|
|
214
|
+
// → Route not registered or wrong HTTP method
|
|
215
|
+
// → Check: @Controller prefix + @Get/Post path
|
|
216
|
+
|
|
217
|
+
// MCP: "Method not found"
|
|
218
|
+
// → Tool/Resource/Prompt name not registered
|
|
219
|
+
// → Check: capability registration in McpService
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Quick Reference
|
|
223
|
+
|
|
224
|
+
| Error Pattern | First Check |
|
|
225
|
+
|--------------|------------|
|
|
226
|
+
| `undefined reading 'X'` | What should X be? Where does it come from? |
|
|
227
|
+
| `is not a function` | Is the import correct? Is it actually exported? |
|
|
228
|
+
| `Cannot find module` | Does the file exist? Is the path correct? |
|
|
229
|
+
| `ENOENT` | Is the file path absolute? Does it exist? |
|
|
230
|
+
| Intermittent failure | Is there shared mutable state? Race condition? |
|
|
231
|
+
| Works locally, fails in CI | Environment variable missing? Path difference? |
|
|
232
|
+
|
|
233
|
+
## Output Format
|
|
234
|
+
|
|
235
|
+
```markdown
|
|
236
|
+
## Error Analysis Summary
|
|
237
|
+
|
|
238
|
+
**Error:** [class] — [message]
|
|
239
|
+
**Location:** [file:line]
|
|
240
|
+
**Reproducible:** Yes / No / Intermittent
|
|
241
|
+
|
|
242
|
+
**Root Cause:** [One clear sentence]
|
|
243
|
+
|
|
244
|
+
**Evidence:** [What confirms the root cause]
|
|
245
|
+
|
|
246
|
+
**Fix:** [What needs to change]
|
|
247
|
+
**Prevents recurrence:** [Test to add or check to add]
|
|
248
|
+
|
|
249
|
+
→ Hand off to systematic-debugging skill for implementation
|
|
250
|
+
```
|