Stackmark › Prompts

Layer .cursor/rules/*.mdc by scope

Per-folder .mdc rules with globs beat one giant .cursorrules — the model only sees what's relevant to the file it's editing.

  • Type: Prompt
  • Tags: Coding Agent Hacks, Intermediate, Cursor
  • Updated: 2026-10-01

Prompt

Per-folder .mdc rules with globs beat one giant .cursorrules — the model only sees what's relevant to the file it's editing. Cursor's modern rule system lets you scope rules with a `globs:` frontmatter field. Put TS conventions in `rules/typescript.mdc` (globs: **/*.ts), API patterns in `rules/api.mdc` (globs: app/api/**), etc. Smaller, more relevant prompts → fewer hallucinated patterns. Implementation example: --- description: API route conventions globs: app/api/**/*.ts alwaysApply: false --- - Validate inputs with zod at the top of the handler - Return NextResponse.json — never raw Response - Errors: throw ApiError(status, code, message)

More prompts

Privacy · Terms · llms.txt