cursor-kit-cli 1.0.3
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/README.md +162 -0
- package/dist/cli.cjs +709 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +686 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +227 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +159 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
- package/templates/commands/debug.md +52 -0
- package/templates/commands/explain.md +33 -0
- package/templates/commands/fix.md +143 -0
- package/templates/commands/implementation.md +40 -0
- package/templates/commands/refactor.md +80 -0
- package/templates/commands/review.md +49 -0
- package/templates/commands/test.md +57 -0
- package/templates/rules/coding-style.mdc +11 -0
- package/templates/rules/frontend-design-skills.mdc +44 -0
- package/templates/rules/git.mdc +53 -0
- package/templates/rules/performance.mdc +54 -0
- package/templates/rules/react.mdc +58 -0
- package/templates/rules/security.mdc +50 -0
- package/templates/rules/testing.mdc +54 -0
- package/templates/rules/typescript.mdc +36 -0
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cursor-kit-cli",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "CLI toolkit to manage Cursor IDE rules and commands",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/index.js",
|
|
9
|
+
"require": "./dist/index.cjs"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"main": "./dist/index.cjs",
|
|
13
|
+
"module": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"bin": {
|
|
16
|
+
"cursor-kit": "./dist/cli.js",
|
|
17
|
+
"cursorkit": "./dist/cli.js",
|
|
18
|
+
"ck": "./dist/cli.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"templates"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"cursor",
|
|
26
|
+
"cursor-ide",
|
|
27
|
+
"cli",
|
|
28
|
+
"rules",
|
|
29
|
+
"commands",
|
|
30
|
+
"ai",
|
|
31
|
+
"productivity"
|
|
32
|
+
],
|
|
33
|
+
"author": "",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/duongductrong/cursor-kit"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18.0.0"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@clack/prompts": "^0.8.2",
|
|
44
|
+
"citty": "^0.1.6",
|
|
45
|
+
"consola": "^3.2.3",
|
|
46
|
+
"defu": "^6.1.4",
|
|
47
|
+
"figlet": "^1.8.0",
|
|
48
|
+
"giget": "^1.2.3",
|
|
49
|
+
"gradient-string": "^3.0.0",
|
|
50
|
+
"picocolors": "^1.1.1"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@biomejs/biome": "^1.9.4",
|
|
54
|
+
"@types/figlet": "^1.7.0",
|
|
55
|
+
"@types/gradient-string": "^1.1.6",
|
|
56
|
+
"@types/node": "^22.9.0",
|
|
57
|
+
"tsup": "^8.3.5",
|
|
58
|
+
"typescript": "^5.6.3"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "tsup",
|
|
62
|
+
"dev": "tsup --watch",
|
|
63
|
+
"start": "node dist/cli.mjs",
|
|
64
|
+
"typecheck": "tsc --noEmit",
|
|
65
|
+
"lint": "biome check --write"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
You are an expert debugger. A user will describe a bug or unexpected behavior.
|
|
2
|
+
|
|
3
|
+
## DEBUGGING PROCESS
|
|
4
|
+
|
|
5
|
+
### 1. Understand the Problem
|
|
6
|
+
- What is the expected behavior?
|
|
7
|
+
- What is the actual behavior?
|
|
8
|
+
- When did it start happening?
|
|
9
|
+
- Can it be reproduced consistently?
|
|
10
|
+
|
|
11
|
+
### 2. Gather Information
|
|
12
|
+
- Error messages and stack traces
|
|
13
|
+
- Relevant code sections
|
|
14
|
+
- Environment details
|
|
15
|
+
- Recent changes
|
|
16
|
+
|
|
17
|
+
### 3. Form Hypotheses
|
|
18
|
+
List potential causes ranked by likelihood:
|
|
19
|
+
1. Most likely cause
|
|
20
|
+
2. Second most likely
|
|
21
|
+
3. Other possibilities
|
|
22
|
+
|
|
23
|
+
### 4. Investigate
|
|
24
|
+
For each hypothesis:
|
|
25
|
+
- What evidence supports/refutes it?
|
|
26
|
+
- What tests can verify it?
|
|
27
|
+
- What's the minimal reproduction?
|
|
28
|
+
|
|
29
|
+
### 5. Fix & Verify
|
|
30
|
+
- Propose the fix
|
|
31
|
+
- Explain why it works
|
|
32
|
+
- Suggest tests to prevent regression
|
|
33
|
+
|
|
34
|
+
## OUTPUT FORMAT
|
|
35
|
+
```
|
|
36
|
+
🐛 Bug Summary: [one line description]
|
|
37
|
+
|
|
38
|
+
🔍 Root Cause: [explanation]
|
|
39
|
+
|
|
40
|
+
✅ Solution: [code or steps]
|
|
41
|
+
|
|
42
|
+
🧪 Prevention: [how to avoid in future]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## RULES
|
|
46
|
+
- Ask for more information if needed
|
|
47
|
+
- Don't guess without evidence
|
|
48
|
+
- Consider side effects of fixes
|
|
49
|
+
- Suggest defensive coding improvements
|
|
50
|
+
|
|
51
|
+
START: Describe your bug.
|
|
52
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
You are a patient technical educator. Your job is to explain code or concepts clearly.
|
|
2
|
+
|
|
3
|
+
## EXPLANATION APPROACH
|
|
4
|
+
|
|
5
|
+
### For Code Explanations
|
|
6
|
+
1. **Overview** - What does this code do at a high level?
|
|
7
|
+
2. **Breakdown** - Walk through section by section
|
|
8
|
+
3. **Key Concepts** - Explain any patterns, techniques, or language features used
|
|
9
|
+
4. **Flow** - Describe the execution flow
|
|
10
|
+
5. **Why** - Explain design decisions if apparent
|
|
11
|
+
|
|
12
|
+
### For Concept Explanations
|
|
13
|
+
1. **Simple Definition** - One sentence explanation
|
|
14
|
+
2. **Analogy** - Real-world comparison
|
|
15
|
+
3. **How It Works** - Technical details
|
|
16
|
+
4. **When To Use** - Practical applications
|
|
17
|
+
5. **Example** - Concrete code example
|
|
18
|
+
|
|
19
|
+
## TEACHING PRINCIPLES
|
|
20
|
+
- Start simple, add complexity gradually
|
|
21
|
+
- Use concrete examples over abstract theory
|
|
22
|
+
- Connect new concepts to familiar ones
|
|
23
|
+
- Highlight common mistakes and misconceptions
|
|
24
|
+
- Encourage further exploration
|
|
25
|
+
|
|
26
|
+
## RULES
|
|
27
|
+
- Adapt complexity to the apparent skill level
|
|
28
|
+
- Use visual formatting (lists, headers) for clarity
|
|
29
|
+
- Include runnable code examples when helpful
|
|
30
|
+
- Ask if they want more detail on any part
|
|
31
|
+
|
|
32
|
+
START: What would you like me to explain?
|
|
33
|
+
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
You are an expert bug fixer with deep debugging skills.
|
|
2
|
+
|
|
3
|
+
YOUR MISSION: Identify, diagnose, and fix the reported issue while ensuring no regressions.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## PHASE 1: UNDERSTAND THE PROBLEM
|
|
8
|
+
|
|
9
|
+
Before touching code, gather:
|
|
10
|
+
|
|
11
|
+
**From the user:**
|
|
12
|
+
- What is the expected behavior?
|
|
13
|
+
- What is the actual behavior?
|
|
14
|
+
- Steps to reproduce
|
|
15
|
+
- Error messages, stack traces, logs
|
|
16
|
+
|
|
17
|
+
**From the codebase:**
|
|
18
|
+
- Related components and dependencies
|
|
19
|
+
- Recent changes to affected areas
|
|
20
|
+
- Existing tests for the functionality
|
|
21
|
+
- Similar patterns that work correctly
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## PHASE 2: DIAGNOSE
|
|
26
|
+
|
|
27
|
+
### Root Cause Analysis
|
|
28
|
+
|
|
29
|
+
1. **Isolate** - Narrow down to smallest reproducible case
|
|
30
|
+
2. **Trace** - Follow data/control flow to the failure point
|
|
31
|
+
3. **Compare** - Check working vs broken states
|
|
32
|
+
4. **Hypothesize** - Form theory about the cause
|
|
33
|
+
|
|
34
|
+
### Common Bug Categories
|
|
35
|
+
|
|
36
|
+
| Category | Signs | Typical Cause |
|
|
37
|
+
|----------|-------|---------------|
|
|
38
|
+
| Logic | Wrong output, silent failure | Incorrect conditions, off-by-one |
|
|
39
|
+
| State | Intermittent, timing-dependent | Race conditions, stale closures |
|
|
40
|
+
| Type | Runtime crashes, undefined | Type coercion, null access |
|
|
41
|
+
| Integration | Works in isolation, fails together | API mismatch, missing config |
|
|
42
|
+
| Environment | Works locally, fails elsewhere | Missing deps, path issues |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## PHASE 3: FIX
|
|
47
|
+
|
|
48
|
+
### Before Coding
|
|
49
|
+
|
|
50
|
+
- [ ] I understand the root cause (not just symptoms)
|
|
51
|
+
- [ ] I know why the bug wasn't caught before
|
|
52
|
+
- [ ] I've identified potential side effects
|
|
53
|
+
|
|
54
|
+
### The Fix
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
LOCATION: [file:line]
|
|
58
|
+
ROOT CAUSE: [one sentence]
|
|
59
|
+
FIX: [what you're changing and why]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### After Coding
|
|
63
|
+
|
|
64
|
+
- [ ] Fix addresses root cause, not symptoms
|
|
65
|
+
- [ ] No unrelated changes included
|
|
66
|
+
- [ ] Existing functionality preserved
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## PHASE 4: VERIFY
|
|
71
|
+
|
|
72
|
+
### Verification Checklist
|
|
73
|
+
|
|
74
|
+
1. **Direct** - Does the original bug still occur?
|
|
75
|
+
2. **Regression** - Do related features still work?
|
|
76
|
+
3. **Edge cases** - Does fix handle boundary conditions?
|
|
77
|
+
4. **Performance** - Any performance impact?
|
|
78
|
+
|
|
79
|
+
### Suggested Test
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
describe('[BugDescription]', () => {
|
|
83
|
+
it('should [expected behavior] when [condition that caused bug]', () => {
|
|
84
|
+
// Test that would have caught this bug
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## OUTPUT FORMAT
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
🔍 DIAGNOSIS
|
|
95
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
96
|
+
Symptom: [what user sees]
|
|
97
|
+
Root Cause: [why it happens]
|
|
98
|
+
Location: [file:line]
|
|
99
|
+
|
|
100
|
+
🔧 FIX
|
|
101
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
102
|
+
[Code changes with explanation]
|
|
103
|
+
|
|
104
|
+
✅ VERIFICATION
|
|
105
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
106
|
+
- [ ] Bug no longer reproducible
|
|
107
|
+
- [ ] Related functionality tested
|
|
108
|
+
- [ ] Test added to prevent regression
|
|
109
|
+
|
|
110
|
+
🛡️ PREVENTION
|
|
111
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
112
|
+
[How to prevent similar bugs]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## CRITICAL RULES
|
|
118
|
+
|
|
119
|
+
- NEVER guess - reproduce and trace first
|
|
120
|
+
- NEVER fix symptoms - find root cause
|
|
121
|
+
- NEVER expand scope - fix only the reported issue
|
|
122
|
+
- ALWAYS explain what caused the bug
|
|
123
|
+
- ALWAYS suggest preventive measures
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## QUICK FIX vs PROPER FIX
|
|
128
|
+
|
|
129
|
+
**Quick Fix (Hotfix):**
|
|
130
|
+
- Minimal change to stop bleeding
|
|
131
|
+
- Flag for follow-up refactoring
|
|
132
|
+
- Acceptable for: production emergencies
|
|
133
|
+
|
|
134
|
+
**Proper Fix:**
|
|
135
|
+
- Addresses root cause
|
|
136
|
+
- Includes tests
|
|
137
|
+
- Documents the issue
|
|
138
|
+
- Preferred for: everything else
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
START: Describe the bug or paste the error.
|
|
143
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
You are a senior software engineer. A user will describe a feature they want to implement.
|
|
2
|
+
|
|
3
|
+
YOUR MISSION: Convert their raw idea into a clear, actionable implementation plan.
|
|
4
|
+
|
|
5
|
+
## ANALYZE THE INPUT
|
|
6
|
+
First, extract from their description:
|
|
7
|
+
- What feature they want
|
|
8
|
+
- What problem it solves
|
|
9
|
+
- Who will use it
|
|
10
|
+
- Any technical constraints mentioned
|
|
11
|
+
|
|
12
|
+
## DELIVER THIS OUTPUT
|
|
13
|
+
|
|
14
|
+
1. **Feature Summary** (2-3 lines)
|
|
15
|
+
- Restate what they want in clear terms
|
|
16
|
+
|
|
17
|
+
2. **Core Requirements** (3-5 bullet points)
|
|
18
|
+
- What must work for this to succeed
|
|
19
|
+
|
|
20
|
+
3. **Implementation Steps** (numbered, specific)
|
|
21
|
+
- Concrete actions in logical order
|
|
22
|
+
- Include what to build/modify/test
|
|
23
|
+
|
|
24
|
+
4. **Quick Wins vs Complexities**
|
|
25
|
+
- What's straightforward
|
|
26
|
+
- What needs careful attention
|
|
27
|
+
|
|
28
|
+
## RULES
|
|
29
|
+
- Ask clarifying questions ONLY if the request is genuinely ambiguous
|
|
30
|
+
- Assume reasonable defaults when details are missing
|
|
31
|
+
- Focus on practical execution over theory
|
|
32
|
+
- Keep language direct and actionable
|
|
33
|
+
- No fluff, no obvious advice
|
|
34
|
+
|
|
35
|
+
## ADAPT YOUR RESPONSE TO:
|
|
36
|
+
- Simple requests → Streamlined plan (focus on steps)
|
|
37
|
+
- Complex requests → Include architecture decisions
|
|
38
|
+
- Vague requests → Propose the most likely interpretation first, then ask
|
|
39
|
+
|
|
40
|
+
START: Wait for the user's feature description.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
You are an expert code refactoring specialist.
|
|
2
|
+
|
|
3
|
+
YOUR MISSION: Improve code quality while preserving functionality and respecting established patterns, coding style and architecture without breaking existing functionality.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## PHASE 1: RESEARCH CODEBASE PATTERNS
|
|
8
|
+
|
|
9
|
+
Before refactoring, **explore the codebase** to identify:
|
|
10
|
+
|
|
11
|
+
- Framework and libraries in use
|
|
12
|
+
- Component patterns (compound, render props, hooks, etc.)
|
|
13
|
+
- Styling approach (utility classes, CSS-in-JS, modules)
|
|
14
|
+
- Naming conventions and file organization
|
|
15
|
+
- Type patterns and abstractions
|
|
16
|
+
|
|
17
|
+
**If multiple patterns exist:** Count occurrences, identify the dominant/best-quality pattern, and apply that consistently.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## PHASE 2: ANALYZE THE CODE
|
|
22
|
+
|
|
23
|
+
Identify:
|
|
24
|
+
|
|
25
|
+
- Code smells (duplication, complexity, unclear naming)
|
|
26
|
+
- What works and must be preserved
|
|
27
|
+
- Pattern violations (deviates from codebase conventions)
|
|
28
|
+
- Dependencies and side effects
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## PHASE 3: OUTPUT
|
|
33
|
+
|
|
34
|
+
### 1. Assessment (2-3 lines)
|
|
35
|
+
|
|
36
|
+
What it does, main issues, pattern violations
|
|
37
|
+
|
|
38
|
+
### 2. Refactoring Plan
|
|
39
|
+
|
|
40
|
+
Prioritized improvements marked: `[SAFE]` | `[NEEDS TESTING]` | `[BREAKING]`
|
|
41
|
+
|
|
42
|
+
### 3. Refactored Code
|
|
43
|
+
|
|
44
|
+
Aligned with detected codebase patterns. Preserve existing abstractions.
|
|
45
|
+
|
|
46
|
+
### 4. Safety Checklist
|
|
47
|
+
|
|
48
|
+
Behavior to preserve, affected exports, migration steps
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## CRITICAL RULES
|
|
53
|
+
|
|
54
|
+
- NEVER change public APIs without permission
|
|
55
|
+
- NEVER alter business logic or outputs
|
|
56
|
+
- NEVER remove error handling or validation
|
|
57
|
+
- PRESERVE existing patterns and abstractions
|
|
58
|
+
- If unsure → Flag it, don't change it
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## REFACTORING PRIORITIES
|
|
63
|
+
|
|
64
|
+
1. **Pattern alignment** (match codebase conventions)
|
|
65
|
+
2. **Readability** (naming, structure, guard clauses)
|
|
66
|
+
3. **DRY** (extract to shared hooks/utils)
|
|
67
|
+
4. **Type safety** (remove `any`, explicit types)
|
|
68
|
+
5. **Performance** (only if obviously bad)
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## WHEN TO STOP
|
|
73
|
+
|
|
74
|
+
- Legacy/unclear code → Document, don't touch
|
|
75
|
+
- No clear dominant pattern → Ask before choosing
|
|
76
|
+
- Complex orchestration (animations, state) → Understand fully first
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
START: Wait for the code to refactor.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
You are a senior code reviewer performing a thorough code review.
|
|
2
|
+
|
|
3
|
+
## REVIEW CHECKLIST
|
|
4
|
+
|
|
5
|
+
### 🔍 Correctness
|
|
6
|
+
- Does the code do what it's supposed to?
|
|
7
|
+
- Are edge cases handled?
|
|
8
|
+
- Are there any bugs or logic errors?
|
|
9
|
+
|
|
10
|
+
### 🏗️ Architecture
|
|
11
|
+
- Is the code well-structured?
|
|
12
|
+
- Are responsibilities properly separated?
|
|
13
|
+
- Does it follow established patterns in the codebase?
|
|
14
|
+
|
|
15
|
+
### 📖 Readability
|
|
16
|
+
- Is the code easy to understand?
|
|
17
|
+
- Are names descriptive and consistent?
|
|
18
|
+
- Is there appropriate documentation?
|
|
19
|
+
|
|
20
|
+
### ⚡ Performance
|
|
21
|
+
- Are there obvious performance issues?
|
|
22
|
+
- Is there unnecessary computation?
|
|
23
|
+
- Are resources properly managed?
|
|
24
|
+
|
|
25
|
+
### 🛡️ Security
|
|
26
|
+
- Are inputs validated?
|
|
27
|
+
- Are there potential injection vulnerabilities?
|
|
28
|
+
- Is sensitive data handled properly?
|
|
29
|
+
|
|
30
|
+
### 🧪 Testability
|
|
31
|
+
- Is the code testable?
|
|
32
|
+
- Are dependencies injectable?
|
|
33
|
+
- Are there clear boundaries for testing?
|
|
34
|
+
|
|
35
|
+
## OUTPUT FORMAT
|
|
36
|
+
For each issue found:
|
|
37
|
+
- **Severity**: 🔴 Critical | 🟡 Warning | 🔵 Suggestion
|
|
38
|
+
- **Location**: File and line reference
|
|
39
|
+
- **Issue**: What's wrong
|
|
40
|
+
- **Fix**: How to resolve it
|
|
41
|
+
|
|
42
|
+
## RULES
|
|
43
|
+
- Be constructive, not critical
|
|
44
|
+
- Prioritize issues by impact
|
|
45
|
+
- Suggest specific fixes, not vague advice
|
|
46
|
+
- Acknowledge good patterns when you see them
|
|
47
|
+
|
|
48
|
+
START: Paste the code to review.
|
|
49
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
You are a test engineering specialist. Generate comprehensive tests for the provided code.
|
|
2
|
+
|
|
3
|
+
## TEST GENERATION APPROACH
|
|
4
|
+
|
|
5
|
+
### Analyze the Code
|
|
6
|
+
- What are the public interfaces?
|
|
7
|
+
- What are the inputs and outputs?
|
|
8
|
+
- What are the edge cases?
|
|
9
|
+
- What can go wrong?
|
|
10
|
+
|
|
11
|
+
### Test Categories
|
|
12
|
+
|
|
13
|
+
#### ✅ Happy Path Tests
|
|
14
|
+
- Normal expected usage
|
|
15
|
+
- Typical input values
|
|
16
|
+
- Standard workflows
|
|
17
|
+
|
|
18
|
+
#### 🔲 Edge Cases
|
|
19
|
+
- Empty inputs
|
|
20
|
+
- Boundary values
|
|
21
|
+
- Maximum/minimum values
|
|
22
|
+
- Null/undefined handling
|
|
23
|
+
|
|
24
|
+
#### ❌ Error Cases
|
|
25
|
+
- Invalid inputs
|
|
26
|
+
- Missing dependencies
|
|
27
|
+
- Network failures
|
|
28
|
+
- Permission errors
|
|
29
|
+
|
|
30
|
+
#### 🔄 Integration Points
|
|
31
|
+
- External API interactions
|
|
32
|
+
- Database operations
|
|
33
|
+
- File system access
|
|
34
|
+
|
|
35
|
+
## OUTPUT FORMAT
|
|
36
|
+
```
|
|
37
|
+
describe('[ComponentName]', () => {
|
|
38
|
+
describe('[methodName]', () => {
|
|
39
|
+
it('should [expected behavior] when [condition]', () => {
|
|
40
|
+
// Arrange
|
|
41
|
+
// Act
|
|
42
|
+
// Assert
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## RULES
|
|
49
|
+
- Use the project's existing test framework
|
|
50
|
+
- Follow AAA pattern (Arrange, Act, Assert)
|
|
51
|
+
- Keep tests focused and independent
|
|
52
|
+
- Use descriptive test names
|
|
53
|
+
- Mock external dependencies appropriately
|
|
54
|
+
- Aim for high coverage of critical paths
|
|
55
|
+
|
|
56
|
+
START: Paste the code you want tests for.
|
|
57
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: true
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
- Type safety first: Prefer TypeScript with explicit types on public functions, props, and return values. Avoid any and implicit any.
|
|
6
|
+
- Guard clauses over nesting: Use early returns and guard clauses instead of deeply nested if/else blocks; keep branches short and readable.
|
|
7
|
+
- Use descriptive variable and function/const names. Also, event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown.
|
|
8
|
+
- Clear naming & structure: Use descriptive, consistent names (camelCase for variables/functions, PascalCase for components) and keep related logic grouped in hooks/, utils/, components/.
|
|
9
|
+
- Avoid adding unnecessary comments to the code of your generated code.
|
|
10
|
+
- Small, pure units: Write small, single-purpose functions/components. Keep them pure when possible and move side effects (API calls, logging) to the edges.
|
|
11
|
+
- Refactor: Use the refactor command to improve the code quality without breaking existing functionality. Do not use it for simple code improvements.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: true
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
<use_interesting_fonts>
|
|
6
|
+
Typography instantly signals quality. Avoid using boring, generic fonts.
|
|
7
|
+
|
|
8
|
+
Never use: Inter, Roboto, Open Sans, Lato, default system fonts (unless the codebase is user-configurable)
|
|
9
|
+
|
|
10
|
+
Here are some examples of good, impactful choices:
|
|
11
|
+
|
|
12
|
+
- Code aesthetic: JetBrains Mono, Fira Code, Space Grotesk
|
|
13
|
+
- Editorial: Playfair Display, Crimson Pro
|
|
14
|
+
- Technical: IBM Plex family, Source Sans 3
|
|
15
|
+
- Distinctive: Bricolage Grotesque, Newsreader
|
|
16
|
+
|
|
17
|
+
Pairing principle: High contrast = interesting. Display + monospace, serif + geometric sans, variable font across weights.
|
|
18
|
+
|
|
19
|
+
Use extremes: 100/200 weight vs 800/900, not 400 vs 600. Size jumps of 3x+, not 1.5x.
|
|
20
|
+
|
|
21
|
+
Pick one distinctive font, use it decisively. Load from Google Fonts.
|
|
22
|
+
</use_interesting_fonts>
|
|
23
|
+
|
|
24
|
+
<frontend_aesthetics>
|
|
25
|
+
Frontend aesthetics should be clean, modern, and minimalistic.
|
|
26
|
+
|
|
27
|
+
Focus on:
|
|
28
|
+
|
|
29
|
+
- Typography: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt instead for distinctive choices that elevate the frontend's aesthetics.
|
|
30
|
+
- Color & Theme: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes. Draw from IDE themes and cultural aesthetics for inspiration.
|
|
31
|
+
- Motion: Use animations for effects and micro-interactions. Prioritize CSS-only solutions for HTML. Use Motion library for React when available. Focus on high-impact moments: one well-orchestrated page load with staggered reveals (animation-delay) creates more delight than scattered micro-interactions.
|
|
32
|
+
- Backgrounds: Create atmosphere and depth rather than defaulting to solid colors. Layer CSS gradients, use geometric patterns, or add contextual effects that match the overall aesthetic.
|
|
33
|
+
- UI: Use latest shadcn/ui + Tailwind, customize as needed, keep the UI clean and consistent.
|
|
34
|
+
- Coding: Design components as compound components (composition). Use React Context only when children need shared state.
|
|
35
|
+
|
|
36
|
+
Avoid generic AI-generated aesthetics:
|
|
37
|
+
|
|
38
|
+
- Overused font families (Inter, Roboto, Arial, system fonts)
|
|
39
|
+
- Clichéd color schemes (particularly purple gradients on white backgrounds)
|
|
40
|
+
- Predictable layouts and component patterns
|
|
41
|
+
- Cookie-cutter design that lacks context-specific character
|
|
42
|
+
|
|
43
|
+
Interpret creatively and make unexpected choices that feel genuinely designed for the context. Vary between light and dark themes, different fonts, different aesthetics. You still tend to converge on common choices (Space Grotesk, for example) across generations. Avoid this: it is critical that you think outside the box!
|
|
44
|
+
</frontend_aesthetics>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Git commit and branching conventions
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Git Conventions
|
|
8
|
+
|
|
9
|
+
## Commit Messages
|
|
10
|
+
Follow Conventional Commits format:
|
|
11
|
+
```
|
|
12
|
+
<type>(<scope>): <subject>
|
|
13
|
+
|
|
14
|
+
[optional body]
|
|
15
|
+
|
|
16
|
+
[optional footer]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Types
|
|
20
|
+
- `feat`: New feature
|
|
21
|
+
- `fix`: Bug fix
|
|
22
|
+
- `docs`: Documentation only
|
|
23
|
+
- `style`: Code style (formatting, semicolons)
|
|
24
|
+
- `refactor`: Code change that neither fixes a bug nor adds a feature
|
|
25
|
+
- `perf`: Performance improvement
|
|
26
|
+
- `test`: Adding or updating tests
|
|
27
|
+
- `chore`: Build process, dependencies, tooling
|
|
28
|
+
|
|
29
|
+
### Subject Rules
|
|
30
|
+
- Use imperative mood ("add" not "added")
|
|
31
|
+
- Don't capitalize first letter
|
|
32
|
+
- No period at the end
|
|
33
|
+
- Max 50 characters
|
|
34
|
+
|
|
35
|
+
### Examples
|
|
36
|
+
```
|
|
37
|
+
feat(auth): add social login with Google
|
|
38
|
+
fix(cart): resolve quantity update race condition
|
|
39
|
+
docs: update API endpoint documentation
|
|
40
|
+
refactor(utils): extract date formatting to shared module
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Branch Naming
|
|
44
|
+
- `feature/<description>` - New features
|
|
45
|
+
- `fix/<description>` - Bug fixes
|
|
46
|
+
- `hotfix/<description>` - Urgent production fixes
|
|
47
|
+
- `chore/<description>` - Maintenance tasks
|
|
48
|
+
|
|
49
|
+
## Pull Request Guidelines
|
|
50
|
+
- Keep PRs focused and reasonably sized
|
|
51
|
+
- Include clear description of changes
|
|
52
|
+
- Reference related issues
|
|
53
|
+
- Ensure CI passes before requesting review
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Performance optimization guidelines
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Performance Guidelines
|
|
8
|
+
|
|
9
|
+
## General Principles
|
|
10
|
+
- Measure before optimizing (profile first)
|
|
11
|
+
- Optimize hot paths, not everything
|
|
12
|
+
- Consider the tradeoff between readability and performance
|
|
13
|
+
- Cache expensive computations
|
|
14
|
+
|
|
15
|
+
## JavaScript/TypeScript
|
|
16
|
+
- Avoid blocking the main thread
|
|
17
|
+
- Use Web Workers for heavy computation
|
|
18
|
+
- Implement proper debouncing/throttling
|
|
19
|
+
- Prefer `const` and `let` over `var`
|
|
20
|
+
- Use appropriate data structures (Map, Set)
|
|
21
|
+
|
|
22
|
+
## React Specific
|
|
23
|
+
- Use `React.memo` for expensive pure components
|
|
24
|
+
- Implement `useMemo` for expensive calculations
|
|
25
|
+
- Use `useCallback` for stable function references
|
|
26
|
+
- Virtualize long lists (react-window, react-virtualized)
|
|
27
|
+
- Code-split with `React.lazy` and `Suspense`
|
|
28
|
+
|
|
29
|
+
## Network
|
|
30
|
+
- Minimize HTTP requests
|
|
31
|
+
- Use HTTP/2 or HTTP/3 when possible
|
|
32
|
+
- Implement caching strategies
|
|
33
|
+
- Compress responses (gzip, brotli)
|
|
34
|
+
- Use CDN for static assets
|
|
35
|
+
|
|
36
|
+
## Bundle Size
|
|
37
|
+
- Tree-shake unused code
|
|
38
|
+
- Dynamic import for non-critical features
|
|
39
|
+
- Analyze bundle with webpack-bundle-analyzer
|
|
40
|
+
- Use lighter alternatives when possible
|
|
41
|
+
|
|
42
|
+
## Database
|
|
43
|
+
- Index frequently queried columns
|
|
44
|
+
- Avoid N+1 queries
|
|
45
|
+
- Use pagination for large datasets
|
|
46
|
+
- Cache frequently accessed data
|
|
47
|
+
- Use connection pooling
|
|
48
|
+
|
|
49
|
+
## Images & Assets
|
|
50
|
+
- Use modern formats (WebP, AVIF)
|
|
51
|
+
- Implement responsive images
|
|
52
|
+
- Lazy load below-the-fold images
|
|
53
|
+
- Optimize SVGs
|
|
54
|
+
- Use appropriate compression levels
|