@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,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
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: resize-for-claude
3
+ description: Resize images for optimal Claude vision consumption. Scales images so the longest side is ≤1568px. Splits very tall images (3:1+ ratio) into overlapping tiles. Use when preparing screenshots, mockups, or design files for Claude analysis.
4
+ allowed-tools: Bash, Read
5
+ ---
6
+
7
+ # Resize for Claude Skill
8
+
9
+ Resize images to optimal dimensions for Claude's vision capabilities. Claude processes images best when the longest side is ≤1568px. This skill handles both standard images and very tall images (full-page mockups, long screenshots) by splitting them into readable tiles.
10
+
11
+ ## When to Use
12
+
13
+ - Preparing large screenshots or mockups for Claude to analyze
14
+ - Resizing Figma exports before feeding them to Claude
15
+ - Processing any image that's too large for efficient Claude vision consumption
16
+ - User asks to "resize for Claude" or "optimize image for Claude"
17
+
18
+ ## How It Works
19
+
20
+ The script at `scripts/resize-for-claude` (in the tools repo):
21
+
22
+ 1. Reads the image dimensions
23
+ 2. If the image aspect ratio is < 3:1, resizes proportionally so the longest side = 1568px
24
+ 3. If the image is very tall (≥ 3:1 height:width), splits into overlapping tiles before resizing each
25
+ 4. Outputs to a `<filename>-claude/` directory next to the original
26
+
27
+ ### Claude Vision Limits
28
+
29
+ | Property | Optimal | Maximum |
30
+ |----------|---------|---------|
31
+ | Longest side | ≤1568px | 8000px |
32
+ | File size | <1MB | 20MB |
33
+ | Aspect ratio | ≤2:1 | - |
34
+
35
+ Images exceeding these dimensions get downscaled by Claude anyway, wasting tokens on pixels that are thrown away.
36
+
37
+ ## Usage
38
+
39
+ ```bash
40
+ # Find the script (works from any project linked to tools)
41
+ TOOLS_ROOT="$(readlink -f .claude/skills/../../)"
42
+
43
+ # Basic usage — resize to 1568px longest side
44
+ "$TOOLS_ROOT/scripts/resize-for-claude" ~/Downloads/mockup.jpg
45
+
46
+ # Custom max side
47
+ "$TOOLS_ROOT/scripts/resize-for-claude" ~/Downloads/mockup.png 1200
48
+ ```
49
+
50
+ ### Direct invocation (if you know the tools path)
51
+
52
+ ```bash
53
+ $TOOLS_ROOT/scripts/resize-for-claude ~/Downloads/image.jpg
54
+ ```
55
+
56
+ ## Output
57
+
58
+ **Standard image (< 3:1 ratio):**
59
+
60
+ ```text
61
+ Input: ~/Downloads/mockup.jpg
62
+ Size: 5120x11732 (2881KB)
63
+
64
+ Output: ~/Downloads/mockup-claude/mockup.jpg
65
+ Size: 684x1568 (84KB)
66
+ ```
67
+
68
+ **Very tall image (≥ 3:1 ratio):**
69
+
70
+ ```text
71
+ Input: ~/Downloads/full-page.png
72
+ Size: 1440x8640 (4200KB)
73
+
74
+ Image is very tall (6:1 ratio). Splitting into tiles...
75
+ Part 1: 1440x1568 (180KB) -> ~/Downloads/full-page-claude/full-page-part1.png
76
+ Part 2: 1440x1568 (165KB) -> ~/Downloads/full-page-claude/full-page-part2.png
77
+ Part 3: 1440x1568 (172KB) -> ~/Downloads/full-page-claude/full-page-part3.png
78
+
79
+ Output: ~/Downloads/full-page-claude/ (3 parts)
80
+ ```
81
+
82
+ ## Requirements
83
+
84
+ - macOS (uses `sips` — the built-in macOS image processing tool)
85
+
86
+ ## After Resizing
87
+
88
+ Use the Read tool to view the resized image(s):
89
+
90
+ ```bash
91
+ # Single image
92
+ Read ~/Downloads/mockup-claude/mockup.jpg
93
+
94
+ # Tiled parts — read each sequentially
95
+ Read ~/Downloads/full-page-claude/full-page-part1.png
96
+ Read ~/Downloads/full-page-claude/full-page-part2.png
97
+ ```
@@ -0,0 +1,23 @@
1
+ {
2
+ "skill_name": "resize-for-claude",
3
+ "evals": [
4
+ {
5
+ "id": 1,
6
+ "prompt": "This Figma export is 5120x11732 pixels, resize it so Claude can analyze it properly",
7
+ "expected_output": "Triggers resize-for-claude skill to scale the image down so the longest side is 1568px",
8
+ "expectations": ["Should trigger resize-for-claude skill", "Should run the resize-for-claude script", "Should detect tall aspect ratio and split into overlapping tiles if >= 3:1"]
9
+ },
10
+ {
11
+ "id": 2,
12
+ "prompt": "Optimize this full-page screenshot for Claude vision before I ask it to review the design",
13
+ "expected_output": "Triggers resize-for-claude skill to resize and potentially tile a tall screenshot",
14
+ "expectations": ["Should trigger resize-for-claude skill", "Should output to a -claude/ directory next to the original", "Should produce images with longest side <= 1568px"]
15
+ },
16
+ {
17
+ "id": 3,
18
+ "prompt": "Take a screenshot of the homepage at mobile, tablet, and desktop viewports",
19
+ "expected_output": "Should NOT trigger resize-for-claude - this is about capturing responsive screenshots, not resizing existing images",
20
+ "expectations": ["Should NOT trigger resize-for-claude - use responsive-screenshots for capturing at multiple viewports"]
21
+ }
22
+ ]
23
+ }