Cursor rules generator for .cursor/rules
Cursor project rules are .mdc files in .cursor/rules with three frontmatter fields: description, globs and alwaysApply. This tool writes them for you, picks the right field combination for each rule type and checks the result.
Runs in your browser. What you type stays on this page. By Jake Marsh. Checked against Cursor docs: rules (project rules, .mdc frontmatter, rule types, size guidance) on 2026-11-16.
No problems found.
.cursor/rules/typescript.mdc
Save in your repo at this path.
---
description: TypeScript conventions for this repo
globs: **/*.ts, **/*.tsx
alwaysApply: false
---
# TypeScript
- Keep `strict` on. Fix type errors; do not silence them with `any` or `@ts-ignore`.
- Prefer `unknown` plus a narrowing check over `any` for data from outside the program.
- Use `import type` for type-only imports.
- Export one component or one function group per file, named after the file.
- Run `tsc --noEmit` before saying a change is done.
.cursor/rules/react-components.mdc
Save in your repo at this path.
---
description: React and Next.js component conventions
globs: app/**/*.tsx, components/**/*.tsx
alwaysApply: false
---
# React components
- Function components only. Keep server components the default; add `"use client"` only where state, effects or browser APIs need it.
- Props get a named type next to the component. No inline object types in the signature past two fields.
- Fetch data in server components or route handlers, not in effects.
- Every interactive element is a real `button` or `a` with an accessible name.
- Do not add a new UI library without asking first.
.cursor/rules/testing.mdc
Save in your repo at this path.
---
description: How to write and run tests here
globs: **/*.test.*, **/*.spec.*, tests/**
alwaysApply: false
---
# Tests
- A bug fix starts with a failing test that reproduces it.
- Test behavior through the public API. Do not assert on private helpers.
- No network calls; use fixtures in `tests/fixtures/`.
- Never delete or weaken a failing test to make a run pass. Fix the code or ask.
.cursor/rules/project-basics.mdc
Save in your repo at this path.
---
description:
globs:
alwaysApply: true
---
# Project basics
- Read the file before editing it. Match the style already there.
- Make the smallest change that solves the task; mention anything else you noticed instead of fixing it.
- Ask before adding a dependency, deleting files or changing config.
- Run the project's lint and test commands and report the result.
Write all files at once
Run from the repo root.
mkdir -p .cursor/rules
cat > .cursor/rules/typescript.mdc <<'CURSOR_RULE_1'
---
description: TypeScript conventions for this repo
globs: **/*.ts, **/*.tsx
alwaysApply: false
---
# TypeScript
- Keep `strict` on. Fix type errors; do not silence them with `any` or `@ts-ignore`.
- Prefer `unknown` plus a narrowing check over `any` for data from outside the program.
- Use `import type` for type-only imports.
- Export one component or one function group per file, named after the file.
- Run `tsc --noEmit` before saying a change is done.
CURSOR_RULE_1
cat > .cursor/rules/react-components.mdc <<'CURSOR_RULE_2'
---
description: React and Next.js component conventions
globs: app/**/*.tsx, components/**/*.tsx
alwaysApply: false
---
# React components
- Function components only. Keep server components the default; add `"use client"` only where state, effects or browser APIs need it.
- Props get a named type next to the component. No inline object types in the signature past two fields.
- Fetch data in server components or route handlers, not in effects.
- Every interactive element is a real `button` or `a` with an accessible name.
- Do not add a new UI library without asking first.
CURSOR_RULE_2
cat > .cursor/rules/testing.mdc <<'CURSOR_RULE_3'
---
description: How to write and run tests here
globs: **/*.test.*, **/*.spec.*, tests/**
alwaysApply: false
---
# Tests
- A bug fix starts with a failing test that reproduces it.
- Test behavior through the public API. Do not assert on private helpers.
- No network calls; use fixtures in `tests/fixtures/`.
- Never delete or weaken a failing test to make a run pass. Fix the code or ask.
CURSOR_RULE_3
cat > .cursor/rules/project-basics.mdc <<'CURSOR_RULE_4'
---
description:
globs:
alwaysApply: true
---
# Project basics
- Read the file before editing it. Match the style already there.
- Make the smallest change that solves the task; mention anything else you noticed instead of fixing it.
- Ask before adding a dependency, deleting files or changing config.
- Run the project's lint and test commands and report the result.
CURSOR_RULE_4
How to use it
- Click a starter rule for your stack, or load the example set.
- Choose when each rule applies: always, for matching files, when the agent judges it relevant, or only when you mention it.
- Edit the globs, description and rule text. The checks below the form flag empty rules, missing globs and very long files.
- Copy each file into .cursor/rules/ in your repo, or copy the install script and run it from the repo root.
- Open a chat in Cursor and ask for a change that touches a matching file to see the rule apply.
How the frontmatter maps to rule types
- Always apply: alwaysApply: true. Sent with every chat; globs and description are ignored.
- Apply to specific files: globs set (comma separated), alwaysApply: false. Attached when a matching file is in context.
- Apply intelligently: a description and no globs. The agent decides from the description.
- Apply manually: neither set. Used only when you type @rule-name in chat.
---
description: React component conventions
globs: app/**/*.tsx, components/**/*.tsx
alwaysApply: false
---
- Function components only.A plain .md file in .cursor/rules has no frontmatter and is ignored; project rules must end in .mdc. Cursor's docs suggest keeping each rule under 500 lines and splitting large ones into smaller rules.
Questions
- Where do Cursor rules go?
- In .cursor/rules at the repo root, one .mdc file per rule. Subfolders such as .cursor/rules/frontend/components.mdc work too, and the files are meant to be committed.
- How do I write globs in an .mdc file?
- Put patterns on one globs line separated by commas, for example globs: docs/**/*.md, docs/**/*.mdx. Do not wrap them in quotes.
- What is the difference between alwaysApply and globs?
- alwaysApply: true puts the rule in every chat. With alwaysApply: false and globs set, the rule is attached only when a matching file is in context. Use always-on sparingly, since it costs context every time.
- Should I use AGENTS.md or .cursor/rules?
- Cursor reads AGENTS.md in the project root and subfolders as plain Markdown with no metadata. Use .cursor/rules when you need per-file scoping or agent-decided rules; use AGENTS.md for instructions every tool should share.
- Does the page upload my rules?
- No. The files are built in your browser and nothing is sent anywhere.
Sources
Checked 2026-11-16.
Same task list for Cursor and Claude Code.
Rules tell an agent how to work. Taskhold gives Cursor, Claude Code, Codex and other MCP clients one shared list of what to work on, with steps, progress and questions you answer from your phone. See the Cursor setup page or the live board demo.
Or connect your agent first, no sign-up: add https://taskhold.com/api/mcp as an MCP server. The first time it uses Taskhold, it gives you the trial link.
Related tools
- Cursor hooks.json generator
Block risky shell commands, keep .env files out of the agent's context, format every edit, get notified when the agent stops, or send it back until the tests pass. Every generated script is tested.
- CLAUDE.md and AGENTS.md generator
Answer a few questions about your repo (stack, commands, rules, do-nots) and get a starter CLAUDE.md and AGENTS.md, either as one shared file or as two.
- MCP config generator and one-click install links
Paste one remote MCP server URL and its auth header; get the config for Claude Code, Cursor, Codex, Windsurf, VS Code, Gemini CLI, Antigravity CLI, Cline and OpenCode, plus one-click install links and README badges for Cursor, VS Code and Claude.