@ytspar/sweetlink 1.15.0 → 1.16.1

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,35 @@
1
+ {
2
+ "skill_name": "console-check-sweetlink",
3
+ "evals": [
4
+ {
5
+ "id": 1,
6
+ "prompt": "Check the browser console for errors",
7
+ "expected_output": "The skill uses Sweetlink to connect to the browser and retrieve console logs",
8
+ "expectations": [
9
+ "Uses Sweetlink WebSocket or logs command to read browser console",
10
+ "Filters for errors and warnings",
11
+ "Reports any console errors found or confirms zero errors"
12
+ ]
13
+ },
14
+ {
15
+ "id": 2,
16
+ "prompt": "Any console errors after my changes?",
17
+ "expected_output": "The skill checks the browser console for new errors via Sweetlink",
18
+ "expectations": [
19
+ "Triggers the console check flow via Sweetlink",
20
+ "Reports errors, warnings, or confirms clean console",
21
+ "Does not run TypeScript or lint checks"
22
+ ]
23
+ },
24
+ {
25
+ "id": 3,
26
+ "prompt": "Check for TypeScript errors",
27
+ "expected_output": "This should NOT trigger console-check-sweetlink. TypeScript errors are handled by quick-typecheck.",
28
+ "expectations": [
29
+ "Does NOT trigger console-check-sweetlink skill",
30
+ "Routes to quick-typecheck instead",
31
+ "No Sweetlink or browser commands are executed"
32
+ ]
33
+ }
34
+ ]
35
+ }