# RulePaste > Paste the rules your coding agent actually follows. RulePaste writes a ready-to-paste rules file for Cursor, Claude Code, Windsurf, GitHub Copilot, and Codex. Pick your stack. No account and no API key. RulePaste generates rules files from templates in the browser. It does not call a language model. The same choices always produce the same file. Stack pages are static and can be cited. ## Start here - [Generator](https://rulepaste.com/): Pick tools and a stack, then copy or download the rules file. - [What is a rules file?](https://rulepaste.com/guide): What a rules file is, why it matters, and how to install one. - [All stacks](https://rulepaste.com/rules): Index of ready-made stack pages. - [All tools](https://rulepaste.com/tools): File formats for Cursor, Claude Code, Windsurf, Copilot, Codex, and AGENTS.md. ## Stack rules - [Next.js rules file](https://rulepaste.com/rules/nextjs): A Next.js rules file for Cursor, Claude Code, Copilot, and Codex. App Router, async params, Server Components, Tailwind, and Vitest. - [Next.js + Supabase rules file](https://rulepaste.com/rules/nextjs-supabase): Rules for a Next.js and Supabase app: server cookies client, service-role key, Row Level Security, and generated database types. - [Next.js + Prisma rules file](https://rulepaste.com/rules/nextjs-prisma): Rules for Next.js with Prisma and Postgres-style schemas: one shared PrismaClient, committed migrations, and no database imports in client components. - [Next.js + Drizzle rules file](https://rulepaste.com/rules/nextjs-drizzle): Rules for Next.js and Drizzle ORM: drizzle-kit SQL migrations, one server-only client, and bound parameters. - [Next.js + Playwright rules file](https://rulepaste.com/rules/nextjs-playwright): Next.js rules plus Playwright end-to-end tests: role locators, no fixed sleeps, and the App Router constraints. - [React + Vite rules file](https://rulepaste.com/rules/react-vite): Rules for a React app on Vite: no Next.js APIs, public VITE_ env vars, and the router you already installed. - [Tailwind CSS rules file](https://rulepaste.com/rules/tailwind): Tailwind rules for coding agents: v3 config versus v4 @theme, design tokens, focus styles, and class ordering. - [SvelteKit rules file](https://rulepaste.com/rules/sveltekit): SvelteKit rules that match Svelte 4 or 5, load data on the server, and return fail() from form actions. - [Astro rules file](https://rulepaste.com/rules/astro): Astro rules for islands, content collections, and keeping client JavaScript off static pages. - [Nuxt rules file](https://rulepaste.com/rules/nuxt): Nuxt and Vue 3 rules: script setup, useFetch for server data, and secrets kept in server routes. - [Remix and React Router rules file](https://rulepaste.com/rules/remix): Rules for Remix v2 or React Router 7: use the package you have, loaders for data, actions for writes. - [Expo and React Native rules file](https://rulepaste.com/rules/expo): Expo rules that forbid HTML tags, pin SDK packages with expo install, and leave generated native projects alone. - [Supabase rules file](https://rulepaste.com/rules/supabase): Supabase rules for any frontend: RLS stays on, the service-role key stays on the server, types come from the CLI. - [FastAPI rules file](https://rulepaste.com/rules/python-fastapi): FastAPI rules for Pydantic v2, dependencies, uv, and pytest. Blocking IO stays out of async endpoints. - [FastAPI + Postgres rules file](https://rulepaste.com/rules/fastapi-postgres): FastAPI rules plus parameterized PostgreSQL: pooled connections, timestamptz, and append-only SQL migrations. - [Django rules file](https://rulepaste.com/rules/django): Django rules for migrations, the ORM, templates, and auth. Pytest and Postgres, managed with uv. - [Flask rules file](https://rulepaste.com/rules/flask): Flask rules for the app factory, blueprints, config from the environment, and pytest. - [Node and Express rules file](https://rulepaste.com/rules/node-express): Express rules for thin routes, Zod or the validator you already have, and one error middleware. - [NestJS rules file](https://rulepaste.com/rules/nestjs): NestJS rules for modules, providers, the ORM you already wired, and Jest. - [Hono rules file](https://rulepaste.com/rules/hono): Hono rules for edge and Node deploys: no Node APIs on Workers, Zod validator, HTTPException. - [Laravel rules file](https://rulepaste.com/rules/laravel): Laravel rules for form requests, Eloquent, env() only in config files, Pest, and Pint. - [Ruby on Rails rules file](https://rulepaste.com/rules/rails): Rails rules for strong parameters, Hotwire, reversible migrations, and RSpec or the default test suite. - [Unity C# rules file](https://rulepaste.com/rules/unity-csharp): Unity C# rules: SerializeField instead of Find, no allocations in Update, and no edits under Library. - [Godot 4 rules file](https://rulepaste.com/rules/godot): Godot 4 rules for scenes, signals, typed GDScript, and the GUT test addon when it is installed. - [Rust rules file](https://rulepaste.com/rules/rust): Rust rules for Cargo: Result and expect, no casual unsafe, rustfmt, clippy, and cargo test. - [Go rules file](https://rulepaste.com/rules/go): Go rules for gofmt, wrapped errors, context as the first parameter, and table-driven tests. - [TypeScript rules file](https://rulepaste.com/rules/typescript): TypeScript rules with no framework attached: strict mode, no new any, import type, and no floating promises. - [Prisma rules file](https://rulepaste.com/rules/prisma): Prisma rules with no web framework: schema migrations, one shared client, and parameterized raw SQL. ## Tools - [Cursor](https://rulepaste.com/tools/cursor): How Cursor project rules work in 2026: .cursor/rules/*.mdc frontmatter, alwaysApply, and the legacy .cursorrules file. - [Claude Code](https://rulepaste.com/tools/claude-code): Where Claude Code reads CLAUDE.md and how .claude/rules path-scoped rules work. - [Windsurf](https://rulepaste.com/tools/windsurf): Windsurf and Devin Desktop rules: .devin/rules, the .windsurf/rules fallback, and legacy .windsurfrules. - [GitHub Copilot](https://rulepaste.com/tools/github-copilot): GitHub Copilot custom instructions: .github/copilot-instructions.md and path-specific .instructions.md files. - [Codex](https://rulepaste.com/tools/codex): How OpenAI Codex discovers AGENTS.md, nested files, and the AGENTS.override.md footgun. - [AGENTS.md](https://rulepaste.com/tools/agents-md): What the AGENTS.md standard is, which coding agents read it, and how nested files work. ## Also - [Pro pack](https://rulepaste.com/pro): A planned paid add-on for deeper stack packs. Coming soon until a checkout link is configured. - [Privacy](https://rulepaste.com/privacy): The generator stores nothing. Newsletter and analytics run only when the site owner connects them. - [Feedback](https://rulepaste.com/feedback): Report a wrong rule or a missing stack. # What is a rules file? A rules file is a markdown file in your project that a coding agent reads before it changes anything. Cursor, Claude Code, Windsurf, GitHub Copilot, and Codex each look for a specific name. The contents are the notes you would give a new teammate who types very fast and forgets the boring constraints. ## Why vibe coding goes sideways without one If you do not say which stack you are on, the agent fills the gap with whatever it has seen most often. A Vite app grows a Next.js import. A Django project gets a second requirements file. A Unity script calls GameObject.Find because a tutorial did. None of that is malice. It is a missing instruction. A short rules file makes those guesses boring. The agent already knows the package manager, the test command, and that it should not touch generated folders. You spend the chat on the feature instead of on cleanup. ## What to put in it Write the things that are expensive when they are wrong, and skip the rest. A useful file is usually one to three screens. Past that, tools truncate it or the model skims. - Commands. The exact install, dev, test, and lint lines. Agents will run what you name. - Stack choices. Router, ORM, styling, language version, package manager. One of each. - Boundaries. Secrets, migrations that must not be edited, generated directories, and how much testing you want. - Conflicts. Say that existing code wins over the file, and that a direct instruction in chat wins over both. Leave the product pitch, the license, and the welcome paragraph in the README. The agent does not need them, and they crowd out the commands. ## Where each tool looks - Cursor: `.cursor/rules/project.mdc` with frontmatter. Set `alwaysApply: true` for a rule that should load every chat. Plain markdown in that folder is ignored. `.cursorrules` is the old filename. - Claude Code: `CLAUDE.md` at the repo root, or `.claude/CLAUDE.md`. Split later topics into `.claude/rules/*.md`. - Windsurf / Devin Desktop: `.devin/rules/project.md` with `trigger: always_on`. `.windsurfrules` is the legacy always-on file. Keep each file under about 12,000 characters. - GitHub Copilot: `.github/copilot-instructions.md`. Path-specific files live in `.github/instructions/` and must end in `.instructions.md`. - Codex and most other agents: `AGENTS.md` at the root. Nested files cover a single package. Do not leave an empty `AGENTS.override.md` next to a real file. The tool pages on this site show the frontmatter and the install steps for each of those names. ## How to install a file from RulePaste 1. Open the generator. Pick the tools you actually use and the stack the repo already has. Do not pick the stack you wish you had. 2. Copy or download each file. Save it at the path shown above the code, including the folders. Create `.cursor/rules` or `.github` if they are missing. 3. Commit the file with the rest of the project so the next session, and your teammates, get the same instructions. 4. Start a new chat. Rules are loaded when a session starts. An open chat often keeps the old ones. 5. Edit the file when the repo disagrees with it. The copy in your project is the source of truth. This site does not sync it back. ## How this generator works RulePaste does not call a language model. Each framework, database, and test runner is a written module. The generator stitches the modules you picked into one markdown document, then wraps that document in the header the tool requires. The same choices always produce the same file, which is why it is free to run. That also means the file is a starting point, not a portrait of your repo. If you use a custom script name or an unusual folder, change that line after you paste. An agent that follows a wrong command is worse than one with no command. ## Mistakes that waste the file - Pasting a giant style guide. The model will not hold all of it, and Windsurf may truncate the file. - Contradicting the code. If the rule says pnpm and the repo has package-lock.json, the agent will thrash. Match the repo, then fix the rule. - Hiding a secret in the file to "give the agent access". Commit the filename, never the key. - Generating once and never editing. Add a line when the agent makes the same mistake twice. That line is worth more than a generic paragraph. ## Guide FAQ ### Is a rules file the same as a README? No. A README is for people: what the project is and how to start it. A rules file is for the agent: the commands to run, the stack choices it must not guess, and the boundaries it must not cross. ### Do I need a different file for every AI tool? Often yes. Cursor wants .cursor/rules/*.mdc, Claude Code wants CLAUDE.md, Copilot wants .github/copilot-instructions.md, and Codex wants AGENTS.md. The advice inside can be the same. RulePaste wraps one set of rules in each format. ### Will a rules file stop the agent from making mistakes? It stops a class of mistakes: wrong package manager, invented folders, secrets in client code, tests that were never asked for. It does not review the diff. Read the change. ### Does RulePaste send my stack to an AI? No. The generator runs in your browser from templates. Nothing is uploaded when you click Generate. Copy or download the file and commit it. # Tool formats ## Cursor Cursor reads project rules from .cursor/rules as .mdc files. A plain .md file in that folder is ignored. RulePaste writes one always-on rule plus the older .cursorrules file for editors that still look for it. ## The file Cursor actually loads Put the rule at `.cursor/rules/project.mdc`. The folder can hold more than one file, and you can nest folders. Each file needs YAML frontmatter. `alwaysApply: true` puts the rule in every chat. A description without globs lets the agent pull the rule in when it sounds relevant. Globs attach the rule when a matching file is in context. If you set none of those, the rule loads only when you @-mention it. Cursor also reads a root `AGENTS.md` with no frontmatter. Use that when you want one portable file. Use `.mdc` when you want Cursor-specific scoping. The old `.cursorrules` file at the repo root still works on older builds, but new projects should prefer `.mdc`. ## Keep it short enough to follow - Aim for one concern per file once the rule grows. Cursor's own guidance is to keep a rule focused, well under 500 lines. - Start a new chat after you add or edit a rule. An open chat does not always pick the change up. - Commit the file. Project rules are meant to be shared with the repo. - If a rule is ignored, the frontmatter is the first thing to check. A missing closing `---` means the file never loads, and Cursor does not show an error. ## Claude Code Claude Code loads CLAUDE.md at the start of every session. RulePaste writes that file at the project root. When it gets too long, split it into .claude/rules without changing tools. ## Where to put it Save the file as `CLAUDE.md` in the project root, or as `.claude/CLAUDE.md` if you would rather keep the root clear. A personal file at `~/.claude/CLAUDE.md` applies to every repo on that machine. Project files should be committed. Nested `CLAUDE.md` files apply when Claude works in that directory. For a larger repo, add markdown files under `.claude/rules/`. A file with no frontmatter loads every session, same as CLAUDE.md. A file with `paths` loads only when Claude reads a matching file. `paths` is a YAML list of globs, not a single comma-separated string. ## What not to put in CLAUDE.md - It is re-read every session and again after compaction, so a long file costs context on every task. - Put one-off workflows in a skill or a slash command, not in CLAUDE.md. - Do not paste secrets. Claude will treat them as instructions and may repeat them. ## Windsurf Windsurf was rebranded to Devin Desktop in 2026. Current builds prefer .devin/rules. They still read .windsurf/rules and the legacy .windsurfrules file. RulePaste writes the new file and the legacy one. ## Which filename to use Prefer `.devin/rules/project.md`. The frontmatter field is `trigger`. `always_on` loads the rule in every chat. `glob` needs `globs` and loads when a matching file is touched. `model_decision` uses `description` so the model can pull it in. `manual` loads only when you @-mention the rule. `.windsurf/rules/` is the fallback directory. A root `.windsurfrules` file has no frontmatter and is always on. There is a hard size cap. Workspace rules are truncated around 12,000 characters per file, and the global rules file is shorter. A truncated rule fails silently. Keep always-on text short and move file-specific notes to a glob rule. - Devin Desktop also reads AGENTS.md. A root file is always on. A nested file applies to that directory. - If both `.devin/rules/project.md` and `.windsurfrules` exist, both can apply. Do not leave them contradicting each other. - Start a new Cascade chat after editing rules. ## GitHub Copilot Copilot's repository-wide instructions live at .github/copilot-instructions.md. Path-specific instructions are separate files under .github/instructions and need applyTo frontmatter. ## Repository instructions Create `.github/copilot-instructions.md` and commit it. The file is ordinary Markdown. Copilot uses it for Chat and, depending on your plan, for code review and the cloud coding agent. Whitespace between lines is ignored, so write short bullets instead of a long paragraph. For rules that only matter to some files, add `.github/instructions/something.instructions.md`. The name must end in `.instructions.md`. Frontmatter sets `applyTo` to a comma-separated glob list, for example `**/*.ts,**/*.tsx`. Copilot CLI also discovers `AGENTS.md` and `CLAUDE.md`. IDE support for those names is narrower, so the `.github` file is the one to rely on. ## Codex Codex reads AGENTS.md before it edits. The file is plain Markdown. There is no required schema. RulePaste writes a root AGENTS.md with the commands and boundaries for your stack. ## How Codex finds instructions Codex looks in `~/.codex` first (`AGENTS.override.md`, then `AGENTS.md`). It then walks from the git root down to the current directory and includes one file per directory: `AGENTS.override.md` if that file exists, otherwise `AGENTS.md`. Files closer to the work appear later and override earlier guidance. The combined text stops around 32 KiB unless you raise `project_doc_max_bytes`. An empty `AGENTS.override.md` still occupies that directory's slot. Codex then contributes no project rules from the `AGENTS.md` sitting next to it. Delete an override you no longer want. Do not leave it blank. - Put repository-wide rules at the root. Put service-specific rules in a nested AGENTS.md next to that service. - List the real test and lint commands. Codex will try to run the checks you name. - A repo marked untrusted in Codex config does not load project AGENTS.md. Trust the folder if you expect the file to apply. ## AGENTS.md AGENTS.md is an open Markdown file for coding agents, stewarded by the Agentic AI Foundation under the Linux Foundation. It is a README for the agent: commands, boundaries, and tests, without the product pitch you put in README.md. ## Who reads it Codex, Cursor, Copilot CLI, Devin Desktop, Amp, Jules, Factory, and a long list of other agents look for this filename. Tool-specific files (`.cursor/rules`, `CLAUDE.md`, `.github/copilot-instructions.md`) still matter when you want features only that tool has. AGENTS.md is the file you add when more than one agent will touch the repo. There are no required fields. The closest AGENTS.md to the file being edited wins when instructions disagree. A direct message in the chat wins over the file. Nested files are how monorepos avoid one giant instruction set. The OpenAI repo itself carries many of them. ## What to include - How to install, run, test, and lint, with the exact commands. - The stack choices an agent would otherwise guess: router, ORM, styling, package manager. - Boundaries: secrets, generated folders, migrations, and how much testing you want. - Leave the product overview and contribution welcome in README.md. # Sample rules files ## Next.js rules file URL: https://rulepaste.com/rules/nextjs This is the default file for a Next.js App Router app on TypeScript, Tailwind, and pnpm. It tells the agent that params and cookies are async, that fetch is not cached unless the project says so, and that secrets do not get a NEXT_PUBLIC_ prefix. ```md # Project rules Stack: TypeScript, Next.js, Tailwind CSS, Vitest, pnpm. Follow these rules on every task. If a rule disagrees with existing code, match the code and mention the difference. If a rule disagrees with a direct user instruction, follow the user. ## Working agreement - Read the files you will change before editing them. Do not invent the project layout from memory. - Change only what the task needs. No drive-by refactors, renames, or formatting of untouched lines. - Match the patterns already in the repo over a generic style guide. - Do not add dependencies, config files, or abstractions the task did not ask for. - Do not commit secrets, and do not paste `.env` values, tokens, or private keys into code or chat. - If a requirement is ambiguous, choose the smallest reading, state that assumption, and continue. ## Commands - JavaScript package manager is pnpm. The lockfile to commit is pnpm-lock.yaml. Do not add a second lockfile. - Install: `pnpm install`. - Dev server: `pnpm dev` when that script exists. - Lint: `pnpm lint` when that script exists. Typecheck with the project's typecheck script or `tsc --noEmit` if the repo uses it. - Build: `pnpm build` when you changed a build path. - Tests: `pnpm test`. Single pass, not watch mode: `pnpm exec vitest run`. - Run the narrowest command that checks the change. Do not loop install, build, or the full test suite. ## TypeScript - Leave `strict` on. Do not weaken `tsconfig` to make a build pass. - No new `any`, and no `// @ts-ignore`. Use `unknown` and narrow. `@ts-expect-error` needs a reason on that line. - Match the file's style for `type` versus `interface`. Prefer a string union over a new `enum` unless the file already uses enums. - Use `import type` for type-only imports. Await promises. Do not leave a promise floating. - Do not use a non-null assertion on a value that came from outside the function. Narrow it instead. ## Next.js - Use the App Router. Do not add a `pages/` router unless this repo already has one. - Server Components are the default. Add `"use client"` only for state, effects, browser APIs, or event handlers. - Await `params`, `searchParams`, `cookies()`, `headers()`, and `draftMode()`. On Next.js 15 and later they are async. - Do not assume `fetch` is cached. Add a cache flag or the `use cache` directive only where the surrounding code already does. - Mutations go through Server Actions or route handlers and are validated on the server. Client checks are not the source of truth. - Set metadata with the Metadata API. Use `next/link` for links and `next/image` with width and height, or `fill` plus `sizes`. - Do not import the database or secret env vars into a client component. A module that must stay on the server starts with `import "server-only"`. - Only `NEXT_PUBLIC_` variables may reach client code. Never prefix a secret with `NEXT_PUBLIC_`. ## Tailwind CSS - Style with Tailwind utilities. Do not add a CSS file or a CSS-in-JS library for a one-off. - Tailwind v4 is configured in CSS with `@theme` and usually has no `tailwind.config.js`. Tailwind v3 uses that config file. Do not add the other version's config. - Use the project's color, spacing, and radius tokens. Do not invent a second palette of arbitrary values. - Mobile-first breakpoints. Every control keeps a visible focus style. Icon-only buttons need an accessible name. - If `prettier-plugin-tailwindcss` is installed, let it order classes. Use `dark:` only when the project already has a dark theme. ## Vitest - Put tests next to the code as `*.test.ts`, or in the folder the repo already uses. - Use `describe`, `it`, and `expect`. A test name states the behavior. - Assert on values, text, or roles. Do not snapshot a whole component tree. - Mock only network, time, or the filesystem. Do not mock the function under test. - Run one pass with `vitest run` or the project's test script. Do not leave watch mode running. ## pnpm - pnpm is the package manager. The lockfile is `pnpm-lock.yaml`. Do not commit another JavaScript lockfile. - Add packages with `pnpm add ` and dev packages with `pnpm add -D `. Run scripts with `pnpm