A comprehensive, portable configuration for Cursor AI that includes rules, commands, and a self-improving learning system.
- Copy all files to your project's
.cursor/directory - Create the folder structure:
.cursor/ ├── rules/ # Rule files (.mdc) ├── commands/ # Command files (.md) ├── plans/ # Auto-generated plan files ├── context/ # Session context cache ├── patterns.md # Learning log ├── credentials.md # Your secrets (gitignored) └── .gitignore - Rename
cursor-gitignoreto.gitignore - Rename
patterns-template.mdtopatterns.md - Create work-specific files (see below)
After copying these files, configure them for YOUR project:
This file describes YOUR system. Template:
---
description: "Your system architecture"
globs: ["**/*"]
---
# System Architecture
## Services
| Service | Purpose | Tech Stack |
|---------|---------|------------|
| api | Main backend | Node.js, PostgreSQL |
## Authentication
- Provider: <!-- Firebase Auth / Supabase / Clerk / none -->
## Infrastructure
- Hosting: <!-- Vercel / Railway / AWS / local -->
- Database: <!-- PostgreSQL / SQLite / MongoDB / none -->Store your dev secrets locally.
Replace these comments with your specifics:
- UI framework
- Inter-service communication
- Issue tracker (or remove if not using)
Delete what does not apply:
- Issue tracker integration (if solo project)
- CI/CD monitoring (if no pipelines)
- Cloud CLI commands (if local-only)
| File | Purpose |
|---|---|
global.mdc |
Core behavior, git restrictions, self-improvement triggers |
workflow.mdc |
Full development lifecycle (Research → Plan → Implement → Validate) |
planning.mdc |
Plan-first approach with assumptions |
subagents.mdc |
Parallel task execution with background agents |
thinking.mdc |
Extended thinking for complex problems |
agentic.mdc |
Autonomous coding philosophy |
testing.mdc |
Test patterns and automation |
typescript.mdc |
TypeScript/React rules |
python.mdc |
Python rules |
ruby.mdc |
Ruby/Rails rules |
react-advanced.mdc |
React hooks, performance, composition |
| Category | Commands |
|---|---|
| Git/PR | /ship, /commit-message, /pr-description, /ci-monitor |
| Code Quality | /code-review, /security-review, /refactor, /refactor-check |
| Testing | /write-tests, /coverage-gaps, /manual-test |
| Analysis | /impact-analysis, /breaking-changes, /dead-code, /duplicate-check |
| Documentation | /document, /api-docs, /changelog, /runbook |
| Self-Improvement | /retro, /pattern-log, /rules-review, /debug-loop |
| Utilities | /explain, /explain-error, /fix-lint, /add-types, /optimize |
| File | Purpose |
|---|---|
patterns-template.md |
Learning log template |
context-README.md |
Context folder documentation |
credentials.example.md |
Credentials template |
cli-config.json |
Command restrictions |
These files are not included because they contain project/company-specific information. Create them yourself:
---
description: "System architecture, design patterns, and high-level context"
globs: ["**/*"]
---
# System Architecture
## Overview
[Describe your system's high-level architecture]
## Key Services
| Service | Purpose | Tech Stack |
|---------|---------|------------|
| service-name | What it does | Node.js, PostgreSQL |
## Team Ownership
| Team | Repositories |
|------|--------------|
| Team Name | repo1, repo2 |
## Authentication & Authorization
- Auth provider: [Your identity provider]
- Token types: [Access, ID, etc.]
- Key audiences: [API URLs]
## Environment URLs
| Environment | URL |
|-------------|-----|
| Production | https://... |
| Staging | https://... |
| Development | https://... |
## Critical Gotchas
- [Service-specific gotchas discovered during development]
## Key Documentation Links
- [Your documentation links]---
description: "Ticket system integration"
globs: ["**/*"]
---
# Ticket Integration
## Issue Tracker Configuration
- Project keys: [PROJ, TEAM, etc.]
- Board URL: https://your-company.atlassian.net/...
## Ticket Patterns
- Feature: `TICKET-###`
- Bug: `BUG-###`
## Branch Naming
Format: `TICKET-123-short-description`
## Required Fields
- Acceptance Criteria
- Story Points
- ComponentCopy from credentials.example.md and fill in:
# Credentials (DO NOT COMMIT)
## Auth Provider Domains
| Environment | Domain |
|-------------|--------|
| Production | auth.example.com |
| Development | auth.dev.yourcompany.com |
## M2M Clients
| Purpose | Client ID | Client Secret | Audience |
|---------|-----------|---------------|----------|
| Service A | xxx | xxx | https://api.yourcompany.com |
## Test Users
| Environment | Email | Password | Notes |
|-------------|-------|----------|-------|
| Dev | test@example.com | xxx | Admin user |{
"mcpServers": {
"your-mcp-server": {
"command": "npx",
"args": ["-y", "your-mcp-package"],
"env": {
"API_KEY": "your-key"
}
}
}
}This system learns from your corrections:
- Auto-Retro: When you correct the AI, it immediately updates rules
- Pattern Logging: Discoveries are logged to
patterns.md - Background Learning: Complex corrections spawn background agents
- Generalization: Fixes are made broadly applicable, not project-specific
You: "Why did I have to tell you to check the config file?"
AI: "Got it - I should self-investigate configuration errors. Updating now..."
[Updates global.mdc with troubleshooting rule]
[Logs to patterns.md]
"Fixed. Continuing..."
.cursor/
├── rules/ # AI behavior rules
│ ├── global.mdc # Core rules (always applied)
│ ├── workflow.mdc # Development lifecycle
│ ├── architecture.mdc # YOUR system architecture
│ └── ...
├── commands/ # Slash commands
│ ├── ship.md # Git workflow
│ ├── manual-test.md # Testing guide
│ └── ...
├── plans/ # Auto-generated task plans
├── context/ # Session context cache
│ └── README.md
├── patterns.md # Learning log
├── credentials.md # Secrets (gitignored)
├── credentials.example.md # Template
├── cli-config.json # Command restrictions
├── mcp.json # MCP servers
└── .gitignore # Ignore secrets & temp files
- Mention the ticket: "Implement TICKET-123"
- AI fetches ticket details (if MCP configured)
- AI creates a plan with assumptions
- You confirm assumptions
- AI implements, validates, and documents
- Run
/shipto commit, push, and create PR /ci-monitorwatches GitHub Actions- If CI fails, AI auto-fixes and learns
- Run
/retrofor session learnings
- AI acknowledges the correction
- Updates relevant rule/command immediately
- Logs to
patterns.md - Generalizes the fix for all projects
MIT - Use freely, modify as needed, share improvements!