oxycode-skills 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.
- package/LICENSE +21 -0
- package/README.md +143 -0
- package/index.js +17 -0
- package/package.json +49 -0
- package/skills/anti-slop/README.md +106 -0
- package/skills/anti-slop/SKILL.md +311 -0
- package/skills/anti-slop/examples/before-after.md +380 -0
- package/skills/anti-slop/references/quality-rubric.md +313 -0
- package/skills/anti-slop/references/slop-patterns.md +433 -0
- package/skills/component-architect/README.md +186 -0
- package/skills/component-architect/SKILL.md +644 -0
- package/skills/component-architect/examples/component-patterns.md +569 -0
- package/skills/component-architect/references/atomic-design.md +516 -0
- package/skills/design-audit/README.md +114 -0
- package/skills/design-audit/SKILL.md +305 -0
- package/skills/design-audit/examples/audit-report.md +424 -0
- package/skills/design-audit/references/scoring-rubric.md +498 -0
- package/skills/design-md/README.md +106 -0
- package/skills/design-md/SKILL.md +262 -0
- package/skills/design-md/examples/bad-design.md +195 -0
- package/skills/design-md/examples/good-design.md +250 -0
- package/skills/design-md/references/design-md-spec.md +267 -0
- package/skills/design-md/scripts/validate.sh +134 -0
- package/skills/ui-builder/README.md +169 -0
- package/skills/ui-builder/SKILL.md +357 -0
- package/skills/ui-builder/examples/dashboard.md +323 -0
- package/skills/ui-builder/examples/landing-page.md +396 -0
- package/skills/ui-builder/references/component-patterns.md +396 -0
- package/skills/ui-builder/references/layout-system.md +423 -0
- package/skills/ui-builder/references/polish-checklist.md +221 -0
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
# AI Slop Patterns Catalog
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document catalogs common AI-generated UI patterns that look generic, unprofessional, or "AI-generated." Use this to detect and fix AI slop in your code.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Gradient Abuse
|
|
10
|
+
|
|
11
|
+
### Detection Patterns
|
|
12
|
+
```
|
|
13
|
+
bg-gradient-to-br
|
|
14
|
+
bg-gradient-to-r
|
|
15
|
+
bg-gradient-to-tl
|
|
16
|
+
bg-gradient-to-bl
|
|
17
|
+
from-purple-*
|
|
18
|
+
from-blue-*
|
|
19
|
+
from-violet-*
|
|
20
|
+
from-indigo-*
|
|
21
|
+
from-fuchsia-*
|
|
22
|
+
from-pink-*
|
|
23
|
+
to-purple-*
|
|
24
|
+
to-blue-*
|
|
25
|
+
to-violet-*
|
|
26
|
+
to-indigo-*
|
|
27
|
+
to-fuchsia-*
|
|
28
|
+
to-pink-*
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Examples
|
|
32
|
+
|
|
33
|
+
#### ❌ Bad: Purple Gradient Hero
|
|
34
|
+
```tsx
|
|
35
|
+
<div className="min-h-screen bg-gradient-to-br from-purple-900 via-blue-900 to-indigo-900">
|
|
36
|
+
<h1 className="text-6xl font-bold text-white text-center">Welcome</h1>
|
|
37
|
+
</div>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
#### ✅ Good: Solid Color Hero
|
|
41
|
+
```tsx
|
|
42
|
+
<div className="min-h-screen bg-zinc-950">
|
|
43
|
+
<h1 className="text-4xl font-semibold text-zinc-100">Welcome</h1>
|
|
44
|
+
</div>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Fix Rules
|
|
48
|
+
1. Replace `bg-gradient-to-*` with solid `bg-*`
|
|
49
|
+
2. Use zinc palette for backgrounds
|
|
50
|
+
3. Use semantic colors only for status (success, warning, error)
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 2. Centered Everything
|
|
55
|
+
|
|
56
|
+
### Detection Patterns
|
|
57
|
+
```
|
|
58
|
+
text-center
|
|
59
|
+
items-center justify-center
|
|
60
|
+
flex items-center justify-center
|
|
61
|
+
grid place-items-center
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Examples
|
|
65
|
+
|
|
66
|
+
#### ❌ Bad: Centered Layout
|
|
67
|
+
```tsx
|
|
68
|
+
<div className="min-h-screen flex items-center justify-center">
|
|
69
|
+
<div className="text-center max-w-2xl">
|
|
70
|
+
<h1 className="text-4xl font-bold text-center mb-4">Title</h1>
|
|
71
|
+
<p className="text-gray-500 text-center mb-8">Description</p>
|
|
72
|
+
<div className="flex justify-center">
|
|
73
|
+
<button>Click me</button>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### ✅ Good: Intentional Alignment
|
|
80
|
+
```tsx
|
|
81
|
+
<div className="min-h-screen flex items-center justify-center px-6">
|
|
82
|
+
<div className="max-w-2xl">
|
|
83
|
+
<h1 className="text-4xl font-semibold text-zinc-100">Title</h1>
|
|
84
|
+
<p className="mt-4 text-lg text-zinc-400">Description</p>
|
|
85
|
+
<div className="mt-8 flex items-center gap-4">
|
|
86
|
+
<button>Primary</button>
|
|
87
|
+
<button>Secondary</button>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Fix Rules
|
|
94
|
+
1. Text: Use `text-left` by default
|
|
95
|
+
2. Flex: Use `justify-start` unless centering is intentional
|
|
96
|
+
3. Grid: Use `place-items-start` unless centering is intentional
|
|
97
|
+
4. Only center when it makes design sense (hero sections, modals)
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 3. Rainbow Colors
|
|
102
|
+
|
|
103
|
+
### Detection Patterns
|
|
104
|
+
```
|
|
105
|
+
text-red-*
|
|
106
|
+
text-blue-*
|
|
107
|
+
text-green-*
|
|
108
|
+
text-purple-*
|
|
109
|
+
text-pink-*
|
|
110
|
+
text-yellow-*
|
|
111
|
+
text-orange-*
|
|
112
|
+
text-indigo-*
|
|
113
|
+
text-violet-*
|
|
114
|
+
text-fuchsia-*
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Examples
|
|
118
|
+
|
|
119
|
+
#### ❌ Bad: Rainbow Text
|
|
120
|
+
```tsx
|
|
121
|
+
<div>
|
|
122
|
+
<h1 className="text-purple-600">Purple Title</h1>
|
|
123
|
+
<p className="text-blue-500">Blue Description</p>
|
|
124
|
+
<span className="text-green-400">Green Badge</span>
|
|
125
|
+
<a className="text-pink-500">Pink Link</a>
|
|
126
|
+
</div>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### ✅ Good: Semantic Colors
|
|
130
|
+
```tsx
|
|
131
|
+
<div>
|
|
132
|
+
<h1 className="text-zinc-900">Title</h1>
|
|
133
|
+
<p className="text-zinc-500">Description</p>
|
|
134
|
+
<span className="text-green-600">Success</span>
|
|
135
|
+
<a className="text-zinc-600 hover:text-zinc-900">Link</a>
|
|
136
|
+
</div>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Fix Rules
|
|
140
|
+
1. Primary text: `text-zinc-900` (light) or `text-zinc-100` (dark)
|
|
141
|
+
2. Secondary text: `text-zinc-500` or `text-zinc-400`
|
|
142
|
+
3. Success: `text-green-600` only
|
|
143
|
+
4. Warning: `text-amber-600` only
|
|
144
|
+
5. Error: `text-red-600` only
|
|
145
|
+
6. Links: `text-zinc-600 hover:text-zinc-900`
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 4. Oversized Border Radius
|
|
150
|
+
|
|
151
|
+
### Detection Patterns
|
|
152
|
+
```
|
|
153
|
+
rounded-3xl
|
|
154
|
+
rounded-[2rem]
|
|
155
|
+
rounded-[24px]
|
|
156
|
+
rounded-full (on large elements)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Examples
|
|
160
|
+
|
|
161
|
+
#### ❌ Bad: Too Round
|
|
162
|
+
```tsx
|
|
163
|
+
<div className="bg-white p-8 rounded-3xl shadow-xl">
|
|
164
|
+
<button className="px-8 py-4 rounded-full text-lg">Click</button>
|
|
165
|
+
</div>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### ✅ Good: Subtle Radius
|
|
169
|
+
```tsx
|
|
170
|
+
<div className="bg-white border border-zinc-200 p-6 rounded-lg">
|
|
171
|
+
<button className="px-4 py-2 text-sm rounded-lg">Click</button>
|
|
172
|
+
</div>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Fix Rules
|
|
176
|
+
1. Cards: `rounded-lg` (8px)
|
|
177
|
+
2. Buttons: `rounded-lg` (8px)
|
|
178
|
+
3. Inputs: `rounded-lg` (8px)
|
|
179
|
+
4. Modals: `rounded-xl` (12px)
|
|
180
|
+
5. Badges: `rounded-full` (small elements only)
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 5. Inter Font Default
|
|
185
|
+
|
|
186
|
+
### Detection Patterns
|
|
187
|
+
```
|
|
188
|
+
font-sans (with Inter)
|
|
189
|
+
Inter, system-ui
|
|
190
|
+
fontFamily: 'Inter'
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Examples
|
|
194
|
+
|
|
195
|
+
#### ❌ Bad: Inter Default
|
|
196
|
+
```tsx
|
|
197
|
+
<div className="font-sans">
|
|
198
|
+
<h1 className="font-bold">Title</h1>
|
|
199
|
+
</div>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### ✅ Good: System Stack
|
|
203
|
+
```tsx
|
|
204
|
+
<div className="font-sans">
|
|
205
|
+
<h1 className="font-semibold">Title</h1>
|
|
206
|
+
</div>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Fix Rules
|
|
210
|
+
1. Use system font stack: `system-ui, -apple-system, sans-serif`
|
|
211
|
+
2. Or specify a different font: `font-['Inter']`
|
|
212
|
+
3. Don't rely on Inter as default
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 6. Generic Cards
|
|
217
|
+
|
|
218
|
+
### Detection Patterns
|
|
219
|
+
```
|
|
220
|
+
bg-white rounded-2xl shadow-xl
|
|
221
|
+
bg-white/10 backdrop-blur
|
|
222
|
+
bg-gradient-to-br from-white to-gray-50
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Examples
|
|
226
|
+
|
|
227
|
+
#### ❌ Bad: Generic Card
|
|
228
|
+
```tsx
|
|
229
|
+
<div className="bg-white p-8 rounded-2xl shadow-xl text-center">
|
|
230
|
+
<div className="w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-4">
|
|
231
|
+
<Icon className="w-8 h-8 text-purple-600" />
|
|
232
|
+
</div>
|
|
233
|
+
<h3 className="text-xl font-bold mb-2">Title</h3>
|
|
234
|
+
<p className="text-gray-500 mb-4">Description</p>
|
|
235
|
+
<button className="bg-purple-600 text-white px-6 py-2 rounded-full">Action</button>
|
|
236
|
+
</div>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### ✅ Good: Purposeful Card
|
|
240
|
+
```tsx
|
|
241
|
+
<div className="bg-white border border-zinc-200 p-6 rounded-lg">
|
|
242
|
+
<div className="w-10 h-10 bg-zinc-900 rounded-lg flex items-center justify-center">
|
|
243
|
+
<Icon className="w-5 h-5 text-white" />
|
|
244
|
+
</div>
|
|
245
|
+
<h3 className="mt-4 text-lg font-semibold text-zinc-900">Title</h3>
|
|
246
|
+
<p className="mt-2 text-sm text-zinc-500">Description</p>
|
|
247
|
+
<button className="mt-4 px-4 py-2 text-sm font-medium text-white bg-zinc-900 rounded-lg hover:bg-zinc-800">
|
|
248
|
+
Action
|
|
249
|
+
</button>
|
|
250
|
+
</div>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Fix Rules
|
|
254
|
+
1. Use borders instead of shadows: `border border-zinc-200`
|
|
255
|
+
2. Use `rounded-lg` not `rounded-2xl`
|
|
256
|
+
3. Use semantic colors not random colors
|
|
257
|
+
4. Left-align content by default
|
|
258
|
+
5. Use appropriate spacing
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## 7. Hover Effects Overkill
|
|
263
|
+
|
|
264
|
+
### Detection Patterns
|
|
265
|
+
```
|
|
266
|
+
hover:scale-105
|
|
267
|
+
hover:scale-110
|
|
268
|
+
hover:rotate-1
|
|
269
|
+
hover:shadow-2xl
|
|
270
|
+
hover:shadow-3xl
|
|
271
|
+
transition-all duration-500
|
|
272
|
+
transition-all duration-700
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Examples
|
|
276
|
+
|
|
277
|
+
#### ❌ Bad: Hover Overkill
|
|
278
|
+
```tsx
|
|
279
|
+
<button className="bg-purple-600 text-white px-6 py-3 rounded-full hover:scale-110 hover:shadow-xl transition-all duration-500">
|
|
280
|
+
Click me
|
|
281
|
+
</button>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### ✅ Good: Subtle Hover
|
|
285
|
+
```tsx
|
|
286
|
+
<button className="bg-zinc-900 text-white px-4 py-2 rounded-lg hover:bg-zinc-800 transition-colors">
|
|
287
|
+
Click me
|
|
288
|
+
</button>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Fix Rules
|
|
292
|
+
1. Use `transition-colors` not `transition-all`
|
|
293
|
+
2. Use `hover:bg-*` not `hover:scale-*`
|
|
294
|
+
3. Keep transitions fast (150-200ms)
|
|
295
|
+
4. No transform animations on buttons
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## 8. Fake Data
|
|
300
|
+
|
|
301
|
+
### Detection Patterns
|
|
302
|
+
```
|
|
303
|
+
Lorem ipsum
|
|
304
|
+
John Doe
|
|
305
|
+
johndoe@example.com
|
|
306
|
+
123-456-7890
|
|
307
|
+
Acme Corp
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Examples
|
|
311
|
+
|
|
312
|
+
#### ❌ Bad: Fake Data
|
|
313
|
+
```tsx
|
|
314
|
+
<div>
|
|
315
|
+
<h2>John Doe</h2>
|
|
316
|
+
<p>johndoe@example.com</p>
|
|
317
|
+
<p>123-456-7890</p>
|
|
318
|
+
</div>
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### ✅ Good: Realistic Data
|
|
322
|
+
```tsx
|
|
323
|
+
<div>
|
|
324
|
+
<h2>Sarah Chen</h2>
|
|
325
|
+
<p>sarah@acme.com</p>
|
|
326
|
+
<p>+1 (555) 234-5678</p>
|
|
327
|
+
</div>
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Fix Rules
|
|
331
|
+
1. Use realistic names
|
|
332
|
+
2. Use realistic emails
|
|
333
|
+
3. Use realistic phone numbers
|
|
334
|
+
4. Use realistic company names
|
|
335
|
+
5. Use realistic addresses
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## 9. Shadow Overuse
|
|
340
|
+
|
|
341
|
+
### Detection Patterns
|
|
342
|
+
```
|
|
343
|
+
shadow-xl
|
|
344
|
+
shadow-2xl
|
|
345
|
+
shadow-3xl
|
|
346
|
+
hover:shadow-xl
|
|
347
|
+
hover:shadow-2xl
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Examples
|
|
351
|
+
|
|
352
|
+
#### ❌ Bad: Shadow Overuse
|
|
353
|
+
```tsx
|
|
354
|
+
<div className="bg-white p-6 rounded-2xl shadow-2xl">
|
|
355
|
+
<button className="shadow-xl hover:shadow-2xl">Click</button>
|
|
356
|
+
</div>
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
#### ✅ Good: Subtle Shadows
|
|
360
|
+
```tsx
|
|
361
|
+
<div className="bg-white border border-zinc-200 p-6 rounded-lg">
|
|
362
|
+
<button>Click</button>
|
|
363
|
+
</div>
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Fix Rules
|
|
367
|
+
1. Cards: Use `border` not `shadow`
|
|
368
|
+
2. Buttons: No shadow
|
|
369
|
+
3. Modals: `shadow-lg` max
|
|
370
|
+
4. Dropdowns: `shadow-lg`
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## 10. Backdrop Blur Abuse
|
|
375
|
+
|
|
376
|
+
### Detection Patterns
|
|
377
|
+
```
|
|
378
|
+
backdrop-blur
|
|
379
|
+
backdrop-blur-sm
|
|
380
|
+
backdrop-blur-md
|
|
381
|
+
backdrop-blur-lg
|
|
382
|
+
backdrop-blur-xl
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Examples
|
|
386
|
+
|
|
387
|
+
#### ❌ Bad: Backdrop Blur
|
|
388
|
+
```tsx
|
|
389
|
+
<div className="bg-white/10 backdrop-blur-xl border border-white/20 rounded-2xl">
|
|
390
|
+
Content
|
|
391
|
+
</div>
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
#### ✅ Good: Solid Background
|
|
395
|
+
```tsx
|
|
396
|
+
<div className="bg-zinc-900 border border-zinc-800 rounded-lg">
|
|
397
|
+
Content
|
|
398
|
+
</div>
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Fix Rules
|
|
402
|
+
1. Use solid backgrounds
|
|
403
|
+
2. Avoid glassmorphism unless intentional
|
|
404
|
+
3. Use opacity sparingly
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## Quality Score Calculation
|
|
409
|
+
|
|
410
|
+
```
|
|
411
|
+
Starting Score: 100
|
|
412
|
+
|
|
413
|
+
Deductions:
|
|
414
|
+
- Gradient pattern: -15 points
|
|
415
|
+
- Centered everything: -10 points
|
|
416
|
+
- Rainbow colors: -10 points
|
|
417
|
+
- Oversized radius: -10 points
|
|
418
|
+
- Inter font default: -5 points
|
|
419
|
+
- Generic cards: -10 points
|
|
420
|
+
- Hover overkill: -10 points
|
|
421
|
+
- Fake data: -5 points
|
|
422
|
+
- Shadow overuse: -10 points
|
|
423
|
+
- Backdrop blur abuse: -10 points
|
|
424
|
+
|
|
425
|
+
Minimum Score: 0
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### Score Interpretation
|
|
429
|
+
- **90-100**: Vercel-quality, production-ready
|
|
430
|
+
- **70-89**: Good, minor improvements needed
|
|
431
|
+
- **50-69**: Average, several AI slop patterns
|
|
432
|
+
- **30-49**: Poor, many AI patterns present
|
|
433
|
+
- **0-29**: Terrible, pure AI slop
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# component-architect Skill
|
|
2
|
+
|
|
3
|
+
> Design scalable component architectures using atomic design patterns, compound components, and composition over configuration.
|
|
4
|
+
|
|
5
|
+
## What Does This Skill Do?
|
|
6
|
+
|
|
7
|
+
The `component-architect` skill teaches AI coding agents to:
|
|
8
|
+
1. **Structure** components using atomic design (atoms → molecules → organisms → templates → pages)
|
|
9
|
+
2. **Design** compound components for complex UI
|
|
10
|
+
3. **Apply** composition over configuration patterns
|
|
11
|
+
4. **Extract** logic into custom hooks
|
|
12
|
+
5. **Separate** concerns properly
|
|
13
|
+
|
|
14
|
+
## Why Use This Skill?
|
|
15
|
+
|
|
16
|
+
- **Prevents 800-line components** - Small, focused components
|
|
17
|
+
- **Promotes reusability** - Build once, use everywhere
|
|
18
|
+
- **Improves maintainability** - Easy to update and refactor
|
|
19
|
+
- **Scales with team** - Clear patterns for growth
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### Design a Component System
|
|
24
|
+
```bash
|
|
25
|
+
/component-architect "Design a component system for a dashboard"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Refactor Large Components
|
|
29
|
+
```bash
|
|
30
|
+
/component-architect "Refactor this 500-line component"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Create Compound Components
|
|
34
|
+
```bash
|
|
35
|
+
/component-architect "Create a compound Tabs component"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- ✅ Atomic design methodology
|
|
41
|
+
- ✅ Compound components
|
|
42
|
+
- ✅ Composition patterns
|
|
43
|
+
- ✅ Custom hooks extraction
|
|
44
|
+
- ✅ Concern separation
|
|
45
|
+
- ✅ TypeScript types
|
|
46
|
+
- ✅ Documentation generation
|
|
47
|
+
|
|
48
|
+
## File Structure
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
skills/component-architect/
|
|
52
|
+
├── SKILL.md # Main skill instructions
|
|
53
|
+
├── README.md # This file
|
|
54
|
+
├── references/
|
|
55
|
+
│ └── atomic-design.md # Atomic design methodology
|
|
56
|
+
└── examples/
|
|
57
|
+
└── component-patterns.md # Common patterns
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Atomic Design Levels
|
|
61
|
+
|
|
62
|
+
### 1. Atoms (Basic Building Blocks)
|
|
63
|
+
- Button, Input, Badge, Icon
|
|
64
|
+
- Cannot be broken down further
|
|
65
|
+
- Reusable across the interface
|
|
66
|
+
|
|
67
|
+
### 2. Molecules (Groups of Atoms)
|
|
68
|
+
- Form field, Card, Nav item
|
|
69
|
+
- Combinations of atoms
|
|
70
|
+
- Simple UI components
|
|
71
|
+
|
|
72
|
+
### 3. Organisms (Complex Components)
|
|
73
|
+
- Header, Sidebar, Data table
|
|
74
|
+
- Composed of molecules/atoms
|
|
75
|
+
- Distinct sections of interface
|
|
76
|
+
|
|
77
|
+
### 4. Templates (Page Layouts)
|
|
78
|
+
- Dashboard, Landing, Auth
|
|
79
|
+
- Define page structure
|
|
80
|
+
- Place components in layout
|
|
81
|
+
|
|
82
|
+
### 5. Pages (Specific Instances)
|
|
83
|
+
- Home, Settings, Profile
|
|
84
|
+
- Real data instances
|
|
85
|
+
- End-user facing
|
|
86
|
+
|
|
87
|
+
## Component Patterns
|
|
88
|
+
|
|
89
|
+
### Compound Components
|
|
90
|
+
```tsx
|
|
91
|
+
<Tabs>
|
|
92
|
+
<Tabs.List>
|
|
93
|
+
<Tabs.Trigger value="tab1">Tab 1</Tabs.Trigger>
|
|
94
|
+
</Tabs.List>
|
|
95
|
+
<Tabs.Content value="tab1">Content</Tabs.Content>
|
|
96
|
+
</Tabs>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Render Props
|
|
100
|
+
```tsx
|
|
101
|
+
<DataList items={items}>
|
|
102
|
+
{(item) => <DataList.Item>{item.name}</DataList.Item>}
|
|
103
|
+
</DataList>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Custom Hooks
|
|
107
|
+
```tsx
|
|
108
|
+
function useToggle() {
|
|
109
|
+
const [value, setValue] = useState(false)
|
|
110
|
+
const toggle = () => setValue(v => !v)
|
|
111
|
+
return { value, toggle }
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Higher-Order Components
|
|
116
|
+
```tsx
|
|
117
|
+
const withLoading = (Component) => ({ isLoading, ...props }) =>
|
|
118
|
+
isLoading ? <Spinner /> : <Component {...props} />
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Context Providers
|
|
122
|
+
```tsx
|
|
123
|
+
<ThemeProvider>
|
|
124
|
+
<App />
|
|
125
|
+
</ThemeProvider>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Anti-Patterns
|
|
129
|
+
|
|
130
|
+
### ❌ 800-Line Components
|
|
131
|
+
```tsx
|
|
132
|
+
// BAD: One giant component
|
|
133
|
+
function Dashboard() {
|
|
134
|
+
// 800 lines of code
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### ✅ Split Into Smaller Components
|
|
139
|
+
```tsx
|
|
140
|
+
// GOOD: Split by concern
|
|
141
|
+
function Dashboard() {
|
|
142
|
+
return (
|
|
143
|
+
<DashboardLayout>
|
|
144
|
+
<DashboardHeader />
|
|
145
|
+
<DashboardStats />
|
|
146
|
+
<DashboardTable />
|
|
147
|
+
</DashboardLayout>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### ❌ Configuration Overload
|
|
153
|
+
```tsx
|
|
154
|
+
// BAD: Too many props
|
|
155
|
+
<Component
|
|
156
|
+
prop1={value1}
|
|
157
|
+
prop2={value2}
|
|
158
|
+
prop3={value3}
|
|
159
|
+
prop4={value4}
|
|
160
|
+
prop5={value5}
|
|
161
|
+
/>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### ✅ Composition
|
|
165
|
+
```tsx
|
|
166
|
+
// GOOD: Compose components
|
|
167
|
+
<Component>
|
|
168
|
+
<Component.Header>Header</Component.Header>
|
|
169
|
+
<Component.Content>Content</Component.Content>
|
|
170
|
+
<Component.Footer>Footer</Component.Footer>
|
|
171
|
+
</Component>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Examples
|
|
175
|
+
|
|
176
|
+
See [examples/component-patterns.md](examples/component-patterns.md) for common patterns.
|
|
177
|
+
|
|
178
|
+
## Resources
|
|
179
|
+
|
|
180
|
+
- [Atomic Design](https://atomicdesign.bradfrost.com/)
|
|
181
|
+
- [React Patterns](https://reactpatterns.com/)
|
|
182
|
+
- [ui.shadcn.com](https://ui.shadcn.com/)
|
|
183
|
+
|
|
184
|
+
## Contributing
|
|
185
|
+
|
|
186
|
+
See [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines.
|