cursor-agent-scaffold 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 +130 -0
- package/SETUP.md +87 -0
- package/SHARING.md +122 -0
- package/bin/install.js +77 -0
- package/bin/verify.js +40 -0
- package/package.json +38 -0
- package/rules/scaffold-agent-context.mdc +342 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Cursor Agent Context & Rules Scaffold
|
|
2
|
+
|
|
3
|
+
This is a **scaffold package** for setting up Cursor's AI agent context and rules system in your project.
|
|
4
|
+
|
|
5
|
+
## What This Does
|
|
6
|
+
|
|
7
|
+
This scaffold helps you set up a structured system for:
|
|
8
|
+
- **Rules** - Prescriptive guidelines that enforce project conventions
|
|
9
|
+
- **Context** - Learned patterns and decision frameworks discovered during development
|
|
10
|
+
|
|
11
|
+
When you drop this into your `.cursor/` folder, the agent will help you:
|
|
12
|
+
1. Analyze your codebase
|
|
13
|
+
2. Create appropriate rules based on your tech stack
|
|
14
|
+
3. Set up the context system for capturing patterns
|
|
15
|
+
4. Maintain and evolve the system as you develop
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
### Option 1: NPM Package (Recommended)
|
|
20
|
+
|
|
21
|
+
Install and run the scaffold installer:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Using npx (no installation needed)
|
|
25
|
+
npx cursor-agent-scaffold
|
|
26
|
+
|
|
27
|
+
# Or install globally
|
|
28
|
+
npm install -g cursor-agent-scaffold
|
|
29
|
+
cursor-scaffold
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This will automatically copy all scaffold files to your `.cursor/` folder.
|
|
33
|
+
|
|
34
|
+
### Option 2: Copy the Scaffold
|
|
35
|
+
|
|
36
|
+
1. Copy the entire `.cursor-scaffold/` folder contents into your project's `.cursor/` folder:
|
|
37
|
+
```bash
|
|
38
|
+
# Copy everything from .cursor-scaffold/ to .cursor/
|
|
39
|
+
cp -r .cursor-scaffold/* .cursor/
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
2. The agent will automatically detect the scaffold and guide you through setup
|
|
43
|
+
|
|
44
|
+
### Option 3: Manual Setup
|
|
45
|
+
|
|
46
|
+
1. Copy `rules/scaffold-agent-context.mdc` to `.cursor/rules/`
|
|
47
|
+
2. Copy `README.md` to `.cursor/`
|
|
48
|
+
3. Ask the agent: "Help me set up the context and rules system for this project"
|
|
49
|
+
|
|
50
|
+
## What Gets Created
|
|
51
|
+
|
|
52
|
+
After setup, you'll have:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
.cursor/
|
|
56
|
+
├── README.md # Documentation
|
|
57
|
+
├── rules/ # Prescriptive rules
|
|
58
|
+
│ ├── scaffold-agent-context.mdc # Setup guide (this file)
|
|
59
|
+
│ ├── naming-and-structure.mdc # Created by agent
|
|
60
|
+
│ ├── lint-and-style.mdc # Created by agent
|
|
61
|
+
│ ├── framework-patterns.mdc # Created by agent
|
|
62
|
+
│ └── context-patterns.mdc # Created by agent
|
|
63
|
+
└── context/ # Learned patterns (created as needed)
|
|
64
|
+
└── [pattern files].md
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## How It Works
|
|
68
|
+
|
|
69
|
+
1. **Initial Setup**: The agent analyzes your codebase and creates initial rules
|
|
70
|
+
2. **Development**: As you work, the agent captures patterns in context files
|
|
71
|
+
3. **Evolution**: Rules and context evolve as your project grows
|
|
72
|
+
|
|
73
|
+
## Customization
|
|
74
|
+
|
|
75
|
+
The scaffold is designed to be:
|
|
76
|
+
- **Framework-agnostic** - Works with React, Vue, Angular, etc.
|
|
77
|
+
- **Language-agnostic** - Works with TypeScript, JavaScript, Python, etc.
|
|
78
|
+
- **Project-agnostic** - Adapts to your specific conventions
|
|
79
|
+
|
|
80
|
+
The agent will customize rules based on:
|
|
81
|
+
- Your tech stack (detected from config files)
|
|
82
|
+
- Your existing code patterns
|
|
83
|
+
- Your project structure
|
|
84
|
+
|
|
85
|
+
## Next Steps
|
|
86
|
+
|
|
87
|
+
1. **Copy this scaffold** into your `.cursor/` folder
|
|
88
|
+
2. **Ask the agent** to analyze your codebase and create initial rules:
|
|
89
|
+
- "Analyze my codebase and create initial rules based on my tech stack"
|
|
90
|
+
- "Help me set up the context and rules system for this project"
|
|
91
|
+
3. **Start developing** - context files will be created as patterns emerge
|
|
92
|
+
|
|
93
|
+
## Example Agent Prompts
|
|
94
|
+
|
|
95
|
+
After setup, try these prompts:
|
|
96
|
+
|
|
97
|
+
- "Analyze my codebase and create initial rules"
|
|
98
|
+
- "What rules should I have for this project?"
|
|
99
|
+
- "Help me document the form validation patterns we've been using"
|
|
100
|
+
- "Create a context file for our component composition patterns"
|
|
101
|
+
- "Update the rules to reflect our new TypeScript strict mode requirement"
|
|
102
|
+
|
|
103
|
+
## Support
|
|
104
|
+
|
|
105
|
+
The scaffold includes:
|
|
106
|
+
- `rules/scaffold-agent-context.mdc` - Detailed setup guide for the agent
|
|
107
|
+
- `README.md` - Documentation for developers
|
|
108
|
+
- Templates and examples for rules and context files
|
|
109
|
+
|
|
110
|
+
## Installation Methods
|
|
111
|
+
|
|
112
|
+
### NPM Package
|
|
113
|
+
```bash
|
|
114
|
+
npx cursor-agent-scaffold
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Git Repository
|
|
118
|
+
```bash
|
|
119
|
+
git clone <repo-url>
|
|
120
|
+
cp -r cursor-agent-scaffold/* .cursor/
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Zip File
|
|
124
|
+
Download and extract into `.cursor/` folder
|
|
125
|
+
|
|
126
|
+
See `SHARING.md` for more distribution options.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
**Note:** This scaffold is designed to work with Cursor's AI agent. The agent will read `scaffold-agent-context.mdc` and guide you through the setup process automatically.
|
package/SETUP.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Quick Setup Guide
|
|
2
|
+
|
|
3
|
+
## For Users Receiving This Scaffold
|
|
4
|
+
|
|
5
|
+
### Step 1: Copy to Your Project
|
|
6
|
+
|
|
7
|
+
Copy the contents of `.cursor-scaffold/` into your project's `.cursor/` folder:
|
|
8
|
+
|
|
9
|
+
**On macOS/Linux:**
|
|
10
|
+
```bash
|
|
11
|
+
cp -r .cursor-scaffold/* .cursor/
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**On Windows (PowerShell):**
|
|
15
|
+
```powershell
|
|
16
|
+
Copy-Item -Path .cursor-scaffold\* -Destination .cursor\ -Recurse
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Or manually:**
|
|
20
|
+
1. Create a `.cursor/` folder in your project root (if it doesn't exist)
|
|
21
|
+
2. Copy `rules/scaffold-agent-context.mdc` to `.cursor/rules/`
|
|
22
|
+
3. Copy `README.md` to `.cursor/`
|
|
23
|
+
|
|
24
|
+
### Step 2: Ask the Agent to Set Up
|
|
25
|
+
|
|
26
|
+
Open Cursor and ask the agent:
|
|
27
|
+
|
|
28
|
+
> "Help me set up the context and rules system for this project. Analyze my codebase and create initial rules based on my tech stack."
|
|
29
|
+
|
|
30
|
+
The agent will:
|
|
31
|
+
1. Analyze your codebase
|
|
32
|
+
2. Detect your tech stack
|
|
33
|
+
3. Create appropriate rule files
|
|
34
|
+
4. Set up the context system
|
|
35
|
+
|
|
36
|
+
### Step 3: Verify Setup
|
|
37
|
+
|
|
38
|
+
After the agent completes setup, you should have:
|
|
39
|
+
|
|
40
|
+
- `.cursor/rules/` with several `.mdc` rule files
|
|
41
|
+
- `.cursor/context/` folder (empty initially, will be populated as patterns emerge)
|
|
42
|
+
- `.cursor/README.md` with documentation
|
|
43
|
+
|
|
44
|
+
### Step 4: Start Using
|
|
45
|
+
|
|
46
|
+
The system is now active! The agent will:
|
|
47
|
+
- Follow the rules when generating code
|
|
48
|
+
- Create context files as patterns emerge
|
|
49
|
+
- Reference both rules and context when working on tasks
|
|
50
|
+
|
|
51
|
+
## What Happens Next?
|
|
52
|
+
|
|
53
|
+
As you develop:
|
|
54
|
+
|
|
55
|
+
1. **Rules** enforce your conventions automatically
|
|
56
|
+
2. **Context files** are created when patterns emerge
|
|
57
|
+
3. The agent references both when making decisions
|
|
58
|
+
|
|
59
|
+
## Troubleshooting
|
|
60
|
+
|
|
61
|
+
**The agent isn't detecting the scaffold:**
|
|
62
|
+
- Make sure `scaffold-agent-context.mdc` is in `.cursor/rules/`
|
|
63
|
+
- Try asking: "Read the scaffold-agent-context rule and help me set up the system"
|
|
64
|
+
|
|
65
|
+
**Rules aren't being created:**
|
|
66
|
+
- Explicitly ask: "Analyze my codebase and create initial rules"
|
|
67
|
+
- Provide context about your tech stack if needed
|
|
68
|
+
|
|
69
|
+
**Need to customize:**
|
|
70
|
+
- Edit rule files after they're created
|
|
71
|
+
- The agent will follow your customizations
|
|
72
|
+
|
|
73
|
+
## Example Conversation
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
You: Help me set up the context and rules system for this project.
|
|
77
|
+
|
|
78
|
+
Agent: [Analyzes codebase, detects React + TypeScript + Tailwind]
|
|
79
|
+
[Creates rules for naming, linting, framework patterns, etc.]
|
|
80
|
+
[Sets up context system]
|
|
81
|
+
|
|
82
|
+
You: Great! Now help me document our form validation patterns.
|
|
83
|
+
|
|
84
|
+
Agent: [Creates context/form-validation-patterns.md based on your code]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
That's it! The system is self-maintaining once set up.
|
package/SHARING.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Sharing This Scaffold
|
|
2
|
+
|
|
3
|
+
This document explains how to share the Cursor Agent Context & Rules Scaffold with others.
|
|
4
|
+
|
|
5
|
+
## What to Share
|
|
6
|
+
|
|
7
|
+
Share the entire `.cursor-scaffold/` folder. It contains:
|
|
8
|
+
|
|
9
|
+
- `README.md` - Main documentation
|
|
10
|
+
- `SETUP.md` - Quick setup guide
|
|
11
|
+
- `rules/scaffold-agent-context.mdc` - The agent instruction file
|
|
12
|
+
|
|
13
|
+
## Distribution Methods
|
|
14
|
+
|
|
15
|
+
### Option 1: Git Repository
|
|
16
|
+
|
|
17
|
+
Create a repository with just the scaffold:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Create a new repo
|
|
21
|
+
git init cursor-agent-scaffold
|
|
22
|
+
cd cursor-agent-scaffold
|
|
23
|
+
|
|
24
|
+
# Copy the scaffold folder
|
|
25
|
+
cp -r /path/to/project/.cursor-scaffold/* .
|
|
26
|
+
|
|
27
|
+
# Commit and push
|
|
28
|
+
git add .
|
|
29
|
+
git commit -m "Initial scaffold release"
|
|
30
|
+
git remote add origin <your-repo-url>
|
|
31
|
+
git push -u origin main
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Others can then:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git clone <your-repo-url>
|
|
38
|
+
cp -r cursor-agent-scaffold/* their-project/.cursor/
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Option 2: Zip File
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Create a zip
|
|
45
|
+
cd .cursor-scaffold
|
|
46
|
+
zip -r ../cursor-agent-scaffold.zip .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Share the zip file. Recipients extract it into their `.cursor/` folder.
|
|
50
|
+
|
|
51
|
+
### Option 3: NPM Package (Advanced)
|
|
52
|
+
|
|
53
|
+
If you want to distribute via npm:
|
|
54
|
+
|
|
55
|
+
1. Create a `package.json`:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"name": "cursor-agent-scaffold",
|
|
60
|
+
"version": "1.0.0",
|
|
61
|
+
"description": "Scaffold for Cursor AI agent context and rules system",
|
|
62
|
+
"files": ["README.md", "SETUP.md", "rules/"]
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
2. Publish:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm publish
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
3. Users install:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install cursor-agent-scaffold
|
|
76
|
+
cp -r node_modules/cursor-agent-scaffold/* .cursor/
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Option 4: Direct Copy
|
|
80
|
+
|
|
81
|
+
Simply share the `.cursor-scaffold/` folder directly via:
|
|
82
|
+
|
|
83
|
+
- File sharing service (Dropbox, Google Drive, etc.)
|
|
84
|
+
- Email (if small enough)
|
|
85
|
+
- Team drive/shared folder
|
|
86
|
+
|
|
87
|
+
## What Recipients Need to Do
|
|
88
|
+
|
|
89
|
+
1. Copy contents to `.cursor/` folder
|
|
90
|
+
2. Ask the agent: "Help me set up the context and rules system"
|
|
91
|
+
3. The agent handles the rest!
|
|
92
|
+
|
|
93
|
+
## Versioning
|
|
94
|
+
|
|
95
|
+
If you update the scaffold:
|
|
96
|
+
|
|
97
|
+
1. Update version in documentation
|
|
98
|
+
2. Note changes in a CHANGELOG
|
|
99
|
+
3. Share updated version
|
|
100
|
+
|
|
101
|
+
## Customization Before Sharing
|
|
102
|
+
|
|
103
|
+
You can customize the scaffold before sharing:
|
|
104
|
+
|
|
105
|
+
- Add project-specific examples
|
|
106
|
+
- Include common rule templates
|
|
107
|
+
- Add context file examples
|
|
108
|
+
- Customize the README with your branding
|
|
109
|
+
|
|
110
|
+
Just remember: The scaffold should remain **framework-agnostic** and **project-agnostic** to be useful to others.
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
Consider adding a LICENSE file if you plan to share publicly. MIT or CC0 are good choices for this type of tooling.
|
|
115
|
+
|
|
116
|
+
## Support
|
|
117
|
+
|
|
118
|
+
When sharing, include:
|
|
119
|
+
|
|
120
|
+
- Link to this README
|
|
121
|
+
- Instructions to read SETUP.md
|
|
122
|
+
- Your contact info if you want to provide support
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Installation script for cursor-agent-scaffold
|
|
5
|
+
* Copies scaffold files to .cursor/ folder in the current directory
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
const SCAFFOLD_DIR = __dirname.replace(/[\\/]bin$/, '');
|
|
12
|
+
const TARGET_DIR = path.join(process.cwd(), '.cursor');
|
|
13
|
+
|
|
14
|
+
// Files to copy (relative to scaffold root)
|
|
15
|
+
const FILES_TO_COPY = [
|
|
16
|
+
'README.md',
|
|
17
|
+
'SETUP.md',
|
|
18
|
+
'SHARING.md',
|
|
19
|
+
'rules/scaffold-agent-context.mdc',
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
function copyFile(src, dest) {
|
|
23
|
+
const destDir = path.dirname(dest);
|
|
24
|
+
if (!fs.existsSync(destDir)) {
|
|
25
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
26
|
+
}
|
|
27
|
+
fs.copyFileSync(src, dest);
|
|
28
|
+
console.log(`✓ Copied ${path.relative(process.cwd(), dest)}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function main() {
|
|
32
|
+
console.log('🚀 Installing Cursor Agent Context & Rules Scaffold...\n');
|
|
33
|
+
|
|
34
|
+
// Create .cursor directory if it doesn't exist
|
|
35
|
+
if (!fs.existsSync(TARGET_DIR)) {
|
|
36
|
+
fs.mkdirSync(TARGET_DIR, { recursive: true });
|
|
37
|
+
console.log(`✓ Created ${path.relative(process.cwd(), TARGET_DIR)}/ directory\n`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Create rules directory
|
|
41
|
+
const rulesDir = path.join(TARGET_DIR, 'rules');
|
|
42
|
+
if (!fs.existsSync(rulesDir)) {
|
|
43
|
+
fs.mkdirSync(rulesDir, { recursive: true });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Copy files
|
|
47
|
+
let copied = 0;
|
|
48
|
+
for (const file of FILES_TO_COPY) {
|
|
49
|
+
const src = path.join(SCAFFOLD_DIR, file);
|
|
50
|
+
const dest = path.join(TARGET_DIR, file);
|
|
51
|
+
|
|
52
|
+
if (fs.existsSync(src)) {
|
|
53
|
+
copyFile(src, dest);
|
|
54
|
+
copied++;
|
|
55
|
+
} else {
|
|
56
|
+
console.warn(`⚠ Warning: ${file} not found in scaffold`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
console.log(`\n✅ Successfully installed ${copied} file(s) to .cursor/`);
|
|
61
|
+
console.log('\n📖 Next steps:');
|
|
62
|
+
console.log(' 1. Open Cursor');
|
|
63
|
+
console.log(' 2. Ask the agent: "Help me set up the context and rules system for this project"');
|
|
64
|
+
console.log(' 3. The agent will analyze your codebase and create appropriate rules\n');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Run if called directly
|
|
68
|
+
if (require.main === module) {
|
|
69
|
+
try {
|
|
70
|
+
main();
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error('❌ Error installing scaffold:', error.message);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
module.exports = { main };
|
package/bin/verify.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Verification script run before publishing
|
|
5
|
+
* Ensures all required files are present
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
const REQUIRED_FILES = [
|
|
12
|
+
'README.md',
|
|
13
|
+
'SETUP.md',
|
|
14
|
+
'SHARING.md',
|
|
15
|
+
'rules/scaffold-agent-context.mdc',
|
|
16
|
+
'package.json',
|
|
17
|
+
'bin/install.js',
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
function verify() {
|
|
21
|
+
const scaffoldDir = __dirname.replace(/[\\/]bin$/, '');
|
|
22
|
+
const missing = [];
|
|
23
|
+
|
|
24
|
+
for (const file of REQUIRED_FILES) {
|
|
25
|
+
const filePath = path.join(scaffoldDir, file);
|
|
26
|
+
if (!fs.existsSync(filePath)) {
|
|
27
|
+
missing.push(file);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (missing.length > 0) {
|
|
32
|
+
console.error('❌ Missing required files:');
|
|
33
|
+
missing.forEach(file => console.error(` - ${file}`));
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.log('✅ All required files present');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
verify();
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cursor-agent-scaffold",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Scaffold package for setting up Cursor AI agent context and rules system",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cursor",
|
|
7
|
+
"ai",
|
|
8
|
+
"agent",
|
|
9
|
+
"scaffold",
|
|
10
|
+
"rules",
|
|
11
|
+
"context",
|
|
12
|
+
"development-tools"
|
|
13
|
+
],
|
|
14
|
+
"author": "C.G.",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": ""
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"README.md",
|
|
22
|
+
"SETUP.md",
|
|
23
|
+
"SHARING.md",
|
|
24
|
+
"PUBLISHING.md",
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"rules/",
|
|
27
|
+
"bin/"
|
|
28
|
+
],
|
|
29
|
+
"bin": {
|
|
30
|
+
"cursor-scaffold": "./bin/install.js"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"prepublishOnly": "node bin/verify.js"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=14.0.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Scaffold Agent Context System — Guide for setting up and maintaining context/rules structure
|
|
3
|
+
globs:
|
|
4
|
+
- ".cursor/**/*"
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Scaffold Agent Context System
|
|
9
|
+
|
|
10
|
+
This document guides the agent on how to set up, maintain, and evolve the `.cursor/` folder structure for context and rules.
|
|
11
|
+
|
|
12
|
+
## System Overview
|
|
13
|
+
|
|
14
|
+
The `.cursor/` folder contains two complementary systems:
|
|
15
|
+
|
|
16
|
+
### Rules (`.cursor/rules/*.mdc`)
|
|
17
|
+
**Purpose:** Prescriptive guidelines, requirements, and policies that must be followed.
|
|
18
|
+
|
|
19
|
+
**Characteristics:**
|
|
20
|
+
- Written as `.mdc` files with frontmatter (description, globs, alwaysApply)
|
|
21
|
+
- Define **what** must be done and **how** code should be structured
|
|
22
|
+
- Examples: naming conventions, linting policies, folder structure, design system rules
|
|
23
|
+
- Should be created early in project setup
|
|
24
|
+
- Apply broadly across the codebase
|
|
25
|
+
|
|
26
|
+
**When to create a rule:**
|
|
27
|
+
- Project-wide conventions (naming, file structure, linting)
|
|
28
|
+
- Design system requirements (tokens, variants, accessibility)
|
|
29
|
+
- Framework-specific patterns (routing, SSR, form handling)
|
|
30
|
+
- Quality gates and workflows (CI/CD, testing requirements)
|
|
31
|
+
|
|
32
|
+
### Context (`.cursor/context/*.md`)
|
|
33
|
+
**Purpose:** Learned patterns, decision frameworks, and best practices discovered during development.
|
|
34
|
+
|
|
35
|
+
**Characteristics:**
|
|
36
|
+
- Written as markdown files (`.md`)
|
|
37
|
+
- Document **why** decisions were made and **when** to apply patterns
|
|
38
|
+
- Capture patterns discovered through refactoring and problem-solving
|
|
39
|
+
- Created organically as patterns emerge
|
|
40
|
+
- Reference specific components, utilities, or architectural decisions
|
|
41
|
+
|
|
42
|
+
**When to create a context file:**
|
|
43
|
+
- After refactoring reveals a reusable pattern
|
|
44
|
+
- When a decision framework is needed for similar future tasks
|
|
45
|
+
- When documenting component composition strategies
|
|
46
|
+
- When capturing domain-specific patterns (e.g., form handling, navigation)
|
|
47
|
+
|
|
48
|
+
## Setup Instructions for New Projects
|
|
49
|
+
|
|
50
|
+
When a user drops this scaffold into an empty `.cursor/` folder, follow these steps:
|
|
51
|
+
|
|
52
|
+
### Step 1: Analyze the Codebase
|
|
53
|
+
|
|
54
|
+
1. **Identify the tech stack:**
|
|
55
|
+
- Framework (React, Vue, Angular, etc.)
|
|
56
|
+
- Styling approach (Tailwind, CSS modules, styled-components, etc.)
|
|
57
|
+
- State management (Redux, Zustand, Context API, etc.)
|
|
58
|
+
- Routing (React Router, Next.js, Inertia, etc.)
|
|
59
|
+
- Form handling (React Hook Form, Formik, Inertia Forms, etc.)
|
|
60
|
+
|
|
61
|
+
2. **Examine existing patterns:**
|
|
62
|
+
- File structure and organization
|
|
63
|
+
- Component naming conventions
|
|
64
|
+
- Import/export patterns
|
|
65
|
+
- Styling conventions
|
|
66
|
+
- Testing approach
|
|
67
|
+
|
|
68
|
+
3. **Review configuration files:**
|
|
69
|
+
- `package.json` (scripts, dependencies)
|
|
70
|
+
- Linting config (ESLint, Prettier)
|
|
71
|
+
- TypeScript config
|
|
72
|
+
- Build tools config
|
|
73
|
+
|
|
74
|
+
### Step 2: Create Initial Rules
|
|
75
|
+
|
|
76
|
+
Create rule files (`.mdc`) for each major area:
|
|
77
|
+
|
|
78
|
+
**Required rules to consider:**
|
|
79
|
+
|
|
80
|
+
1. **`naming-and-structure.mdc`**
|
|
81
|
+
- File naming conventions (kebab-case, PascalCase, etc.)
|
|
82
|
+
- Component naming
|
|
83
|
+
- Folder structure
|
|
84
|
+
- Import/export patterns
|
|
85
|
+
|
|
86
|
+
2. **`lint-and-style.mdc`**
|
|
87
|
+
- Linting requirements
|
|
88
|
+
- Formatting rules
|
|
89
|
+
- When to suppress vs fix
|
|
90
|
+
- Quality gates
|
|
91
|
+
|
|
92
|
+
3. **`design-system.mdc`** (if applicable)
|
|
93
|
+
- Design tokens
|
|
94
|
+
- Component variants
|
|
95
|
+
- Accessibility requirements
|
|
96
|
+
- Theme/color system
|
|
97
|
+
|
|
98
|
+
4. **`framework-patterns.mdc`**
|
|
99
|
+
- Framework-specific patterns
|
|
100
|
+
- Routing conventions
|
|
101
|
+
- State management patterns
|
|
102
|
+
- SSR/hydration considerations
|
|
103
|
+
|
|
104
|
+
5. **`workflows-and-ci.mdc`**
|
|
105
|
+
- Development workflows
|
|
106
|
+
- Git conventions
|
|
107
|
+
- CI/CD requirements
|
|
108
|
+
- Testing requirements
|
|
109
|
+
|
|
110
|
+
**Rule file template:**
|
|
111
|
+
|
|
112
|
+
```markdown
|
|
113
|
+
---
|
|
114
|
+
description: [Brief description of what this rule covers]
|
|
115
|
+
globs:
|
|
116
|
+
- "[path patterns to apply to, e.g., 'src/**/*', 'components/**/*']"
|
|
117
|
+
alwaysApply: true
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
# [Rule Title]
|
|
121
|
+
|
|
122
|
+
## [Section 1]
|
|
123
|
+
|
|
124
|
+
- [Guideline 1]
|
|
125
|
+
- [Guideline 2]
|
|
126
|
+
|
|
127
|
+
## [Section 2]
|
|
128
|
+
|
|
129
|
+
- [Guideline 3]
|
|
130
|
+
- [Guideline 4]
|
|
131
|
+
|
|
132
|
+
## Do / Don't
|
|
133
|
+
|
|
134
|
+
- ✅ [Good practice]
|
|
135
|
+
- ❌ [Bad practice]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Step 3: Create Context Scaffold
|
|
139
|
+
|
|
140
|
+
Create a `context-patterns.mdc` rule file that explains the context system:
|
|
141
|
+
|
|
142
|
+
```markdown
|
|
143
|
+
---
|
|
144
|
+
description: Reference context patterns — when to consult learned knowledge
|
|
145
|
+
globs:
|
|
146
|
+
- "[your source paths]"
|
|
147
|
+
alwaysApply: true
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Context Knowledge Base
|
|
151
|
+
|
|
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
|
+
|
|
154
|
+
## How to Use Context Files
|
|
155
|
+
|
|
156
|
+
1. **Before starting a task**, check if any context files are relevant
|
|
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
|
|
160
|
+
|
|
161
|
+
## Integration with Rules
|
|
162
|
+
|
|
163
|
+
Context files complement the rules in `.cursor/rules/`:
|
|
164
|
+
- **Rules** = Prescriptive guidelines and requirements
|
|
165
|
+
- **Context** = Learned patterns, decision frameworks, and best practices
|
|
166
|
+
|
|
167
|
+
Both should be considered when working on code.
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Step 4: Document the System
|
|
171
|
+
|
|
172
|
+
Create a `README.md` in `.cursor/` explaining:
|
|
173
|
+
- What rules vs context are
|
|
174
|
+
- How to use them
|
|
175
|
+
- How to add new ones
|
|
176
|
+
- Examples from the codebase
|
|
177
|
+
|
|
178
|
+
## Maintaining the System
|
|
179
|
+
|
|
180
|
+
### When to Create a New Rule
|
|
181
|
+
|
|
182
|
+
Create a new rule file when:
|
|
183
|
+
- A new project-wide convention is established
|
|
184
|
+
- A new framework/technology is adopted
|
|
185
|
+
- Quality gates or workflows change
|
|
186
|
+
- A pattern needs to be enforced across the codebase
|
|
187
|
+
|
|
188
|
+
**Example triggers:**
|
|
189
|
+
- "We're adopting TypeScript strict mode"
|
|
190
|
+
- "All forms must use React Hook Form"
|
|
191
|
+
- "Components must be tested with React Testing Library"
|
|
192
|
+
|
|
193
|
+
### When to Create a New Context File
|
|
194
|
+
|
|
195
|
+
Create a new context file when:
|
|
196
|
+
- A refactoring reveals a reusable pattern
|
|
197
|
+
- A decision framework is needed for similar tasks
|
|
198
|
+
- Component composition strategies emerge
|
|
199
|
+
- Domain-specific patterns are discovered
|
|
200
|
+
|
|
201
|
+
**Example triggers:**
|
|
202
|
+
- "We refactored the Button component and learned when to use variants vs separate components"
|
|
203
|
+
- "We built three forms and discovered patterns for validation"
|
|
204
|
+
- "We created a navigation system and learned external link handling patterns"
|
|
205
|
+
|
|
206
|
+
### Context File Template
|
|
207
|
+
|
|
208
|
+
```markdown
|
|
209
|
+
# [Pattern Name]
|
|
210
|
+
|
|
211
|
+
This document captures patterns, decisions, and best practices learned from [specific task/refactoring].
|
|
212
|
+
|
|
213
|
+
## Overview
|
|
214
|
+
|
|
215
|
+
This document focuses on:
|
|
216
|
+
- [Key area 1]
|
|
217
|
+
- [Key area 2]
|
|
218
|
+
- [Key area 3]
|
|
219
|
+
|
|
220
|
+
## Decision Framework
|
|
221
|
+
|
|
222
|
+
When [situation], consider:
|
|
223
|
+
|
|
224
|
+
1. **Factor 1**
|
|
225
|
+
- [Consideration]
|
|
226
|
+
- [Consideration]
|
|
227
|
+
|
|
228
|
+
2. **Factor 2**
|
|
229
|
+
- [Consideration]
|
|
230
|
+
- [Consideration]
|
|
231
|
+
|
|
232
|
+
## Patterns
|
|
233
|
+
|
|
234
|
+
### Pattern Name
|
|
235
|
+
|
|
236
|
+
**When to use:**
|
|
237
|
+
- [Situation 1]
|
|
238
|
+
- [Situation 2]
|
|
239
|
+
|
|
240
|
+
**Implementation:**
|
|
241
|
+
```typescript
|
|
242
|
+
// Example code
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Key guidance:**
|
|
246
|
+
- [Guideline 1]
|
|
247
|
+
- [Guideline 2]
|
|
248
|
+
|
|
249
|
+
## Examples
|
|
250
|
+
|
|
251
|
+
[Real examples from codebase]
|
|
252
|
+
|
|
253
|
+
## Anti-patterns
|
|
254
|
+
|
|
255
|
+
❌ **Don't:**
|
|
256
|
+
```typescript
|
|
257
|
+
// Bad example
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
✅ **Do:**
|
|
261
|
+
```typescript
|
|
262
|
+
// Good example
|
|
263
|
+
```
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Updating Context Files
|
|
267
|
+
|
|
268
|
+
When working on tasks:
|
|
269
|
+
1. **Before starting:** Check relevant context files
|
|
270
|
+
2. **During work:** Note patterns that emerge
|
|
271
|
+
3. **After completion:** Update or create context files if:
|
|
272
|
+
- A new pattern was discovered
|
|
273
|
+
- A decision framework was developed
|
|
274
|
+
- An existing pattern needs clarification
|
|
275
|
+
|
|
276
|
+
### Updating Rules
|
|
277
|
+
|
|
278
|
+
Update rules when:
|
|
279
|
+
- Conventions change
|
|
280
|
+
- New requirements are added
|
|
281
|
+
- Patterns become project-wide standards
|
|
282
|
+
- Quality gates evolve
|
|
283
|
+
|
|
284
|
+
## Best Practices
|
|
285
|
+
|
|
286
|
+
### Rule Writing
|
|
287
|
+
- Be specific and actionable
|
|
288
|
+
- Include examples (good and bad)
|
|
289
|
+
- Reference related rules/context files
|
|
290
|
+
- Use clear section headers
|
|
291
|
+
- Include "Do / Don't" sections
|
|
292
|
+
|
|
293
|
+
### Context Writing
|
|
294
|
+
- Start with the problem/situation
|
|
295
|
+
- Document the decision framework
|
|
296
|
+
- Include code examples
|
|
297
|
+
- Explain why, not just what
|
|
298
|
+
- Reference specific files/components when helpful
|
|
299
|
+
- Update as patterns evolve
|
|
300
|
+
|
|
301
|
+
### Organization
|
|
302
|
+
- Keep rules focused (one major area per file)
|
|
303
|
+
- Name context files descriptively (e.g., `form-validation-patterns.md`)
|
|
304
|
+
- Cross-reference related files
|
|
305
|
+
- Keep files maintainable (split if too long)
|
|
306
|
+
|
|
307
|
+
## Example Workflow
|
|
308
|
+
|
|
309
|
+
**Scenario:** Building a new form component
|
|
310
|
+
|
|
311
|
+
1. **Check rules:**
|
|
312
|
+
- `framework-patterns.mdc` for form handling conventions
|
|
313
|
+
- `design-system.mdc` for form field styling
|
|
314
|
+
- `lint-and-style.mdc` for code quality
|
|
315
|
+
|
|
316
|
+
2. **Check context:**
|
|
317
|
+
- `form-validation-patterns.md` (if exists)
|
|
318
|
+
- `component-composition-patterns.md` (if exists)
|
|
319
|
+
|
|
320
|
+
3. **Build the component** following rules and context
|
|
321
|
+
|
|
322
|
+
4. **After completion:**
|
|
323
|
+
- If new patterns emerged → create/update context file
|
|
324
|
+
- If conventions need enforcement → update/create rule
|
|
325
|
+
|
|
326
|
+
## Integration with Agent Behavior
|
|
327
|
+
|
|
328
|
+
The agent should:
|
|
329
|
+
- **Always check relevant context files** before starting tasks
|
|
330
|
+
- **Reference context files** when making decisions
|
|
331
|
+
- **Update context files** when patterns are discovered
|
|
332
|
+
- **Follow rules** as authoritative requirements
|
|
333
|
+
- **Suggest rule updates** when patterns become project-wide
|
|
334
|
+
|
|
335
|
+
## Quick Reference
|
|
336
|
+
|
|
337
|
+
| Type | Format | When to Create | Purpose |
|
|
338
|
+
|------|--------|----------------|---------|
|
|
339
|
+
| **Rule** | `.mdc` with frontmatter | Early setup, project-wide conventions | Enforce requirements |
|
|
340
|
+
| **Context** | `.md` markdown | As patterns emerge | Document learned patterns |
|
|
341
|
+
|
|
342
|
+
**Remember:** Rules tell you **what** to do. Context tells you **why** and **when**.
|