developer-ai 1.0.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 (105) hide show
  1. package/README.md +241 -0
  2. package/bin/developer-ai.js +2 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +219 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/config/index.d.ts +7 -0
  8. package/dist/config/index.d.ts.map +1 -0
  9. package/dist/config/index.js +82 -0
  10. package/dist/config/index.js.map +1 -0
  11. package/dist/config/schema.d.ts +115 -0
  12. package/dist/config/schema.d.ts.map +1 -0
  13. package/dist/config/schema.js +29 -0
  14. package/dist/config/schema.js.map +1 -0
  15. package/dist/constants.d.ts +8 -0
  16. package/dist/constants.d.ts.map +1 -0
  17. package/dist/constants.js +8 -0
  18. package/dist/constants.js.map +1 -0
  19. package/dist/core/agent.d.ts +38 -0
  20. package/dist/core/agent.d.ts.map +1 -0
  21. package/dist/core/agent.js +155 -0
  22. package/dist/core/agent.js.map +1 -0
  23. package/dist/core/system-prompt.d.ts +6 -0
  24. package/dist/core/system-prompt.d.ts.map +1 -0
  25. package/dist/core/system-prompt.js +44 -0
  26. package/dist/core/system-prompt.js.map +1 -0
  27. package/dist/core/types.d.ts +42 -0
  28. package/dist/core/types.d.ts.map +1 -0
  29. package/dist/core/types.js +6 -0
  30. package/dist/core/types.js.map +1 -0
  31. package/dist/index.d.ts +15 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +12 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/mcp/client.d.ts +13 -0
  36. package/dist/mcp/client.d.ts.map +1 -0
  37. package/dist/mcp/client.js +202 -0
  38. package/dist/mcp/client.js.map +1 -0
  39. package/dist/providers/ollama.d.ts +13 -0
  40. package/dist/providers/ollama.d.ts.map +1 -0
  41. package/dist/providers/ollama.js +60 -0
  42. package/dist/providers/ollama.js.map +1 -0
  43. package/dist/providers/openai.d.ts +9 -0
  44. package/dist/providers/openai.d.ts.map +1 -0
  45. package/dist/providers/openai.js +40 -0
  46. package/dist/providers/openai.js.map +1 -0
  47. package/dist/skills/loader.d.ts +25 -0
  48. package/dist/skills/loader.d.ts.map +1 -0
  49. package/dist/skills/loader.js +93 -0
  50. package/dist/skills/loader.js.map +1 -0
  51. package/dist/tests/tools.test.d.ts +2 -0
  52. package/dist/tests/tools.test.d.ts.map +1 -0
  53. package/dist/tests/tools.test.js +170 -0
  54. package/dist/tests/tools.test.js.map +1 -0
  55. package/dist/tools/index.d.ts +5 -0
  56. package/dist/tools/index.d.ts.map +1 -0
  57. package/dist/tools/index.js +19 -0
  58. package/dist/tools/index.js.map +1 -0
  59. package/dist/tools/list-files.d.ts +3 -0
  60. package/dist/tools/list-files.d.ts.map +1 -0
  61. package/dist/tools/list-files.js +60 -0
  62. package/dist/tools/list-files.js.map +1 -0
  63. package/dist/tools/read-file.d.ts +3 -0
  64. package/dist/tools/read-file.d.ts.map +1 -0
  65. package/dist/tools/read-file.js +46 -0
  66. package/dist/tools/read-file.js.map +1 -0
  67. package/dist/tools/registry.d.ts +24 -0
  68. package/dist/tools/registry.d.ts.map +1 -0
  69. package/dist/tools/registry.js +37 -0
  70. package/dist/tools/registry.js.map +1 -0
  71. package/dist/tools/run-command.d.ts +3 -0
  72. package/dist/tools/run-command.d.ts.map +1 -0
  73. package/dist/tools/run-command.js +114 -0
  74. package/dist/tools/run-command.js.map +1 -0
  75. package/dist/tools/search-text.d.ts +3 -0
  76. package/dist/tools/search-text.d.ts.map +1 -0
  77. package/dist/tools/search-text.js +103 -0
  78. package/dist/tools/search-text.js.map +1 -0
  79. package/dist/tools/utils.d.ts +6 -0
  80. package/dist/tools/utils.d.ts.map +1 -0
  81. package/dist/tools/utils.js +14 -0
  82. package/dist/tools/utils.js.map +1 -0
  83. package/dist/tools/web-search.d.ts +3 -0
  84. package/dist/tools/web-search.d.ts.map +1 -0
  85. package/dist/tools/web-search.js +80 -0
  86. package/dist/tools/web-search.js.map +1 -0
  87. package/dist/tools/write-file.d.ts +3 -0
  88. package/dist/tools/write-file.d.ts.map +1 -0
  89. package/dist/tools/write-file.js +66 -0
  90. package/dist/tools/write-file.js.map +1 -0
  91. package/package.json +54 -0
  92. package/skills/accessibility/SKILL.md +496 -0
  93. package/skills/api-design/SKILL.md +419 -0
  94. package/skills/code-review/SKILL.md +267 -0
  95. package/skills/debugging/SKILL.md +332 -0
  96. package/skills/documentation/SKILL.md +496 -0
  97. package/skills/error-handling/SKILL.md +504 -0
  98. package/skills/git-workflow/SKILL.md +448 -0
  99. package/skills/human-like-coding/SKILL.md +400 -0
  100. package/skills/performance-optimization/SKILL.md +412 -0
  101. package/skills/prompt-engineering/SKILL.md +362 -0
  102. package/skills/refactoring/SKILL.md +457 -0
  103. package/skills/security-audit/SKILL.md +453 -0
  104. package/skills/testing-strategy/SKILL.md +501 -0
  105. package/skills/webapp-testing/SKILL.md +309 -0
@@ -0,0 +1,332 @@
1
+ ---
2
+ name: debugging
3
+ description: Systematic approach to debugging code issues. Use when encountering bugs, errors, unexpected behavior, or crashes. Covers debugging strategies, tools, common bug patterns, and step-by-step approaches for isolating and fixing issues.
4
+ ---
5
+
6
+ # Debugging Skill
7
+
8
+ This skill provides systematic approaches to identifying and fixing bugs efficiently.
9
+
10
+ ## Overview
11
+
12
+ Debugging is a systematic process of finding and resolving issues. This skill teaches methodical approaches that work across different types of bugs and technologies.
13
+
14
+ ## The Debugging Mindset
15
+
16
+ ### Core Principles
17
+ 1. **Understand the expected behavior** - What should happen?
18
+ 2. **Understand the actual behavior** - What is happening?
19
+ 3. **Form hypotheses** - What could cause the difference?
20
+ 4. **Test hypotheses** - Verify or eliminate each possibility
21
+ 5. **Fix and verify** - Ensure the fix works without side effects
22
+
23
+ ## Systematic Debugging Process
24
+
25
+ ### Step 1: Reproduce the Bug
26
+ - Get exact steps to reproduce
27
+ - Identify if it's consistent or intermittent
28
+ - Note the environment (browser, OS, versions)
29
+ - Create a minimal reproduction if possible
30
+
31
+ ### Step 2: Gather Information
32
+ - Check error messages carefully
33
+ - Read stack traces
34
+ - Check logs
35
+ - Review recent changes
36
+ - Check if it worked before
37
+
38
+ ### Step 3: Isolate the Problem
39
+ - Use binary search (comment out half the code)
40
+ - Remove components until bug disappears
41
+ - Add them back one by one
42
+ - Find the smallest reproduction
43
+
44
+ ### Step 4: Form Hypotheses
45
+ - List possible causes
46
+ - Rank by likelihood
47
+ - Test most likely first
48
+
49
+ ### Step 5: Fix and Verify
50
+ - Fix the root cause, not symptoms
51
+ - Add tests for the bug
52
+ - Verify fix doesn't break other things
53
+ - Document the fix
54
+
55
+ ## Common Bug Patterns
56
+
57
+ ### JavaScript/TypeScript
58
+
59
+ **Async/Await Issues**
60
+ ```javascript
61
+ // BUG: Forgetting await
62
+ async function fetchData() {
63
+ const data = fetch('/api/data'); // Missing await!
64
+ console.log(data); // Logs Promise, not data
65
+ }
66
+
67
+ // FIX:
68
+ async function fetchData() {
69
+ const data = await fetch('/api/data');
70
+ const json = await data.json();
71
+ console.log(json);
72
+ }
73
+ ```
74
+
75
+ **Reference vs Value**
76
+ ```javascript
77
+ // BUG: Modifying original object
78
+ function addProperty(obj) {
79
+ obj.newProp = 'value'; // Mutates original!
80
+ return obj;
81
+ }
82
+
83
+ // FIX: Create a copy
84
+ function addProperty(obj) {
85
+ return { ...obj, newProp: 'value' };
86
+ }
87
+ ```
88
+
89
+ **Closure Issues**
90
+ ```javascript
91
+ // BUG: All buttons alert same number
92
+ for (var i = 0; i < 5; i++) {
93
+ buttons[i].onclick = function() {
94
+ alert(i); // Always 5!
95
+ };
96
+ }
97
+
98
+ // FIX: Use let or closure
99
+ for (let i = 0; i < 5; i++) {
100
+ buttons[i].onclick = function() {
101
+ alert(i); // Correct value
102
+ };
103
+ }
104
+ ```
105
+
106
+ **This Binding**
107
+ ```javascript
108
+ // BUG: Lost 'this' context
109
+ class Handler {
110
+ value = 42;
111
+ handleClick() {
112
+ console.log(this.value); // undefined!
113
+ }
114
+ }
115
+ button.onclick = handler.handleClick;
116
+
117
+ // FIX: Bind or arrow function
118
+ button.onclick = handler.handleClick.bind(handler);
119
+ // or
120
+ handleClick = () => {
121
+ console.log(this.value);
122
+ }
123
+ ```
124
+
125
+ ### React Specific
126
+
127
+ **Stale Closure in useEffect**
128
+ ```javascript
129
+ // BUG: Stale count value
130
+ useEffect(() => {
131
+ const interval = setInterval(() => {
132
+ setCount(count + 1); // Always uses initial count!
133
+ }, 1000);
134
+ return () => clearInterval(interval);
135
+ }, []); // Empty deps
136
+
137
+ // FIX: Use functional update
138
+ useEffect(() => {
139
+ const interval = setInterval(() => {
140
+ setCount(c => c + 1);
141
+ }, 1000);
142
+ return () => clearInterval(interval);
143
+ }, []);
144
+ ```
145
+
146
+ **Infinite Re-renders**
147
+ ```javascript
148
+ // BUG: Object in dependency array
149
+ useEffect(() => {
150
+ // ...
151
+ }, [{ foo: 'bar' }]); // New object every render!
152
+
153
+ // FIX: Memoize or use primitive
154
+ const config = useMemo(() => ({ foo: 'bar' }), []);
155
+ useEffect(() => {
156
+ // ...
157
+ }, [config]);
158
+ ```
159
+
160
+ ### CSS Issues
161
+
162
+ **Z-index Problems**
163
+ - Check stacking context (transform, opacity creates new context)
164
+ - Parent z-index limits child
165
+ - Use browser dev tools layers view
166
+
167
+ **Flexbox/Grid Layout**
168
+ - Check parent has display: flex/grid
169
+ - Verify flex-direction
170
+ - Check for overflow issues
171
+ - Use dev tools flexbox/grid overlay
172
+
173
+ ### Network Issues
174
+
175
+ **CORS Errors**
176
+ - Check server Access-Control-Allow-Origin headers
177
+ - Verify credentials mode matches server config
178
+ - Check for preflight requirements
179
+
180
+ **API Errors**
181
+ - Check request format (Content-Type)
182
+ - Verify authentication headers
183
+ - Check payload structure matches API expectations
184
+
185
+ ## Debugging Tools
186
+
187
+ ### Browser DevTools
188
+
189
+ **Console**
190
+ ```javascript
191
+ console.log(variable); // Basic logging
192
+ console.table(array); // Tabular view
193
+ console.trace(); // Stack trace
194
+ console.time('op'); /* code */ console.timeEnd('op'); // Timing
195
+ console.group('name'); /* logs */ console.groupEnd(); // Grouping
196
+ ```
197
+
198
+ **Breakpoints**
199
+ - Line breakpoints
200
+ - Conditional breakpoints
201
+ - Exception breakpoints
202
+ - DOM mutation breakpoints
203
+ - Event listener breakpoints
204
+ - XHR/fetch breakpoints
205
+
206
+ **Network Tab**
207
+ - Check request/response
208
+ - Verify headers
209
+ - Check timing
210
+ - Throttle connection
211
+
212
+ **Performance Tab**
213
+ - Record performance
214
+ - Find bottlenecks
215
+ - Check memory usage
216
+
217
+ ### VS Code Debugging
218
+
219
+ ```json
220
+ // launch.json
221
+ {
222
+ "version": "0.2.0",
223
+ "configurations": [
224
+ {
225
+ "type": "node",
226
+ "request": "launch",
227
+ "name": "Debug Current File",
228
+ "program": "${file}",
229
+ "skipFiles": ["<node_internals>/**"]
230
+ }
231
+ ]
232
+ }
233
+ ```
234
+
235
+ ### Logging Strategies
236
+
237
+ **Structured Logging**
238
+ ```javascript
239
+ console.log(JSON.stringify({
240
+ event: 'user_action',
241
+ action: 'button_click',
242
+ userId: user.id,
243
+ timestamp: Date.now(),
244
+ context: { page: window.location.pathname }
245
+ }, null, 2));
246
+ ```
247
+
248
+ **Debug Library**
249
+ ```javascript
250
+ import debug from 'debug';
251
+ const log = debug('app:module');
252
+
253
+ log('Processing item %O', item);
254
+ // Enable with: DEBUG=app:* node app.js
255
+ ```
256
+
257
+ ## When You're Stuck
258
+
259
+ ### Rubber Duck Debugging
260
+ 1. Explain the problem out loud
261
+ 2. Walk through the code line by line
262
+ 3. Explain what each line should do
263
+ 4. Often reveals the issue
264
+
265
+ ### Take a Break
266
+ - Fresh eyes catch more bugs
267
+ - Step away for 15 minutes
268
+ - Work on something else
269
+
270
+ ### Ask for Help
271
+ - Prepare a minimal reproduction
272
+ - Document what you've tried
273
+ - Be specific about the issue
274
+ - Share relevant error messages
275
+
276
+ ### Search Effectively
277
+ - Include error message in quotes
278
+ - Add technology name
279
+ - Try different phrasings
280
+ - Check GitHub issues
281
+
282
+ ## Bug Prevention
283
+
284
+ ### Write Defensive Code
285
+ ```javascript
286
+ function processUser(user) {
287
+ if (!user) {
288
+ throw new Error('User is required');
289
+ }
290
+ if (!user.email) {
291
+ throw new Error('User email is required');
292
+ }
293
+ // Process...
294
+ }
295
+ ```
296
+
297
+ ### Use TypeScript
298
+ ```typescript
299
+ interface User {
300
+ id: string;
301
+ email: string;
302
+ name?: string;
303
+ }
304
+
305
+ function processUser(user: User): void {
306
+ // TypeScript catches type errors at compile time
307
+ }
308
+ ```
309
+
310
+ ### Write Tests
311
+ ```javascript
312
+ test('processUser throws without user', () => {
313
+ expect(() => processUser(null)).toThrow('User is required');
314
+ });
315
+
316
+ test('processUser throws without email', () => {
317
+ expect(() => processUser({ id: '1' })).toThrow('email is required');
318
+ });
319
+ ```
320
+
321
+ ## Debugging Checklist
322
+
323
+ When debugging:
324
+ - [ ] Can reproduce the bug consistently?
325
+ - [ ] Have exact error message/behavior?
326
+ - [ ] Know when it started happening?
327
+ - [ ] Checked recent changes?
328
+ - [ ] Isolated to specific component?
329
+ - [ ] Tested hypotheses systematically?
330
+ - [ ] Fixed root cause (not symptom)?
331
+ - [ ] Added test to prevent regression?
332
+ - [ ] Verified fix in production-like environment?