last update
May 27, 2026
license
MITv1.0.0
format
SKILL.md
- Install
// Downloads SKILL.md into ~/.claude/skills/cursor-rules-generator/
$ curl -fsSL --create-dirs -o ~/.claude/skills/cursor-rules-generator/SKILL.md https://claudeskil.com/skills/cursor-rules-generator/SKILL.md - Invoke
// Inside Claude Code, type the skill name as a slash command
> /cursor-rules-generator wire up a GitHub Actions deploy - Or just ask
// Claude loads the skill by itself when a request matches its description
> wire up a GitHub Actions deploy
- name:
- Cursor Rules Generator
- slug:
- cursor-rules-generator
- version:
- v1.0.0
- license:
- MIT
- author:
- @chiragthummar16
- categories:
- tags:
- #cursor#cursor-rules#ai-coding#ide#conventions
- description:
Generate .cursorrules / .cursor/rules.mdc files that actually teach Cursor your codebase conventions.
README.md
Cursor Rules Generator
Cursor's AI is only as good as the context it has about your codebase. Without explicit rules it guesses at your conventions — and keeps reaching for the wrong import style, the wrong test framework, or a folder layout you abandoned months ago. This skill scans your repo and writes a .cursorrules (legacy) or .cursor/rules/*.mdc (current Project Rules) file grounded in how your code is actually written, so Cursor stops guessing.
When to use it
- You just adopted Cursor on an existing project and want it productive on day one.
- Cursor keeps generating code in a style your team doesn't use (default exports vs. named,
axiosvs.fetch, class components vs. hooks). - You're migrating from the deprecated root
.cursorrulesto the newer.cursor/rulesdirectory format. - A new monorepo package needs its own scoped rules separate from the rest.
How it works
The skill reads representative source files, config (package.json, tsconfig.json, eslint/prettier configs, vitest/jest setup), and folder structure, then infers and documents:
- Naming & layout — file casing, component/hook/util locations, barrel-file usage.
- Imports — path aliases (e.g.
@/), import ordering, named vs. default. - Framework rules — React Server vs. Client components, Next.js App Router conventions, data-fetching patterns.
- Testing — which runner, where specs live, naming (
*.test.tsvs.*.spec.ts). - Error handling — Result types, custom error classes, logging conventions.
It emits MDC files with proper frontmatter (description, globs, alwaysApply) so rules attach to the right files. alwaysApply: true rules load on every request; globs-scoped rules activate only when matching files are in context.
Example
curl -fsSL --create-dirs -o ~/.claude/skills/cursor-rules-generator/SKILL.md https://claudeskil.com/skills/cursor-rules-generator/SKILL.md
# then, in your project:
"Generate Cursor rules for this repo using the .mdc format"
Produces .cursor/rules/general.mdc:
---
description: Project-wide conventions
globs: ["**/*.ts", "**/*.tsx"]
alwaysApply: true
---
- Use named exports; no default exports except Next.js pages.
- Import internal modules via the `@/` alias, never relative `../../`.
- Co-locate tests as `Component.test.tsx` and run with Vitest.
- Server Components by default; add `"use client"` only when hooks/events are needed.
Tips & gotchas
- Prefer the
.cursor/rulesdirectory over a single root.cursorrules— the latter is deprecated and harder to scope. Multiple focused.mdcfiles beat one giant rule. - Keep
alwaysApplyrules short. Everything marked always-apply consumes context on every prompt; reserveglobsfor the rest. - In monorepos, place package-specific
.mdcfiles inside each package's.cursor/rules/rather than cramming everything at the root. - Regenerate after big refactors — stale rules actively mislead Cursor.
FAQ
Does this replace my ESLint/Prettier config? No. Those enforce style mechanically; this teaches the AI before it writes code, reducing churn the linter would otherwise catch.
Legacy .cursorrules or new .mdc? Both are supported. The skill defaults to .cursor/rules/*.mdc since Cursor is phasing out the single-file format; ask for .cursorrules if you need it.
Will it overwrite my existing rules? It reads what you have and merges rather than clobbering, but review the diff before committing.
$ cat reviews/