cursor-agent-scaffold 1.0.0 → 1.0.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.
- package/package.json +2 -2
- package/rules/scaffold-agent-context.mdc +87 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cursor-agent-scaffold",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Scaffold package for setting up Cursor AI agent context and rules system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cursor",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"bin/"
|
|
28
28
|
],
|
|
29
29
|
"bin": {
|
|
30
|
-
"cursor-scaffold": "
|
|
30
|
+
"cursor-scaffold": "bin/install.js"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"prepublishOnly": "node bin/verify.js"
|
|
@@ -137,7 +137,7 @@ alwaysApply: true
|
|
|
137
137
|
|
|
138
138
|
### Step 3: Create Context Scaffold
|
|
139
139
|
|
|
140
|
-
Create a `context-patterns.mdc` rule file that explains the context system
|
|
140
|
+
Create a `context-patterns.mdc` rule file that explains the context system and **automatic pattern detection**:
|
|
141
141
|
|
|
142
142
|
```markdown
|
|
143
143
|
---
|
|
@@ -147,24 +147,70 @@ globs:
|
|
|
147
147
|
alwaysApply: true
|
|
148
148
|
---
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
# Context Knowledge Base
|
|
151
151
|
|
|
152
152
|
The `.cursor/context/` directory contains **learned patterns and knowledge** from working on this project. These files capture specific decisions, refactoring strategies, and best practices discovered during development.
|
|
153
153
|
|
|
154
|
-
##
|
|
154
|
+
## When Context Files Are Created
|
|
155
155
|
|
|
156
|
-
|
|
157
|
-
2. **When encountering patterns** mentioned in context files, follow the documented approach
|
|
158
|
-
3. **When making decisions**, reference the decision frameworks in context files
|
|
159
|
-
4. **After implementing**, verify your approach aligns with documented patterns
|
|
156
|
+
**CRITICAL: The agent MUST automatically detect and create context files when patterns emerge.**
|
|
160
157
|
|
|
161
|
-
|
|
158
|
+
### Automatic Pattern Detection Triggers
|
|
162
159
|
|
|
163
|
-
|
|
164
|
-
- **Rules** = Prescriptive guidelines and requirements
|
|
165
|
-
- **Context** = Learned patterns, decision frameworks, and best practices
|
|
160
|
+
Create a context file when you encounter ANY of these situations:
|
|
166
161
|
|
|
167
|
-
|
|
162
|
+
1. **Repeated Pattern (2+ occurrences)**
|
|
163
|
+
- Same code structure appears in 2+ files/components
|
|
164
|
+
- Same data fetching approach used multiple times
|
|
165
|
+
- Same styling pattern repeated across components
|
|
166
|
+
- **Action**: Create context file documenting the pattern
|
|
167
|
+
|
|
168
|
+
2. **Decision Framework Needed**
|
|
169
|
+
- Multiple ways to solve the same problem exist
|
|
170
|
+
- A choice was made that will be relevant for future similar tasks
|
|
171
|
+
- **Action**: Document the decision framework in a context file
|
|
172
|
+
|
|
173
|
+
3. **Domain-Specific Pattern**
|
|
174
|
+
- Framework-specific patterns (routing, data fetching, etc.)
|
|
175
|
+
- Component composition strategies
|
|
176
|
+
- Data transformation patterns
|
|
177
|
+
- **Action**: Create context file for the domain pattern
|
|
178
|
+
|
|
179
|
+
4. **After Refactoring**
|
|
180
|
+
- Code was refactored and a reusable pattern was discovered
|
|
181
|
+
- **Action**: Document the refactored pattern in a context file
|
|
182
|
+
|
|
183
|
+
### Pattern Detection Checklist
|
|
184
|
+
|
|
185
|
+
During and after implementation, ask:
|
|
186
|
+
- [ ] Is this pattern used in 2+ places? → Create context file
|
|
187
|
+
- [ ] Will this decision be needed again? → Create context file
|
|
188
|
+
- [ ] Is this a domain-specific pattern? → Create context file
|
|
189
|
+
- [ ] Did I just refactor to a better pattern? → Create context file
|
|
190
|
+
- [ ] Is this a complex pattern that others might struggle with? → Create context file
|
|
191
|
+
|
|
192
|
+
## Automatic Context File Creation Workflow
|
|
193
|
+
|
|
194
|
+
**MANDATORY: Follow this workflow after completing any implementation task:**
|
|
195
|
+
|
|
196
|
+
1. **Pattern Detection Phase**
|
|
197
|
+
- Review the code you just wrote/modified
|
|
198
|
+
- Check if similar patterns exist elsewhere in the codebase
|
|
199
|
+
- Identify if this is a reusable pattern or decision framework
|
|
200
|
+
|
|
201
|
+
2. **Context File Creation Phase**
|
|
202
|
+
- If a pattern is detected, IMMEDIATELY create a context file
|
|
203
|
+
- Use the template from this file (scaffold-agent-context.mdc)
|
|
204
|
+
- Include real examples from the codebase
|
|
205
|
+
- Reference specific files/components
|
|
206
|
+
|
|
207
|
+
3. **Pattern Documentation**
|
|
208
|
+
- Document the "why" and "when" (not just "what")
|
|
209
|
+
- Include code examples from actual implementation
|
|
210
|
+
- Add anti-patterns to avoid
|
|
211
|
+
- Reference related files
|
|
212
|
+
|
|
213
|
+
**Remember:** Rules tell you **what** to do. Context tells you **why** and **when**. **The agent MUST actively create context files, not wait for user requests.**
|
|
168
214
|
```
|
|
169
215
|
|
|
170
216
|
### Step 4: Document the System
|
|
@@ -192,16 +238,22 @@ Create a new rule file when:
|
|
|
192
238
|
|
|
193
239
|
### When to Create a New Context File
|
|
194
240
|
|
|
241
|
+
**CRITICAL: The agent MUST automatically detect and create context files when patterns emerge.**
|
|
242
|
+
|
|
195
243
|
Create a new context file when:
|
|
196
244
|
- A refactoring reveals a reusable pattern
|
|
197
245
|
- A decision framework is needed for similar tasks
|
|
198
246
|
- Component composition strategies emerge
|
|
199
247
|
- Domain-specific patterns are discovered
|
|
248
|
+
- **A pattern appears in 2+ places** (automatic trigger)
|
|
249
|
+
- **A complex pattern is implemented** (automatic trigger)
|
|
200
250
|
|
|
201
251
|
**Example triggers:**
|
|
202
252
|
- "We refactored the Button component and learned when to use variants vs separate components"
|
|
203
253
|
- "We built three forms and discovered patterns for validation"
|
|
204
254
|
- "We created a navigation system and learned external link handling patterns"
|
|
255
|
+
- **Automatic**: Same data fetching pattern used in multiple components
|
|
256
|
+
- **Automatic**: Same styling approach repeated across 2+ files
|
|
205
257
|
|
|
206
258
|
### Context File Template
|
|
207
259
|
|
|
@@ -265,13 +317,25 @@ When [situation], consider:
|
|
|
265
317
|
|
|
266
318
|
### Updating Context Files
|
|
267
319
|
|
|
320
|
+
**MANDATORY Workflow:**
|
|
321
|
+
|
|
268
322
|
When working on tasks:
|
|
269
323
|
1. **Before starting:** Check relevant context files
|
|
270
324
|
2. **During work:** Note patterns that emerge
|
|
271
|
-
3. **After completion:**
|
|
272
|
-
-
|
|
273
|
-
-
|
|
274
|
-
-
|
|
325
|
+
3. **After completion:**
|
|
326
|
+
- **ALWAYS** run the pattern detection checklist
|
|
327
|
+
- **IMMEDIATELY** create context files if triggers are met
|
|
328
|
+
- Update existing context files if:
|
|
329
|
+
- A new pattern was discovered
|
|
330
|
+
- A decision framework was developed
|
|
331
|
+
- An existing pattern needs clarification
|
|
332
|
+
|
|
333
|
+
**Pattern Detection Checklist (run after every implementation):**
|
|
334
|
+
- [ ] Is this pattern used in 2+ places? → Create context file
|
|
335
|
+
- [ ] Will this decision be needed again? → Create context file
|
|
336
|
+
- [ ] Is this a domain-specific pattern? → Create context file
|
|
337
|
+
- [ ] Did I just refactor to a better pattern? → Create context file
|
|
338
|
+
- [ ] Is this a complex pattern that others might struggle with? → Create context file
|
|
275
339
|
|
|
276
340
|
### Updating Rules
|
|
277
341
|
|
|
@@ -325,13 +389,18 @@ Update rules when:
|
|
|
325
389
|
|
|
326
390
|
## Integration with Agent Behavior
|
|
327
391
|
|
|
328
|
-
The agent
|
|
392
|
+
The agent MUST:
|
|
329
393
|
- **Always check relevant context files** before starting tasks
|
|
330
394
|
- **Reference context files** when making decisions
|
|
331
|
-
- **
|
|
395
|
+
- **Automatically detect patterns** during and after implementation
|
|
396
|
+
- **IMMEDIATELY create context files** when pattern detection triggers are met
|
|
397
|
+
- **Follow the mandatory workflow** after every implementation task
|
|
398
|
+
- **Update context files** when patterns evolve
|
|
332
399
|
- **Follow rules** as authoritative requirements
|
|
333
400
|
- **Suggest rule updates** when patterns become project-wide
|
|
334
401
|
|
|
402
|
+
**Critical:** The agent must PROACTIVELY create context files, not wait for user requests. Pattern detection is automatic and mandatory.
|
|
403
|
+
|
|
335
404
|
## Quick Reference
|
|
336
405
|
|
|
337
406
|
| Type | Format | When to Create | Purpose |
|