Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Reference architecture for Cursor IDE projects: directory structure, rules organization, indexing strategy, and team configuration patterns. Triggers on "cursor architecture", "cursor project structure", "cursor best practices", "cursor file structure".
.claude/skills/jeremylongshore-cursor-reference-architecture/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 73% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 54% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 68% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 137% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 125% | 0% |
Organize Cursor rules, ignore files, repository guidance, and workspace boundaries so AI assistance follows architecture rather than inventing it.
.cursor/rules, ignore files, and shared templates.| Condition | Safe response | |---|---| | Rules conflict | Reduce them to one authoritative rule and test in a small workspace. | | Sensitive paths are indexed | Add an ignore rule, verify exclusion, and evaluate exposure according to policy. | | A shared template breaks a repo | Revert the configuration change and use a scoped repository override. |
For a monorepo, commit a reviewed root rule for shared import conventions and scoped rules for each application. Add secrets, generated artifacts, and customer exports to ignore configuration, then verify a sample chat cannot attach those paths.
Reference architecture patterns for optimizing Cursor IDE project setup. Covers directory structure, rules organization, indexing strategy, and multi-project configuration for maximum AI effectiveness.
A well-structured project makes AI features significantly more effective:
my-project/
├── .cursor/
│ └── rules/
│ ├── project.mdc # alwaysApply: true (stack, conventions)
│ ├── security.mdc # alwaysApply: true (security constraints)
│ ├── typescript.mdc # globs: "**/*.ts,**/*.tsx"
│ ├── api-routes.mdc # globs: "src/api/**/*.ts"
│ ├── database.mdc # globs: "src/db/**/*.ts,prisma/**"
│ └── testing.mdc # globs: "**/*.test.ts,**/*.spec.ts"
├── .cursorignore # Exclude from AI + indexing
├── .cursorindexingignore # Exclude from indexing only
├── .gitignore
├── src/
│ ├── api/ # API routes
│ ├── services/ # Business logic
│ ├── db/ # Database layer
│ ├── types/ # Shared TypeScript types
│ ├── utils/ # Utility functions
│ └── components/ # UI components
├── tests/
├── prisma/
├── docs/ # Architecture docs (good for @Docs)
└── package.jsonsrc/api/**/*.ts cleanly scopes API rules@src/types/user.ts is discoverableyaml# .cursor/rules/project.mdc --- description: "Core project context and conventions" globs: "" alwaysApply: true --- # SaaS Dashboard Application Stack: Next.js 15 (App Router), TypeScript 5.7, PostgreSQL 16, Prisma 6 Auth: NextAuth.js v5 with GitHub OAuth Styling: Tailwind CSS 4 Testing: Vitest + Playwright Package manager: pnpm ## Architecture Decisions - Server Components by default, "use client" only when needed - Repository pattern for database access - Zod schemas for all external input validation - Result types for error handling (never throw from services)
yaml# .cursor/rules/security.mdc --- description: "Security constraints for all AI-generated code" globs: "" alwaysApply: true --- # Security Requirements - NEVER hardcode secrets, API keys, or passwords - ALWAYS use parameterized queries (no string interpolation in SQL) - ALWAYS validate and sanitize user input with Zod - NEVER disable CORS, CSRF protection, or TLS verification - Use httpOnly, secure, sameSite cookies for auth tokens - Rate limit all public API endpoints
yaml# .cursor/rules/react-components.mdc --- description: "React component patterns" globs: "src/components/**/*.tsx,app/**/*.tsx" alwaysApply: false --- # Component Standards - Named exports only (no default exports) - Props interface: {ComponentName}Props - Use forwardRef for interactive components - Colocate tests: Component.test.tsx next to Component.tsx - Loading states: use Suspense boundaries, not conditional rendering
yaml# .cursor/rules/api-routes.mdc --- description: "API route handler patterns" globs: "app/api/**/*.ts,src/api/**/*.ts" alwaysApply: false --- # API Route Standards - All handlers wrapped in withAuth() middleware - Input validation with Zod (parse body, params, query) - Response shape: { data: T } or { error: string, code: string } - HTTP status codes: 200 OK, 201 Created, 400 Bad Request, 401, 403, 404, 500 - Structured logging with requestId for traceability
yaml# .cursor/rules/database.mdc --- description: "Database access patterns" globs: "src/db/**/*.ts,src/repositories/**/*.ts,prisma/**" alwaysApply: false --- # Database Conventions - All queries via repository classes (never raw Prisma in API routes) - Use transactions for multi-table writes - Always include select/include to avoid over-fetching - Pagination: cursor-based for lists, offset for admin tools - Soft delete: use deletedAt timestamp, never hard delete user data
yaml# .cursor/rules/deployment.mdc --- description: "Deployment and infrastructure patterns" globs: "" alwaysApply: false --- # Deployment - Vercel for frontend, Railway for API - Environment variables managed in Vercel/Railway dashboards - Database migrations: `prisma migrate deploy` in CI - Feature flags via LaunchDarkly
Reference manually with @Cursor Rules in Chat when discussing deployment.
gitignore# Build output dist/ build/ .next/ out/ .vercel/ .turbo/ coverage/ # Dependencies node_modules/ .pnpm-store/ # Generated *.min.js *.min.css *.d.ts.map *.tsbuildinfo pnpm-lock.yaml # Data / Assets *.csv *.sql *.sqlite *.png *.jpg *.gif *.svg *.ico *.woff *.woff2 *.ttf # Environment .env* # IDE .vscode/ .idea/
gitignore# Not indexed, but accessible via @Files docs/api-spec.yaml tests/fixtures/ scripts/migration-data/
monorepo/
├── .cursor/
│ └── rules/
│ ├── monorepo.mdc # alwaysApply: true (shared conventions)
│ ├── shared-types.mdc # globs: "packages/shared/**"
│ ├── api.mdc # globs: "apps/api/**"
│ └── web.mdc # globs: "apps/web/**"
├── .cursorignore
├── apps/
│ ├── api/
│ ├── web/
│ └── admin/
├── packages/
│ ├── shared/
│ ├── ui/
│ └── config/
├── turbo.json
└── pnpm-workspace.yamlKey rule for monorepos:
yaml# .cursor/rules/monorepo.mdc --- description: "Monorepo import conventions" globs: "" alwaysApply: true --- # Import Conventions - Import shared types: import { User } from '@myorg/shared' - Import UI components: import { Button } from '@myorg/ui' - NEVER use relative paths across package boundaries - Each package has its own tsconfig.json extending root
| File | Committed to Git | Purpose | |------|-----------------|---------| | .cursor/rules/*.mdc | Yes | AI behavior rules (team-shared) | | .cursorignore | Yes | File exclusion from AI + indexing | | .cursorindexingignore | Yes | File exclusion from indexing only | | settings.json (Cursor) | No (machine-local) | Editor preferences | | keybindings.json (Cursor) | No (machine-local) | Custom shortcuts |
.cursor/rules/ changes like infrastructure changes -- require PR reviewdocs/ directory indexed so AI can reference architecture decisions via @Docs| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 14,957 | 9,567 | -36% | 1 | 1 | 0% | 2,123 | 3,678 | +73% | 0 | 0 | — |
case-02 | pass→pass | 7,371 | 6,710 | -9% | 1 | 1 | 0% | 1,243 | 2,949 | +137% | 0 | 0 | — |
case-03 | fail→pass | 11,514 | 6,743 | -41% | 1 | 1 | 0% | 2,010 | 3,101 | +54% | 0 | 0 | — |
case-04 | pass→pass | 24,707 | 13,993 | -43% | 1 | 1 | 0% | 1,315 | 2,961 | +125% | 0 | 0 | — |
case-05 | pass→pass | 13,955 | 13,129 | -6% | 1 | 1 | 0% | 1,619 | 3,080 | +90% | 0 | 0 | — |
case-06 | pass→pass | 16,634 | 4,179 | -75% | 1 | 1 | 0% | 2,865 | 2,754 | -4% | 0 | 0 | — |
case-07 | pass→pass | 4,511 | 5,618 | +25% | 1 | 1 | 0% | 842 | 3,018 | +258% | 0 | 0 | — |
case-08 | pass→pass | 10,946 | 11,059 | +1% | 1 | 1 | 0% | 2,066 | 4,065 | +97% | 0 | 0 | — |
case-09 | pass→pass | 8,476 | 8,090 | -5% | 1 | 1 | 0% | 1,505 | 3,353 | +123% | 0 | 0 | — |
case-10 | pass→pass | 12,668 | 10,600 | -16% | 1 | 1 | 0% | 2,320 | 4,065 | +75% | 0 | 0 | — |
case-11 | fail→pass | 12,551 | 9,780 | -22% | 1 | 1 | 0% | 2,262 | 3,801 | +68% | 0 | 0 | — |
case-12 | pass→pass | 12,738 | 11,932 | -6% | 1 | 1 | 0% | 2,261 | 3,986 | +76% | 0 | 0 | — |
case-13 | pass→pass | 6,655 | 2,983 | -55% | 1 | 1 | 0% | 1,180 | 2,552 | +116% | 0 | 0 | — |
case-14 | pass→pass | 3,228 | 1,805 | -44% | 1 | 1 | 0% | 506 | 2,299 | +354% | 0 | 0 | — |
case-15 | fail→fail | 14,672 | 11,701 | -20% | 1 | 1 | 0% | 2,799 | 4,003 | +43% | 0 | 0 | — |
case-16 | pass→pass | 15,038 | 12,979 | -14% | 1 | 1 | 0% | 2,877 | 4,519 | +57% | 0 | 0 | — |
case-17 | pass→pass | 12,092 | 5,516 | -54% | 1 | 1 | 0% | 2,083 | 2,856 | +37% | 0 | 0 | — |
case-18 | pass→pass | 11,840 | 10,432 | -12% | 1 | 1 | 0% | 2,716 | 4,316 | +59% | 0 | 0 | — |
case-19 | pass→pass | 11,913 | 12,409 | +4% | 1 | 1 | 0% | 2,144 | 4,141 | +93% | 0 | 0 | — |
case-20 | pass→pass | 11,601 | 7,215 | -38% | 1 | 1 | 0% | 2,027 | 3,185 | +57% | 0 | 0 | — |
case-21 | pass→pass | 7,648 | 7,585 | -1% | 1 | 1 | 0% | 1,429 | 3,344 | +134% | 0 | 0 | — |
case-22 | pass→pass | 5,487 | 4,192 | -24% | 1 | 1 | 0% | 1,044 | 2,694 | +158% | 0 | 0 | — |
case-23 | fail→fail | 3,535 | 2,601 | -26% | 1 | 1 | 0% | 624 | 2,453 | +293% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +13 percentage points is the difference between those two pass rates over the 23 comparable cases.
The publisher has shipped newer versions since this run, so these numbers describe v1, not the version currently listed.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.