@ytspar/sweetlink 1.24.0-canary.73a52fd → 1.24.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.
@@ -0,0 +1,330 @@
1
+ ---
2
+ name: console-check-sweetlink
3
+ description: "Check browser console for errors/warnings via Sweetlink WebSocket. Triggers on: \"console errors\", \"browser errors\", \"console check\", \"zero errors\". NOT for TypeScript/compile errors (use quick-typecheck) or server-side errors (use debugging agent)."
4
+ allowed-tools: Bash
5
+ ---
6
+
7
+ # Console Check Sweetlink Skill
8
+
9
+ Quickly check browser console for errors and warnings using Sweetlink's real-time log monitoring.
10
+
11
+ ## Purpose
12
+
13
+ This skill provides a fast way to verify there are no console errors in the running application. It's essential for maintaining code quality and catching runtime issues immediately after making changes.
14
+
15
+ ## When to Use
16
+
17
+ **Automatically use this skill when:**
18
+
19
+ - After making ANY code changes (catch errors immediately)
20
+ - Before marking a task as complete (zero errors policy)
21
+ - User reports unexpected behavior or bugs
22
+ - During debugging workflows
23
+ - After deploying new features
24
+ - User asks to "check console" or "check for errors"
25
+ - Before committing code
26
+ - During code reviews
27
+
28
+ ## How It Works
29
+
30
+ Sweetlink maintains a real-time connection to the browser and captures all console messages. This skill:
31
+
32
+ 1. Queries Sweetlink for recent console logs
33
+ 2. Filters for errors (and optionally warnings)
34
+ 3. Returns a summary with error details
35
+ 4. Helps identify the root cause quickly
36
+
37
+ ## Commands
38
+
39
+ ### Check for Errors Only
40
+
41
+ ```bash
42
+ pnpm sweetlink logs --filter error
43
+ ```
44
+
45
+ ### Check for Errors and Warnings
46
+
47
+ ```bash
48
+ pnpm sweetlink logs --filter error && pnpm sweetlink logs --filter warning
49
+ ```
50
+
51
+ ### Get All Console Logs
52
+
53
+ ```bash
54
+ pnpm sweetlink logs
55
+ ```
56
+
57
+ ### Filter by Specific Term
58
+
59
+ ```bash
60
+ pnpm sweetlink logs --filter "API"
61
+ pnpm sweetlink logs --filter "Failed to"
62
+ pnpm sweetlink logs --filter "undefined"
63
+ ```
64
+
65
+ ## Understanding Console Errors
66
+
67
+ ### Common Error Types
68
+
69
+ **1. TypeError - Type-related errors**
70
+
71
+ ```text
72
+ TypeError: Cannot read property 'data' of undefined
73
+ TypeError: undefined is not a function
74
+ ```
75
+
76
+ **2. ReferenceError - Variable not defined**
77
+
78
+ ```text
79
+ ReferenceError: myVariable is not defined
80
+ ```
81
+
82
+ **3. Hydration Errors (React/SSR)**
83
+
84
+ ```text
85
+ Warning: Text content did not match. Server: "..." Client: "..."
86
+ Error: Hydration failed because the initial UI does not match...
87
+ ```
88
+
89
+ **4. Network Errors**
90
+
91
+ ```text
92
+ Failed to fetch
93
+ NetworkError when attempting to fetch resource
94
+ ```
95
+
96
+ **5. React Errors**
97
+
98
+ ```text
99
+ Warning: Each child in a list should have a unique "key" prop
100
+ Error: Maximum update depth exceeded
101
+ ```
102
+
103
+ ## Output Format
104
+
105
+ ### Zero Errors (Success)
106
+
107
+ ```text
108
+ ✅ Console Check: CLEAN
109
+
110
+ Errors: 0
111
+ Warnings: 0
112
+ Status: Ready for commit ✓
113
+
114
+ The application has no console errors. Zero-error policy maintained.
115
+ ```
116
+
117
+ ### Errors Found
118
+
119
+ ```markdown
120
+ ❌ Console Check: ERRORS FOUND
121
+
122
+ Errors: 3
123
+ Warnings: 1
124
+
125
+ ### Errors:
126
+
127
+ 1. [ERROR] TypeError: Cannot read property 'data' of undefined
128
+ Location: Card.tsx:45
129
+ Timestamp: 14:23:15.234
130
+
131
+ 2. [ERROR] Failed to fetch data from API
132
+ Location: api.ts:89
133
+ Timestamp: 14:23:16.891
134
+
135
+ 3. [ERROR] Hydration failed: content mismatch
136
+ Location: page.tsx:12
137
+ Timestamp: 14:23:17.023
138
+
139
+ ### Warnings:
140
+
141
+ 1. [WARN] Missing key prop in list rendering
142
+ Location: List.tsx:34
143
+ Timestamp: 14:23:15.456
144
+
145
+ ### Recommendations:
146
+ - Fix null safety in Card.tsx (add null check for data)
147
+ - Add error handling to API fetch in api.ts
148
+ - Fix hydration by ensuring SSR/client consistency in page.tsx
149
+ - Add unique keys to list items in List.tsx
150
+ ```
151
+
152
+ ## Best Practices
153
+
154
+ ### Development Workflow
155
+
156
+ ```bash
157
+ # 1. Check baseline (before making changes)
158
+ pnpm sweetlink logs --filter error
159
+ # Should show 0 errors
160
+
161
+ # 2. Make code changes
162
+
163
+ # 3. Wait for HMR reload (2-3 seconds)
164
+
165
+ # 4. Check for new errors immediately
166
+ pnpm sweetlink logs --filter error
167
+
168
+ # 5. If errors found, fix immediately
169
+ # 6. Repeat until 0 errors
170
+ ```
171
+
172
+ ### Before Committing
173
+
174
+ ```bash
175
+ # Always check console before commit
176
+ pnpm sweetlink logs --filter error
177
+
178
+ # Only commit if 0 errors
179
+ git commit -m "Add feature (0 console errors)"
180
+ ```
181
+
182
+ ### During Code Review
183
+
184
+ ```bash
185
+ # Check PR branch for console errors
186
+ git checkout pr-branch
187
+ pnpm sweetlink logs --filter error
188
+ ```
189
+
190
+ ## Integration with Other Skills
191
+
192
+ **Works well with:**
193
+
194
+ - `quick-typecheck` - Check both compile-time and runtime errors
195
+ - `screenshot` - Visual verification + console check
196
+ - `responsive-screenshots` - Check errors across viewports
197
+
198
+ **Complete quality check:**
199
+
200
+ ```bash
201
+ # 1. Type errors (compile-time)
202
+ pnpm run typecheck
203
+
204
+ # 2. Console errors (runtime)
205
+ pnpm sweetlink logs --filter error
206
+
207
+ # 3. Visual verification
208
+ pnpm sweetlink screenshot --output .tmp/screenshots/verify.png
209
+
210
+ # If all pass: ✅ Ready to commit
211
+ ```
212
+
213
+ ## Common Error Patterns
214
+
215
+ ### Pattern 1: Null/Undefined Access
216
+
217
+ ```javascript
218
+ // Error: Cannot read property 'name' of undefined
219
+ const name = user.name;
220
+
221
+ // Fix: Add null check
222
+ const name = user?.name;
223
+ ```
224
+
225
+ ### Pattern 2: Hydration Mismatch
226
+
227
+ ```javascript
228
+ // Error: Hydration failed
229
+ <div>{new Date().toString()}</div>
230
+
231
+ // Fix: Use useEffect for client-only values
232
+ const [time, setTime] = useState('');
233
+ useEffect(() => setTime(new Date().toString()), []);
234
+ ```
235
+
236
+ ### Pattern 3: Missing Error Handling
237
+
238
+ ```javascript
239
+ // Error: Unhandled promise rejection
240
+ fetch('/api/data');
241
+
242
+ // Fix: Add error handling
243
+ fetch('/api/data').catch(err => console.error(err));
244
+ ```
245
+
246
+ ## Troubleshooting
247
+
248
+ ### "No browser client connected"
249
+
250
+ **Solution:**
251
+
252
+ ```bash
253
+ # 1. Start dev server
254
+ pnpm run dev
255
+
256
+ # 2. Open browser at http://localhost:3000
257
+ # 3. Look for Sweetlink connection indicator (bottom-right)
258
+ ```
259
+
260
+ ### Old Errors Showing
261
+
262
+ **Solution:**
263
+
264
+ ```bash
265
+ # Hard refresh browser to clear cache
266
+ # Mac: Cmd + Shift + R
267
+ # Windows/Linux: Ctrl + Shift + R
268
+ ```
269
+
270
+ ### Too Many Logs
271
+
272
+ **Solution:**
273
+
274
+ ```bash
275
+ # Filter to focus on errors only
276
+ pnpm sweetlink logs --filter error
277
+
278
+ # Or search for specific term
279
+ pnpm sweetlink logs --filter "MyComponent"
280
+ ```
281
+
282
+ ## Zero-Error Policy
283
+
284
+ This skill enforces the zero-error policy:
285
+
286
+ **Before marking ANY task complete:**
287
+
288
+ 1. Run console check
289
+ 2. Ensure 0 errors
290
+ 3. If errors found, fix them
291
+ 4. Re-check until clean
292
+ 5. Only then mark task as complete
293
+
294
+ **Why this matters:**
295
+
296
+ - Prevents bugs from accumulating
297
+ - Catches issues immediately
298
+ - Maintains code quality
299
+ - Improves user experience
300
+ - Reduces debugging time later
301
+
302
+ ## Quick Reference
303
+
304
+ ### Fast Error Check
305
+
306
+ ```bash
307
+ pnpm sweetlink logs --filter error
308
+ ```
309
+
310
+ ### Full Console Analysis
311
+
312
+ ```bash
313
+ pnpm sweetlink logs
314
+ ```
315
+
316
+ ### Search Specific Issue
317
+
318
+ ```bash
319
+ pnpm sweetlink logs --filter "hydration"
320
+ ```
321
+
322
+ ### Check Warnings Too
323
+
324
+ ```bash
325
+ pnpm sweetlink logs --filter warning
326
+ ```
327
+
328
+ ## Examples
329
+
330
+ See `examples.md` for detailed usage scenarios.
@@ -0,0 +1,394 @@
1
+ # Console Check Sweetlink - Examples
2
+
3
+ Common usage patterns for checking console errors during development.
4
+
5
+ ## Example 1: Clean Console (Zero Errors)
6
+
7
+ **User Request:**
8
+ > "Check the console for errors"
9
+
10
+ **Skill Action:**
11
+
12
+ ```bash
13
+ pnpm sweetlink logs --filter error
14
+ ```
15
+
16
+ **Output:**
17
+
18
+ ```text
19
+ ✅ Console Check: CLEAN
20
+
21
+ Errors: 0
22
+ Warnings: 0
23
+ Last checked: 14:30:45
24
+
25
+ Application is running without console errors.
26
+ Zero-error policy maintained ✓
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Example 2: Errors Found After Changes
32
+
33
+ **User Request:**
34
+ > "I added a new feature, check for errors"
35
+
36
+ **Skill Action:**
37
+
38
+ ```bash
39
+ pnpm sweetlink logs --filter error
40
+ ```
41
+
42
+ **Output:**
43
+
44
+ ```typescript
45
+ ❌ Console Check: 3 ERRORS FOUND
46
+
47
+ ### Error 1:
48
+ [ERROR] TypeError: Cannot read property 'data' of undefined
49
+ File: src/components/Card.tsx:45
50
+ Time: 14:28:12.234
51
+ Stack: at Card.render (Card.tsx:45)
52
+
53
+ ### Error 2:
54
+ [ERROR] Failed to fetch: NetworkError
55
+ File: src/api/client.ts:89
56
+ Time: 14:28:13.891
57
+ Message: Network request failed
58
+
59
+ ### Error 3:
60
+ [ERROR] Hydration failed
61
+ File: src/pages/index.tsx:12
62
+ Time: 14:28:14.023
63
+ Details: Server: "Loading..." Client: "Data loaded"
64
+
65
+ ### Next Steps:
66
+ 1. Fix null check in Card.tsx (add optional chaining)
67
+ 2. Add error handling to API fetch
68
+ 3. Fix hydration by using useEffect for dynamic content
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Example 3: Before Committing
74
+
75
+ **User Request:**
76
+ > "I'm ready to commit, make sure there are no console errors"
77
+
78
+ **Skill Action:**
79
+
80
+ ```bash
81
+ # Check console
82
+ pnpm sweetlink logs --filter error
83
+ ```
84
+
85
+ **Output (Clean):**
86
+
87
+ ```text
88
+ ✅ Console Check: CLEAN
89
+
90
+ Pre-commit verification:
91
+ - Console errors: 0 ✓
92
+ - Warnings: 0 ✓
93
+ - Application state: Healthy ✓
94
+
95
+ Safe to commit!
96
+ ```
97
+
98
+ **Output (With Errors):**
99
+
100
+ ```text
101
+ ❌ Console Check: BLOCKED
102
+
103
+ Cannot commit - 2 console errors found:
104
+
105
+ 1. [ERROR] TypeError in Card component
106
+ 2. [ERROR] API fetch failed
107
+
108
+ Fix these errors before committing to maintain zero-error policy.
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Example 4: Debugging Workflow
114
+
115
+ **User Request:**
116
+ > "The page isn't loading correctly, debug it"
117
+
118
+ **Skill Action:**
119
+
120
+ ```bash
121
+ # Step 1: Check console
122
+ pnpm sweetlink logs --filter error
123
+
124
+ # Step 2: Get all logs for context
125
+ pnpm sweetlink logs
126
+ ```
127
+
128
+ **Output:**
129
+
130
+ ```text
131
+ 🔍 Debugging Console Analysis
132
+
133
+ ### Errors (2):
134
+ 1. [ERROR] Failed to fetch /api/data
135
+ Time: 14:25:10
136
+
137
+ 2. [ERROR] Cannot render: data is undefined
138
+ Time: 14:25:11
139
+
140
+ ### Recent Logs (context):
141
+ [INFO] Fetching data from API... (14:25:09)
142
+ [ERROR] Failed to fetch /api/data (14:25:10)
143
+ [WARN] Using fallback data (14:25:10)
144
+ [ERROR] Cannot render: data is undefined (14:25:11)
145
+
146
+ ### Root Cause Identified:
147
+ API fetch is failing → fallback data is undefined → render fails
148
+
149
+ ### Fix:
150
+ Add proper fallback data or loading state
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Example 5: After HMR Reload
156
+
157
+ **User Request:**
158
+ > "I just saved my changes, check the console"
159
+
160
+ **Skill Action:**
161
+
162
+ ```bash
163
+ # Wait 2 seconds for HMR
164
+ sleep 2
165
+
166
+ # Check console
167
+ pnpm sweetlink logs --filter error
168
+ ```
169
+
170
+ **Output:**
171
+
172
+ ```text
173
+ ✅ HMR Reload: Clean
174
+
175
+ Changes detected at 14:32:15
176
+ HMR completed at 14:32:17
177
+ Console errors: 0 ✓
178
+
179
+ Your changes loaded successfully with no errors!
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Example 6: Hydration Error Detection
185
+
186
+ **User Request:**
187
+ > "There's a hydration warning, what's causing it?"
188
+
189
+ **Skill Action:**
190
+
191
+ ```bash
192
+ pnpm sweetlink logs --filter hydration
193
+ ```
194
+
195
+ **Output:**
196
+
197
+ ```typescript
198
+ ⚠️ Hydration Issues Found
199
+
200
+ 1. [ERROR] Hydration failed because the initial UI does not match
201
+ Component: src/pages/dashboard.tsx:23
202
+ Time: 14:20:15.123
203
+
204
+ Server HTML: <div>Loading...</div>
205
+ Client HTML: <div>December 24, 2025</div>
206
+
207
+ Cause: Date() called during SSR creates different output on client
208
+
209
+ Fix: Use useEffect for client-only dynamic content
210
+ ```tsx
211
+ const [date, setDate] = useState('');
212
+ useEffect(() => {
213
+ setDate(new Date().toLocaleDateString());
214
+ }, []);
215
+ ```
216
+
217
+ ```yaml
218
+
219
+ ---
220
+
221
+ ## Example 7: Warning Triage
222
+
223
+ **User Request:**
224
+ > "Check for warnings too"
225
+
226
+ **Skill Action:**
227
+ ```bash
228
+ pnpm sweetlink logs --filter warning
229
+ ```
230
+
231
+ **Output:**
232
+
233
+ ```text
234
+ ⚠️ Console Warnings: 5 found
235
+
236
+ High Priority:
237
+ 1. [WARN] Each child in list should have unique key prop
238
+ File: src/components/List.tsx:34
239
+ Impact: Can cause rendering bugs
240
+
241
+ Medium Priority:
242
+ 2. [WARN] React does not recognize `customProp` on DOM element
243
+ File: src/components/Button.tsx:12
244
+ Impact: Console clutter
245
+
246
+ 3. [WARN] componentWillReceiveProps has been renamed
247
+ File: src/legacy/OldComponent.tsx:45
248
+ Impact: Deprecated API
249
+
250
+ Low Priority:
251
+ 4. [WARN] Missing alt attribute on img
252
+ File: src/components/Card.tsx:67
253
+ Impact: Accessibility
254
+
255
+ 5. [WARN] Unrecognized CSS property
256
+ File: src/styles/custom.css:23
257
+ Impact: Style won't apply
258
+
259
+ Recommendation: Fix high priority warnings before merge
260
+ ```
261
+
262
+ ---
263
+
264
+ ## Example 8: API Error Detection
265
+
266
+ **User Request:**
267
+ > "The data isn't loading, check console"
268
+
269
+ **Skill Action:**
270
+
271
+ ```bash
272
+ pnpm sweetlink logs --filter "fetch"
273
+ ```
274
+
275
+ **Output:**
276
+
277
+ ```markdown
278
+ 🌐 Network/Fetch Analysis
279
+
280
+ ### Fetch Errors (3):
281
+
282
+ 1. [ERROR] Failed to fetch: /api/users
283
+ Time: 14:15:22.123
284
+ Status: 500 Internal Server Error
285
+ Message: Database connection failed
286
+
287
+ 2. [ERROR] Failed to fetch: /api/posts
288
+ Time: 14:15:23.456
289
+ Status: 404 Not Found
290
+ Message: Endpoint does not exist
291
+
292
+ 3. [ERROR] Failed to fetch: /api/settings
293
+ Time: 14:15:24.789
294
+ Status: 401 Unauthorized
295
+ Message: Missing authentication token
296
+
297
+ ### Root Causes:
298
+ - Backend server error (500)
299
+ - Invalid API endpoint (404)
300
+ - Missing auth token (401)
301
+
302
+ ### Next Steps:
303
+ 1. Check backend logs for database issue
304
+ 2. Verify API route exists
305
+ 3. Add authentication token to request
306
+ ```
307
+
308
+ ---
309
+
310
+ ## Example 9: Zero-Error Enforcement
311
+
312
+ **Task Completion Check:**
313
+
314
+ ```bash
315
+ # Before marking task complete, enforce zero errors
316
+ pnpm sweetlink logs --filter error
317
+ ```
318
+
319
+ **Output (Passed):**
320
+
321
+ ```text
322
+ ✅ Task Completion: APPROVED
323
+
324
+ Console Check: PASSED ✓
325
+ - Errors: 0
326
+ - Warnings: 0
327
+ - Application: Stable
328
+
329
+ Task can be marked as complete.
330
+ Zero-error policy maintained.
331
+ ```
332
+
333
+ **Output (Failed):**
334
+
335
+ ```text
336
+ ❌ Task Completion: BLOCKED
337
+
338
+ Console Check: FAILED ✗
339
+ - Errors: 2
340
+ - Warnings: 1
341
+
342
+ Cannot mark task as complete until console is clean.
343
+ Fix errors and re-check.
344
+ ```
345
+
346
+ ---
347
+
348
+ ## Example 10: Integration with Complete Quality Check
349
+
350
+ **User Request:**
351
+ > "Run a complete quality check before deploying"
352
+
353
+ **Skill Action:**
354
+
355
+ ```bash
356
+ # 1. TypeScript check
357
+ pnpm run typecheck
358
+
359
+ # 2. Console errors check
360
+ pnpm sweetlink logs --filter error
361
+
362
+ # 3. Build check
363
+ pnpm run build
364
+ ```
365
+
366
+ **Output:**
367
+
368
+ ```markdown
369
+ 🎯 Complete Quality Check
370
+
371
+ 1. TypeScript Check: ✅ PASSED (0 errors)
372
+ 2. Console Check: ✅ PASSED (0 errors)
373
+ 3. Build Check: ✅ PASSED (built successfully)
374
+
375
+ ### Summary:
376
+ All quality gates passed ✓
377
+ - Type safety: Maintained
378
+ - Runtime errors: Zero
379
+ - Build: Successful
380
+
381
+ ✅ APPROVED FOR DEPLOYMENT
382
+ ```
383
+
384
+ ---
385
+
386
+ ## Best Practices Demonstrated
387
+
388
+ 1. **Check after every change** - Catch errors immediately
389
+ 2. **Use filters** - Focus on errors first, then warnings
390
+ 3. **Zero-error policy** - Don't accumulate technical debt
391
+ 4. **Integrated checks** - Combine with typecheck and builds
392
+ 5. **Root cause analysis** - Understand error context
393
+ 6. **Fix before commit** - Maintain code quality
394
+ 7. **HMR awareness** - Wait for reload before checking