vibe-and-thrive 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/.claude/commands/add-tests.md +240 -0
- package/.claude/commands/e2e-scaffold.md +212 -0
- package/.claude/commands/explain.md +110 -0
- package/.claude/commands/fix-types.md +238 -0
- package/.claude/commands/refactor.md +184 -0
- package/.claude/commands/review.md +136 -0
- package/.claude/commands/security-check.md +223 -0
- package/.claude/commands/styleguide.md +446 -0
- package/.claude/commands/tdd-feature.md +227 -0
- package/.claude/commands/vibe-check.md +112 -0
- package/.pre-commit-hooks.yaml +77 -0
- package/LICENSE +21 -0
- package/README.md +167 -0
- package/bin/vibe-check.js +19 -0
- package/dist/cli.d.ts +13 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +206 -0
- package/dist/cli.js.map +1 -0
- package/dist/eslint-plugin/index.d.ts +66 -0
- package/dist/eslint-plugin/index.d.ts.map +1 -0
- package/dist/eslint-plugin/index.js +67 -0
- package/dist/eslint-plugin/index.js.map +1 -0
- package/dist/eslint-plugin/rules/max-function-length.d.ts +8 -0
- package/dist/eslint-plugin/rules/max-function-length.d.ts.map +1 -0
- package/dist/eslint-plugin/rules/max-function-length.js +69 -0
- package/dist/eslint-plugin/rules/max-function-length.js.map +1 -0
- package/dist/eslint-plugin/rules/no-any-type.d.ts +8 -0
- package/dist/eslint-plugin/rules/no-any-type.d.ts.map +1 -0
- package/dist/eslint-plugin/rules/no-any-type.js +29 -0
- package/dist/eslint-plugin/rules/no-any-type.js.map +1 -0
- package/dist/eslint-plugin/rules/no-debug-statements.d.ts +8 -0
- package/dist/eslint-plugin/rules/no-debug-statements.d.ts.map +1 -0
- package/dist/eslint-plugin/rules/no-debug-statements.js +59 -0
- package/dist/eslint-plugin/rules/no-debug-statements.js.map +1 -0
- package/dist/eslint-plugin/rules/no-deep-nesting.d.ts +8 -0
- package/dist/eslint-plugin/rules/no-deep-nesting.d.ts.map +1 -0
- package/dist/eslint-plugin/rules/no-deep-nesting.js +56 -0
- package/dist/eslint-plugin/rules/no-deep-nesting.js.map +1 -0
- package/dist/eslint-plugin/rules/no-empty-catch.d.ts +8 -0
- package/dist/eslint-plugin/rules/no-empty-catch.d.ts.map +1 -0
- package/dist/eslint-plugin/rules/no-empty-catch.js +31 -0
- package/dist/eslint-plugin/rules/no-empty-catch.js.map +1 -0
- package/dist/eslint-plugin/rules/no-magic-numbers.d.ts +8 -0
- package/dist/eslint-plugin/rules/no-magic-numbers.d.ts.map +1 -0
- package/dist/eslint-plugin/rules/no-magic-numbers.js +58 -0
- package/dist/eslint-plugin/rules/no-magic-numbers.js.map +1 -0
- package/dist/eslint-plugin/rules/no-snake-case-props.d.ts +8 -0
- package/dist/eslint-plugin/rules/no-snake-case-props.d.ts.map +1 -0
- package/dist/eslint-plugin/rules/no-snake-case-props.js +48 -0
- package/dist/eslint-plugin/rules/no-snake-case-props.js.map +1 -0
- package/dist/hooks/check-any-types.d.ts +6 -0
- package/dist/hooks/check-any-types.d.ts.map +1 -0
- package/dist/hooks/check-any-types.js +73 -0
- package/dist/hooks/check-any-types.js.map +1 -0
- package/dist/hooks/check-commented-code.d.ts +6 -0
- package/dist/hooks/check-commented-code.d.ts.map +1 -0
- package/dist/hooks/check-commented-code.js +81 -0
- package/dist/hooks/check-commented-code.js.map +1 -0
- package/dist/hooks/check-console-error.d.ts +6 -0
- package/dist/hooks/check-console-error.d.ts.map +1 -0
- package/dist/hooks/check-console-error.js +41 -0
- package/dist/hooks/check-console-error.js.map +1 -0
- package/dist/hooks/check-debug-statements.d.ts +6 -0
- package/dist/hooks/check-debug-statements.d.ts.map +1 -0
- package/dist/hooks/check-debug-statements.js +120 -0
- package/dist/hooks/check-debug-statements.js.map +1 -0
- package/dist/hooks/check-deep-nesting.d.ts +6 -0
- package/dist/hooks/check-deep-nesting.d.ts.map +1 -0
- package/dist/hooks/check-deep-nesting.js +116 -0
- package/dist/hooks/check-deep-nesting.js.map +1 -0
- package/dist/hooks/check-docker-platform.d.ts +6 -0
- package/dist/hooks/check-docker-platform.d.ts.map +1 -0
- package/dist/hooks/check-docker-platform.js +42 -0
- package/dist/hooks/check-docker-platform.js.map +1 -0
- package/dist/hooks/check-dry-violations.d.ts +6 -0
- package/dist/hooks/check-dry-violations.d.ts.map +1 -0
- package/dist/hooks/check-dry-violations.js +124 -0
- package/dist/hooks/check-dry-violations.js.map +1 -0
- package/dist/hooks/check-empty-catch.d.ts +6 -0
- package/dist/hooks/check-empty-catch.d.ts.map +1 -0
- package/dist/hooks/check-empty-catch.js +111 -0
- package/dist/hooks/check-empty-catch.js.map +1 -0
- package/dist/hooks/check-function-length.d.ts +6 -0
- package/dist/hooks/check-function-length.d.ts.map +1 -0
- package/dist/hooks/check-function-length.js +152 -0
- package/dist/hooks/check-function-length.js.map +1 -0
- package/dist/hooks/check-hardcoded-urls.d.ts +6 -0
- package/dist/hooks/check-hardcoded-urls.d.ts.map +1 -0
- package/dist/hooks/check-hardcoded-urls.js +124 -0
- package/dist/hooks/check-hardcoded-urls.js.map +1 -0
- package/dist/hooks/check-magic-numbers.d.ts +6 -0
- package/dist/hooks/check-magic-numbers.d.ts.map +1 -0
- package/dist/hooks/check-magic-numbers.js +116 -0
- package/dist/hooks/check-magic-numbers.js.map +1 -0
- package/dist/hooks/check-secrets.d.ts +6 -0
- package/dist/hooks/check-secrets.d.ts.map +1 -0
- package/dist/hooks/check-secrets.js +138 -0
- package/dist/hooks/check-secrets.js.map +1 -0
- package/dist/hooks/check-snake-case-ts.d.ts +6 -0
- package/dist/hooks/check-snake-case-ts.d.ts.map +1 -0
- package/dist/hooks/check-snake-case-ts.js +78 -0
- package/dist/hooks/check-snake-case-ts.js.map +1 -0
- package/dist/hooks/check-todo-fixme.d.ts +6 -0
- package/dist/hooks/check-todo-fixme.d.ts.map +1 -0
- package/dist/hooks/check-todo-fixme.js +41 -0
- package/dist/hooks/check-todo-fixme.js.map +1 -0
- package/dist/hooks/check-unsafe-html.d.ts +6 -0
- package/dist/hooks/check-unsafe-html.d.ts.map +1 -0
- package/dist/hooks/check-unsafe-html.js +101 -0
- package/dist/hooks/check-unsafe-html.js.map +1 -0
- package/dist/hooks/index.d.ts +29 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +54 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/lint-staged/config.d.ts +20 -0
- package/dist/lint-staged/config.d.ts.map +1 -0
- package/dist/lint-staged/config.js +27 -0
- package/dist/lint-staged/config.js.map +1 -0
- package/dist/utils/file-reader.d.ts +24 -0
- package/dist/utils/file-reader.d.ts.map +1 -0
- package/dist/utils/file-reader.js +140 -0
- package/dist/utils/file-reader.js.map +1 -0
- package/dist/utils/patterns.d.ts +27 -0
- package/dist/utils/patterns.d.ts.map +1 -0
- package/dist/utils/patterns.js +84 -0
- package/dist/utils/patterns.js.map +1 -0
- package/dist/utils/reporters.d.ts +21 -0
- package/dist/utils/reporters.d.ts.map +1 -0
- package/dist/utils/reporters.js +115 -0
- package/dist/utils/reporters.js.map +1 -0
- package/dist/utils/types.d.ts +71 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +5 -0
- package/dist/utils/types.js.map +1 -0
- package/integrations/cursorrules.template +147 -0
- package/integrations/eslint.config.js +34 -0
- package/integrations/lint-staged.config.js +34 -0
- package/integrations/ruff.toml +125 -0
- package/integrations/vibe-check.yml +116 -0
- package/integrations/vscode-settings.json +127 -0
- package/package.json +81 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# Security Check
|
|
2
|
+
|
|
3
|
+
Check code for common security vulnerabilities (OWASP Top 10 and more).
|
|
4
|
+
|
|
5
|
+
## Instructions
|
|
6
|
+
|
|
7
|
+
When asked to do a security check:
|
|
8
|
+
|
|
9
|
+
### Scan for These Vulnerability Categories
|
|
10
|
+
|
|
11
|
+
#### 1. Injection (Critical)
|
|
12
|
+
- **SQL Injection**: String concatenation in queries
|
|
13
|
+
- **Command Injection**: User input in shell commands
|
|
14
|
+
- **LDAP Injection**: User input in LDAP queries
|
|
15
|
+
- **XPath Injection**: User input in XML queries
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
# VULNERABLE
|
|
19
|
+
query = f"SELECT * FROM users WHERE name = '{user_input}'"
|
|
20
|
+
|
|
21
|
+
# SAFE
|
|
22
|
+
query = "SELECT * FROM users WHERE name = %s"
|
|
23
|
+
cursor.execute(query, (user_input,))
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### 2. Broken Authentication (Critical)
|
|
27
|
+
- Hardcoded credentials
|
|
28
|
+
- Weak password requirements
|
|
29
|
+
- Missing rate limiting on login
|
|
30
|
+
- Insecure session management
|
|
31
|
+
- Missing MFA for sensitive operations
|
|
32
|
+
|
|
33
|
+
#### 3. Sensitive Data Exposure (Critical)
|
|
34
|
+
- Secrets in code (API keys, passwords)
|
|
35
|
+
- Sensitive data in logs
|
|
36
|
+
- Unencrypted data transmission
|
|
37
|
+
- Sensitive data in URLs
|
|
38
|
+
- Missing data encryption at rest
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
// VULNERABLE - logging sensitive data
|
|
42
|
+
console.log('User login:', { email, password });
|
|
43
|
+
|
|
44
|
+
// SAFE
|
|
45
|
+
console.log('User login:', { email, password: '[REDACTED]' });
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### 4. XML External Entities (XXE) (High)
|
|
49
|
+
- XML parsing without disabling external entities
|
|
50
|
+
- Accepting XML from untrusted sources
|
|
51
|
+
|
|
52
|
+
#### 5. Broken Access Control (Critical)
|
|
53
|
+
- Missing authorization checks
|
|
54
|
+
- IDOR (Insecure Direct Object References)
|
|
55
|
+
- Privilege escalation paths
|
|
56
|
+
- CORS misconfiguration
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
# VULNERABLE - no ownership check
|
|
60
|
+
def get_document(request, doc_id):
|
|
61
|
+
return Document.objects.get(id=doc_id)
|
|
62
|
+
|
|
63
|
+
# SAFE
|
|
64
|
+
def get_document(request, doc_id):
|
|
65
|
+
return Document.objects.get(id=doc_id, owner=request.user)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### 6. Security Misconfiguration (High)
|
|
69
|
+
- Debug mode in production
|
|
70
|
+
- Default credentials
|
|
71
|
+
- Unnecessary features enabled
|
|
72
|
+
- Missing security headers
|
|
73
|
+
- Verbose error messages
|
|
74
|
+
|
|
75
|
+
#### 7. Cross-Site Scripting (XSS) (High)
|
|
76
|
+
- Unescaped user content in HTML
|
|
77
|
+
- `innerHTML` with user data
|
|
78
|
+
- `dangerouslySetInnerHTML` without sanitization
|
|
79
|
+
- User data in JavaScript contexts
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
// VULNERABLE
|
|
83
|
+
element.innerHTML = userInput;
|
|
84
|
+
|
|
85
|
+
// SAFE
|
|
86
|
+
element.textContent = userInput;
|
|
87
|
+
// or with sanitization
|
|
88
|
+
element.innerHTML = DOMPurify.sanitize(userInput);
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### 8. Insecure Deserialization (High)
|
|
92
|
+
- Deserializing untrusted data
|
|
93
|
+
- Pickle with untrusted input (Python)
|
|
94
|
+
- eval() with user input
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
# VULNERABLE
|
|
98
|
+
data = pickle.loads(user_input)
|
|
99
|
+
|
|
100
|
+
# SAFE
|
|
101
|
+
data = json.loads(user_input)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### 9. Using Components with Known Vulnerabilities (Medium)
|
|
105
|
+
- Outdated dependencies
|
|
106
|
+
- Unpatched libraries
|
|
107
|
+
- Dependencies with known CVEs
|
|
108
|
+
|
|
109
|
+
#### 10. Insufficient Logging & Monitoring (Medium)
|
|
110
|
+
- Missing audit logs for sensitive operations
|
|
111
|
+
- No alerting on suspicious activity
|
|
112
|
+
- Logs without context for investigation
|
|
113
|
+
|
|
114
|
+
## Output Format
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
## Security Review: [filename or scope]
|
|
118
|
+
|
|
119
|
+
### Summary
|
|
120
|
+
[Overall security posture: Good/Needs Work/Critical Issues]
|
|
121
|
+
|
|
122
|
+
### Critical Vulnerabilities
|
|
123
|
+
These must be fixed immediately:
|
|
124
|
+
|
|
125
|
+
#### 1. [Vulnerability Name]
|
|
126
|
+
- **Location**: [file:line]
|
|
127
|
+
- **Type**: [OWASP category]
|
|
128
|
+
- **Risk**: [What an attacker could do]
|
|
129
|
+
- **Current Code**:
|
|
130
|
+
```
|
|
131
|
+
[vulnerable code]
|
|
132
|
+
```
|
|
133
|
+
- **Fix**:
|
|
134
|
+
```
|
|
135
|
+
[secure code]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### High-Risk Issues
|
|
139
|
+
These should be fixed before production:
|
|
140
|
+
|
|
141
|
+
#### 1. [Issue Name]
|
|
142
|
+
[Same format as above]
|
|
143
|
+
|
|
144
|
+
### Medium-Risk Issues
|
|
145
|
+
Address when possible:
|
|
146
|
+
|
|
147
|
+
#### 1. [Issue Name]
|
|
148
|
+
[Same format as above]
|
|
149
|
+
|
|
150
|
+
### Recommendations
|
|
151
|
+
1. [Security improvement suggestion]
|
|
152
|
+
2. [Security improvement suggestion]
|
|
153
|
+
|
|
154
|
+
### What's Good
|
|
155
|
+
[Acknowledge security measures already in place]
|
|
156
|
+
|
|
157
|
+
### Next Steps
|
|
158
|
+
- [ ] [Immediate action item]
|
|
159
|
+
- [ ] [Short-term action item]
|
|
160
|
+
- [ ] [Long-term action item]
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Quick Checks
|
|
164
|
+
|
|
165
|
+
Run these searches to find common issues:
|
|
166
|
+
|
|
167
|
+
### Injection
|
|
168
|
+
```
|
|
169
|
+
- SQL: "SELECT.*FROM.*" + variable
|
|
170
|
+
- Command: subprocess, exec, system, shell
|
|
171
|
+
- eval(), exec() with variables
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### XSS
|
|
175
|
+
```
|
|
176
|
+
- innerHTML =
|
|
177
|
+
- dangerouslySetInnerHTML
|
|
178
|
+
- document.write
|
|
179
|
+
- v-html
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Secrets
|
|
183
|
+
```
|
|
184
|
+
- password =
|
|
185
|
+
- api_key =
|
|
186
|
+
- secret =
|
|
187
|
+
- token =
|
|
188
|
+
- AKIA (AWS keys)
|
|
189
|
+
- sk- (Stripe/OpenAI keys)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Auth Issues
|
|
193
|
+
```
|
|
194
|
+
- # TODO: add auth
|
|
195
|
+
- # FIXME: check permissions
|
|
196
|
+
- @login_required missing
|
|
197
|
+
- no authorization check
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Security Review Modes
|
|
201
|
+
|
|
202
|
+
### Quick Scan
|
|
203
|
+
Check for obvious critical issues:
|
|
204
|
+
> "Quick security scan of the auth module"
|
|
205
|
+
|
|
206
|
+
### Full Audit
|
|
207
|
+
Comprehensive security review:
|
|
208
|
+
> "Full security audit of the API endpoints"
|
|
209
|
+
|
|
210
|
+
### Specific Check
|
|
211
|
+
Focus on one vulnerability type:
|
|
212
|
+
> "Check for SQL injection vulnerabilities"
|
|
213
|
+
|
|
214
|
+
### Dependency Audit
|
|
215
|
+
Check for vulnerable dependencies:
|
|
216
|
+
> "Check our dependencies for known vulnerabilities"
|
|
217
|
+
|
|
218
|
+
## Important Notes
|
|
219
|
+
|
|
220
|
+
- **Never commit fixes with example exploits**
|
|
221
|
+
- **Don't share specific vulnerability details publicly**
|
|
222
|
+
- **Report critical issues to appropriate team members**
|
|
223
|
+
- **Security is defense in depth - one fix isn't enough**
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
# Styleguide Generator
|
|
2
|
+
|
|
3
|
+
Generate a complete HTML/React styleguide page for your project based on your design preferences.
|
|
4
|
+
|
|
5
|
+
## Instructions
|
|
6
|
+
|
|
7
|
+
This skill creates a `/styleguide` route that displays all your UI components, making it easy for AI to understand and replicate your design system.
|
|
8
|
+
|
|
9
|
+
### Phase 1: Discovery
|
|
10
|
+
|
|
11
|
+
First, understand the project:
|
|
12
|
+
|
|
13
|
+
**Check the tech stack:**
|
|
14
|
+
- Look for `package.json` to identify the framework (React, Vue, Next.js, etc.)
|
|
15
|
+
- Check for existing styling solution (Tailwind, CSS Modules, styled-components, etc.)
|
|
16
|
+
- Find the components directory structure
|
|
17
|
+
- Look for any existing design tokens or theme files
|
|
18
|
+
|
|
19
|
+
**Check for existing components:**
|
|
20
|
+
- Search for `components/` or `src/components/`
|
|
21
|
+
- Look for existing Button, Input, Card components
|
|
22
|
+
- Note any UI library usage (shadcn, MUI, Chakra, etc.)
|
|
23
|
+
|
|
24
|
+
### Phase 2: Interview the User
|
|
25
|
+
|
|
26
|
+
Ask these questions to understand their design vision. Present them as a friendly conversation:
|
|
27
|
+
|
|
28
|
+
**1. "What's the vibe you're going for?"**
|
|
29
|
+
|
|
30
|
+
Offer examples:
|
|
31
|
+
- **Clean & Minimal** - Lots of whitespace, subtle shadows, muted colors
|
|
32
|
+
- **Bold & Vibrant** - Saturated colors, strong contrasts, energetic
|
|
33
|
+
- **Dark & Moody** - Dark backgrounds, neon accents, atmospheric
|
|
34
|
+
- **Soft & Friendly** - Rounded corners, pastels, warm feeling
|
|
35
|
+
- **Professional & Corporate** - Conservative, trustworthy, structured
|
|
36
|
+
- **Playful & Fun** - Bright colors, animations, personality
|
|
37
|
+
- **Neon Glass** - Glassmorphism, glows, futuristic
|
|
38
|
+
- **Other** - Let them describe it
|
|
39
|
+
|
|
40
|
+
**2. "What are your brand colors?"**
|
|
41
|
+
|
|
42
|
+
Ask for:
|
|
43
|
+
- **Primary color** - Main brand color (buttons, links, accents)
|
|
44
|
+
- **Secondary color** - Supporting color
|
|
45
|
+
- **Accent color** - For highlights and CTAs (optional)
|
|
46
|
+
|
|
47
|
+
If they don't have colors, suggest palettes based on their vibe:
|
|
48
|
+
- Clean: Blue (#3B82F6) + Gray
|
|
49
|
+
- Bold: Orange (#F97316) + Purple (#8B5CF6)
|
|
50
|
+
- Dark: Cyan (#06B6D4) + Purple (#A855F7)
|
|
51
|
+
- Soft: Pink (#EC4899) + Lavender (#A78BFA)
|
|
52
|
+
- Professional: Navy (#1E40AF) + Gold (#F59E0B)
|
|
53
|
+
|
|
54
|
+
**3. "Light mode, dark mode, or both?"**
|
|
55
|
+
|
|
56
|
+
- Light mode only
|
|
57
|
+
- Dark mode only
|
|
58
|
+
- Both (with toggle)
|
|
59
|
+
|
|
60
|
+
**4. "What's your border radius preference?"**
|
|
61
|
+
|
|
62
|
+
- **Sharp** - 0px (modern, editorial)
|
|
63
|
+
- **Subtle** - 4px (clean, professional)
|
|
64
|
+
- **Rounded** - 8px (friendly, approachable)
|
|
65
|
+
- **Pill** - 9999px for buttons (playful)
|
|
66
|
+
- **Mixed** - Rounded cards, pill buttons
|
|
67
|
+
|
|
68
|
+
**5. "Any specific components you need?"**
|
|
69
|
+
|
|
70
|
+
Common ones to include:
|
|
71
|
+
- Buttons (primary, secondary, ghost, destructive)
|
|
72
|
+
- Form inputs (text, select, checkbox, radio, toggle)
|
|
73
|
+
- Cards
|
|
74
|
+
- Modals/Dialogs
|
|
75
|
+
- Alerts/Toasts
|
|
76
|
+
- Navigation
|
|
77
|
+
- Tables
|
|
78
|
+
- Badges/Tags
|
|
79
|
+
|
|
80
|
+
### Phase 3: Generate the Styleguide
|
|
81
|
+
|
|
82
|
+
Create a styleguide page at `/styleguide` (or their preferred route).
|
|
83
|
+
|
|
84
|
+
**File structure for React/Next.js:**
|
|
85
|
+
```
|
|
86
|
+
src/
|
|
87
|
+
├── pages/styleguide.tsx (or app/styleguide/page.tsx for Next.js App Router)
|
|
88
|
+
└── styles/
|
|
89
|
+
└── design-tokens.css (optional CSS variables)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Include these sections:**
|
|
93
|
+
|
|
94
|
+
#### 1. Design Tokens
|
|
95
|
+
```tsx
|
|
96
|
+
<section id="tokens">
|
|
97
|
+
<h2>Design Tokens</h2>
|
|
98
|
+
|
|
99
|
+
{/* Colors */}
|
|
100
|
+
<div className="grid grid-cols-5 gap-4">
|
|
101
|
+
<div className="h-20 rounded-lg bg-primary" title="Primary" />
|
|
102
|
+
<div className="h-20 rounded-lg bg-secondary" title="Secondary" />
|
|
103
|
+
<div className="h-20 rounded-lg bg-accent" title="Accent" />
|
|
104
|
+
<div className="h-20 rounded-lg bg-background" title="Background" />
|
|
105
|
+
<div className="h-20 rounded-lg bg-foreground" title="Foreground" />
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
{/* Typography Scale */}
|
|
109
|
+
<div className="space-y-2 mt-8">
|
|
110
|
+
<p className="text-xs">xs - 12px</p>
|
|
111
|
+
<p className="text-sm">sm - 14px</p>
|
|
112
|
+
<p className="text-base">base - 16px</p>
|
|
113
|
+
<p className="text-lg">lg - 18px</p>
|
|
114
|
+
<p className="text-xl">xl - 20px</p>
|
|
115
|
+
<p className="text-2xl">2xl - 24px</p>
|
|
116
|
+
<p className="text-3xl">3xl - 30px</p>
|
|
117
|
+
<p className="text-4xl">4xl - 36px</p>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
{/* Spacing */}
|
|
121
|
+
<div className="flex items-end gap-2 mt-8">
|
|
122
|
+
<div className="w-1 h-1 bg-primary" title="1 - 4px" />
|
|
123
|
+
<div className="w-2 h-2 bg-primary" title="2 - 8px" />
|
|
124
|
+
<div className="w-3 h-3 bg-primary" title="3 - 12px" />
|
|
125
|
+
<div className="w-4 h-4 bg-primary" title="4 - 16px" />
|
|
126
|
+
<div className="w-6 h-6 bg-primary" title="6 - 24px" />
|
|
127
|
+
<div className="w-8 h-8 bg-primary" title="8 - 32px" />
|
|
128
|
+
</div>
|
|
129
|
+
</section>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### 2. Buttons
|
|
133
|
+
```tsx
|
|
134
|
+
<section id="buttons">
|
|
135
|
+
<h2>Buttons</h2>
|
|
136
|
+
|
|
137
|
+
{/* Variants */}
|
|
138
|
+
<div className="flex flex-wrap gap-4">
|
|
139
|
+
<Button variant="primary">Primary</Button>
|
|
140
|
+
<Button variant="secondary">Secondary</Button>
|
|
141
|
+
<Button variant="ghost">Ghost</Button>
|
|
142
|
+
<Button variant="destructive">Destructive</Button>
|
|
143
|
+
<Button variant="link">Link</Button>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
{/* Sizes */}
|
|
147
|
+
<div className="flex items-center gap-4 mt-4">
|
|
148
|
+
<Button size="sm">Small</Button>
|
|
149
|
+
<Button size="md">Medium</Button>
|
|
150
|
+
<Button size="lg">Large</Button>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
{/* States */}
|
|
154
|
+
<div className="flex flex-wrap gap-4 mt-4">
|
|
155
|
+
<Button>Default</Button>
|
|
156
|
+
<Button disabled>Disabled</Button>
|
|
157
|
+
<Button loading>Loading</Button>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
{/* With Icons */}
|
|
161
|
+
<div className="flex gap-4 mt-4">
|
|
162
|
+
<Button><PlusIcon /> Add Item</Button>
|
|
163
|
+
<Button>Next <ArrowRightIcon /></Button>
|
|
164
|
+
<Button size="icon"><SearchIcon /></Button>
|
|
165
|
+
</div>
|
|
166
|
+
</section>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### 3. Form Inputs
|
|
170
|
+
```tsx
|
|
171
|
+
<section id="forms">
|
|
172
|
+
<h2>Form Inputs</h2>
|
|
173
|
+
|
|
174
|
+
{/* Text Inputs */}
|
|
175
|
+
<div className="space-y-4 max-w-md">
|
|
176
|
+
<Input label="Default" placeholder="Enter text..." />
|
|
177
|
+
<Input label="With value" value="Hello world" />
|
|
178
|
+
<Input label="Disabled" disabled value="Can't edit" />
|
|
179
|
+
<Input label="With error" error="This field is required" />
|
|
180
|
+
<Input label="With helper" helper="We'll never share your email" />
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
{/* Select */}
|
|
184
|
+
<Select label="Choose option">
|
|
185
|
+
<option>Option 1</option>
|
|
186
|
+
<option>Option 2</option>
|
|
187
|
+
<option>Option 3</option>
|
|
188
|
+
</Select>
|
|
189
|
+
|
|
190
|
+
{/* Checkbox & Radio */}
|
|
191
|
+
<div className="space-y-2 mt-4">
|
|
192
|
+
<Checkbox label="Accept terms" />
|
|
193
|
+
<Checkbox label="Checked" checked />
|
|
194
|
+
<Checkbox label="Disabled" disabled />
|
|
195
|
+
</div>
|
|
196
|
+
|
|
197
|
+
{/* Toggle */}
|
|
198
|
+
<div className="flex gap-4 mt-4">
|
|
199
|
+
<Toggle label="Off" />
|
|
200
|
+
<Toggle label="On" checked />
|
|
201
|
+
</div>
|
|
202
|
+
</section>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### 4. Cards
|
|
206
|
+
```tsx
|
|
207
|
+
<section id="cards">
|
|
208
|
+
<h2>Cards</h2>
|
|
209
|
+
|
|
210
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
|
211
|
+
{/* Basic Card */}
|
|
212
|
+
<Card>
|
|
213
|
+
<CardHeader>
|
|
214
|
+
<CardTitle>Card Title</CardTitle>
|
|
215
|
+
<CardDescription>Card description goes here</CardDescription>
|
|
216
|
+
</CardHeader>
|
|
217
|
+
<CardContent>
|
|
218
|
+
<p>Card content with some text.</p>
|
|
219
|
+
</CardContent>
|
|
220
|
+
</Card>
|
|
221
|
+
|
|
222
|
+
{/* Card with Image */}
|
|
223
|
+
<Card>
|
|
224
|
+
<img src="/placeholder.jpg" className="w-full h-40 object-cover" />
|
|
225
|
+
<CardContent>
|
|
226
|
+
<h3>Image Card</h3>
|
|
227
|
+
<p>Card with image header</p>
|
|
228
|
+
</CardContent>
|
|
229
|
+
</Card>
|
|
230
|
+
|
|
231
|
+
{/* Interactive Card */}
|
|
232
|
+
<Card hover clickable>
|
|
233
|
+
<CardContent>
|
|
234
|
+
<h3>Interactive</h3>
|
|
235
|
+
<p>Hover and click states</p>
|
|
236
|
+
</CardContent>
|
|
237
|
+
</Card>
|
|
238
|
+
</div>
|
|
239
|
+
</section>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
#### 5. Feedback Components
|
|
243
|
+
```tsx
|
|
244
|
+
<section id="feedback">
|
|
245
|
+
<h2>Feedback</h2>
|
|
246
|
+
|
|
247
|
+
{/* Alerts */}
|
|
248
|
+
<div className="space-y-4">
|
|
249
|
+
<Alert variant="info">This is an info message</Alert>
|
|
250
|
+
<Alert variant="success">Success! Your changes were saved.</Alert>
|
|
251
|
+
<Alert variant="warning">Warning: This action cannot be undone.</Alert>
|
|
252
|
+
<Alert variant="error">Error: Something went wrong.</Alert>
|
|
253
|
+
</div>
|
|
254
|
+
|
|
255
|
+
{/* Badges */}
|
|
256
|
+
<div className="flex gap-2 mt-6">
|
|
257
|
+
<Badge>Default</Badge>
|
|
258
|
+
<Badge variant="success">Success</Badge>
|
|
259
|
+
<Badge variant="warning">Warning</Badge>
|
|
260
|
+
<Badge variant="error">Error</Badge>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
{/* Loading States */}
|
|
264
|
+
<div className="flex gap-4 mt-6">
|
|
265
|
+
<Spinner size="sm" />
|
|
266
|
+
<Spinner size="md" />
|
|
267
|
+
<Spinner size="lg" />
|
|
268
|
+
<Skeleton className="h-4 w-32" />
|
|
269
|
+
<Skeleton className="h-10 w-full" />
|
|
270
|
+
</div>
|
|
271
|
+
</section>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Phase 4: Generate Component Files
|
|
275
|
+
|
|
276
|
+
If components don't exist yet, create them based on the user's preferences.
|
|
277
|
+
|
|
278
|
+
**Example Button component (Tailwind + React):**
|
|
279
|
+
```tsx
|
|
280
|
+
// src/components/ui/Button.tsx
|
|
281
|
+
import { forwardRef } from 'react';
|
|
282
|
+
import { cn } from '@/lib/utils';
|
|
283
|
+
|
|
284
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
285
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'destructive' | 'link';
|
|
286
|
+
size?: 'sm' | 'md' | 'lg' | 'icon';
|
|
287
|
+
loading?: boolean;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
291
|
+
({ className, variant = 'primary', size = 'md', loading, children, disabled, ...props }, ref) => {
|
|
292
|
+
return (
|
|
293
|
+
<button
|
|
294
|
+
ref={ref}
|
|
295
|
+
disabled={disabled || loading}
|
|
296
|
+
className={cn(
|
|
297
|
+
// Base styles
|
|
298
|
+
'inline-flex items-center justify-center font-medium transition-colors',
|
|
299
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
|
|
300
|
+
'disabled:pointer-events-none disabled:opacity-50',
|
|
301
|
+
|
|
302
|
+
// Variants (customize based on user's vibe)
|
|
303
|
+
{
|
|
304
|
+
'bg-primary text-primary-foreground hover:bg-primary/90': variant === 'primary',
|
|
305
|
+
'bg-secondary text-secondary-foreground hover:bg-secondary/80': variant === 'secondary',
|
|
306
|
+
'hover:bg-accent hover:text-accent-foreground': variant === 'ghost',
|
|
307
|
+
'bg-destructive text-destructive-foreground hover:bg-destructive/90': variant === 'destructive',
|
|
308
|
+
'text-primary underline-offset-4 hover:underline': variant === 'link',
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
// Sizes
|
|
312
|
+
{
|
|
313
|
+
'h-8 px-3 text-sm rounded-md': size === 'sm',
|
|
314
|
+
'h-10 px-4 text-sm rounded-md': size === 'md',
|
|
315
|
+
'h-12 px-6 text-base rounded-lg': size === 'lg',
|
|
316
|
+
'h-10 w-10 rounded-md': size === 'icon',
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
className
|
|
320
|
+
)}
|
|
321
|
+
{...props}
|
|
322
|
+
>
|
|
323
|
+
{loading ? <Spinner className="mr-2" size="sm" /> : null}
|
|
324
|
+
{children}
|
|
325
|
+
</button>
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Phase 5: Add CSS Variables
|
|
332
|
+
|
|
333
|
+
Create design tokens as CSS variables for easy theming:
|
|
334
|
+
|
|
335
|
+
```css
|
|
336
|
+
/* src/styles/design-tokens.css */
|
|
337
|
+
:root {
|
|
338
|
+
/* Colors - Light Mode */
|
|
339
|
+
--color-primary: 59 130 246; /* blue-500 */
|
|
340
|
+
--color-secondary: 100 116 139; /* slate-500 */
|
|
341
|
+
--color-accent: 168 85 247; /* purple-500 */
|
|
342
|
+
--color-background: 255 255 255; /* white */
|
|
343
|
+
--color-foreground: 15 23 42; /* slate-900 */
|
|
344
|
+
--color-muted: 241 245 249; /* slate-100 */
|
|
345
|
+
--color-border: 226 232 240; /* slate-200 */
|
|
346
|
+
|
|
347
|
+
/* Feedback Colors */
|
|
348
|
+
--color-success: 34 197 94; /* green-500 */
|
|
349
|
+
--color-warning: 234 179 8; /* yellow-500 */
|
|
350
|
+
--color-error: 239 68 68; /* red-500 */
|
|
351
|
+
--color-info: 59 130 246; /* blue-500 */
|
|
352
|
+
|
|
353
|
+
/* Spacing */
|
|
354
|
+
--spacing-unit: 4px;
|
|
355
|
+
|
|
356
|
+
/* Border Radius */
|
|
357
|
+
--radius-sm: 4px;
|
|
358
|
+
--radius-md: 8px;
|
|
359
|
+
--radius-lg: 12px;
|
|
360
|
+
--radius-full: 9999px;
|
|
361
|
+
|
|
362
|
+
/* Shadows */
|
|
363
|
+
--shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
|
|
364
|
+
--shadow-md: 0 4px 6px rgb(0 0 0 / 0.1);
|
|
365
|
+
--shadow-lg: 0 10px 15px rgb(0 0 0 / 0.1);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/* Dark Mode */
|
|
369
|
+
.dark {
|
|
370
|
+
--color-background: 15 23 42; /* slate-900 */
|
|
371
|
+
--color-foreground: 248 250 252; /* slate-50 */
|
|
372
|
+
--color-muted: 30 41 59; /* slate-800 */
|
|
373
|
+
--color-border: 51 65 85; /* slate-700 */
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Phase 6: Update CLAUDE.md
|
|
378
|
+
|
|
379
|
+
Add the styleguide reference to the project's CLAUDE.md:
|
|
380
|
+
|
|
381
|
+
```markdown
|
|
382
|
+
## Design System
|
|
383
|
+
|
|
384
|
+
Reference `/styleguide` for all UI components and design tokens.
|
|
385
|
+
|
|
386
|
+
### Quick Reference
|
|
387
|
+
- Primary: [color]
|
|
388
|
+
- Border Radius: [preference]
|
|
389
|
+
- Mode: [light/dark/both]
|
|
390
|
+
|
|
391
|
+
### Components
|
|
392
|
+
Use components from `@/components/ui`:
|
|
393
|
+
- Button, Input, Select, Checkbox, Toggle
|
|
394
|
+
- Card, Alert, Badge, Modal
|
|
395
|
+
- All variants shown in /styleguide
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Vibe-Specific Templates
|
|
399
|
+
|
|
400
|
+
**Neon Glass:**
|
|
401
|
+
```tsx
|
|
402
|
+
// Dark background with glassmorphism
|
|
403
|
+
<div className="bg-black min-h-screen">
|
|
404
|
+
<Card className="
|
|
405
|
+
bg-white/5 backdrop-blur-xl
|
|
406
|
+
border border-white/10
|
|
407
|
+
shadow-[0_0_30px_rgba(0,255,255,0.1)]
|
|
408
|
+
">
|
|
409
|
+
<h2 className="text-transparent bg-clip-text bg-gradient-to-r from-cyan-400 to-purple-500">
|
|
410
|
+
Neon Glass
|
|
411
|
+
</h2>
|
|
412
|
+
</Card>
|
|
413
|
+
</div>
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**Clean & Minimal:**
|
|
417
|
+
```tsx
|
|
418
|
+
// Lots of whitespace, subtle shadows
|
|
419
|
+
<div className="bg-gray-50 min-h-screen p-12">
|
|
420
|
+
<Card className="bg-white shadow-sm border border-gray-100 rounded-lg">
|
|
421
|
+
<h2 className="text-gray-900 font-light tracking-tight">
|
|
422
|
+
Clean & Minimal
|
|
423
|
+
</h2>
|
|
424
|
+
</Card>
|
|
425
|
+
</div>
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
**Bold & Vibrant:**
|
|
429
|
+
```tsx
|
|
430
|
+
// Strong colors, high contrast
|
|
431
|
+
<div className="bg-gradient-to-br from-orange-500 to-pink-600 min-h-screen">
|
|
432
|
+
<Card className="bg-white rounded-2xl shadow-2xl">
|
|
433
|
+
<h2 className="text-3xl font-black text-gray-900">
|
|
434
|
+
Bold & Vibrant
|
|
435
|
+
</h2>
|
|
436
|
+
</Card>
|
|
437
|
+
</div>
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
## Notes
|
|
441
|
+
|
|
442
|
+
- Always create components that match the user's chosen vibe
|
|
443
|
+
- Include all states (hover, active, focus, disabled, loading)
|
|
444
|
+
- Make the styleguide itself match the design system
|
|
445
|
+
- Add code snippets so developers can copy usage examples
|
|
446
|
+
- Test in both light and dark mode if applicable
|