AI Coding Rules

Curated rules-file library, guided generator, and format converter for every major AI coding assistant — Cursor, Claude Code, GitHub Copilot, Windsurf, Cline, Aider, Continue, and Cody.

Stack library

Hand-curated rules files for 20 popular stacks. Each one includes copy buttons for every AI tool format.

search

Next.js (App Router) + TypeScript

AI coding rules for Next.js 15 App Router with TypeScript strict mode, named exports, server components by default, and Tailwind. Production-grade conventions for Cursor, Claude Code, and Copilot.

typescriptnextjsapp-router

Next.js App Router (TypeScript, Server Components)

Opinionated rules for Next.js App Router projects: when to mark "use client", how to do data fetching in RSC, route handlers vs server actions, and metadata conventions. Built for AI assistants that keep mixing in Pages Router patterns.

nextjsapp-routerrsc

Next.js + Supabase (Auth, Postgres, RLS)

AI rules for Next.js + Supabase: server-side auth helpers, RLS-first data access, type generation, and storage patterns. Stops the AI from leaking the service-role key into client code.

nextjssupabasepostgres

Next.js + Prisma + Postgres

Rules for Next.js + Prisma projects: schema-first design, migration workflow, transaction patterns, and how to call Prisma from server components without leaking it to the client.

nextjsprismapostgres

React 19 + TypeScript (Vite)

Rules for plain React + TypeScript projects (Vite, no framework). Functional components only, hooks conventions, named exports, strict TS, and a reasonable default for state and data fetching.

reacttypescriptvite

React Native + Expo (managed workflow)

Rules for Expo-based React Native: file-based routing with expo-router, NativeWind for styling, EAS for builds, and platform-aware patterns that keep iOS and Android in sync.

react-nativeexpoexpo-router

Python + FastAPI + SQLAlchemy + Alembic

Rules for FastAPI projects with Pydantic v2 models, SQLAlchemy 2.0 async ORM, Alembic migrations, dependency-injection patterns, and pytest-asyncio for tests.

pythonfastapisqlalchemy

Python + Django + DRF

Rules for Django projects: app structure, models-first design, DRF serializer conventions, migrations workflow, and signal usage. Stops the AI from inventing fictional Django APIs.

pythondjangodrf

Python + pandas + numpy + scikit-learn (Jupyter)

Rules for data-science notebooks and scripts: pandas idioms, numpy vectorization, scikit-learn pipelines, environment management with uv, and reproducible-result conventions.

pythonpandasnumpy

PyTorch + Hugging Face + W&B

Rules for PyTorch model-training projects: dataset/loader patterns, mixed-precision, distributed training defaults, Hugging Face transformers integration, and W&B logging conventions.

pythonpytorchhuggingface

Node.js + Express + TypeScript

Rules for Node.js + Express APIs in TypeScript: layered architecture, async error handling, Zod validation at boundaries, structured logging, and graceful shutdown.

nodejsexpresstypescript

Turborepo + pnpm + TypeScript

Rules for Turborepo monorepos: workspace structure, internal-package conventions, TypeScript project references, shared ESLint/Prettier configs, and remote-caching workflow.

monorepoturborepopnpm

SvelteKit + Svelte 5 + TypeScript

Rules for SvelteKit projects with Svelte 5 runes: data-loading conventions, form actions, page-level vs component-level state, and adapter setup. Updates the AI from Svelte 4 patterns.

sveltesveltekitsvelte-5

Astro + Content Collections + TypeScript

Rules for Astro content sites: islands architecture, content collections with Zod schemas, View Transitions, and integration patterns. Keeps the AI from over-using framework islands.

astrocontent-collectionsislands

Vue 3 + Nuxt 3 + TypeScript

Rules for Nuxt 3 projects with Vue 3 composition API: <script setup>, auto-imports, Pinia state, server routes, and useFetch / useAsyncData patterns. No Options API holdovers.

vuenuxtcomposition-api

Go + chi + sqlc + Postgres

Rules for Go HTTP services: standard-library-first, chi for routing, sqlc for type-safe queries, structured errors, context propagation, and testable handlers.

gogolangchi

Rust + Axum + sqlx + tokio

Rules for Rust web services with Axum: tower middleware, sqlx for compile-time-checked queries, tokio runtime conventions, structured tracing, and ergonomic error types.

rustaxumsqlx

Rails 8 + Hotwire + Postgres

Rules for Rails 8 projects: convention-over-configuration discipline, Hotwire-first UI, ActiveRecord patterns, fat models / skinny controllers, and system tests.

rubyrailshotwire

Laravel 11 + Livewire + Pest

Rules for Laravel projects: Eloquent conventions, form requests, queued jobs, Livewire components, and Pest test style. Keeps the AI from defaulting to PHPUnit and old Laravel patterns.

phplaravellivewire

Flutter + Riverpod + Dart 3

Rules for Flutter apps: stateless-first widget design, Riverpod for state, freezed for models, navigation with go_router, and platform-channel patterns. Targets current null-safe Dart 3.

flutterdartriverpod

Showing 20 of 20 stacks

Browse by AI tool

Format details, length guidelines, and examples specific to each AI coding assistant.

What it does

Curated stack library

20 hand-crafted rules files for the stacks developers actually use — Next.js + TypeScript, Next.js + Supabase, FastAPI + SQLAlchemy, Django, Rails, Laravel, SvelteKit, Astro, Go, Rust, Flutter, React Native, ML/PyTorch, Turborepo monorepos, and more. Each file is 150–500 lines, opinionated, and edited for clarity rather than aggregated from random GitHub.

Eight-step wizard

Pick your language, framework, database, ORM, auth, hosting, styling, package manager, linter, testing setup, code conventions, and behavioral rules. The wizard composes a coherent rules file with sensible defaults and a real-time preview. Every state is encoded into a shareable URL.

Format converter

Paste a Cursor .cursorrules and download a Claude CLAUDE.md, a Copilot instructions file, a Windsurf .windsurfrules, and six other formats — or all nine at once as a ZIP. The converter shows a side-by-side diff and annotates every transformation: frontmatter added or stripped, sections rewritten, length warnings.

Nine output formats

Every rules file in the library can be copied or downloaded in any of nine formats: Cursor (.cursorrules and the modern .cursor/rules/*.mdc), Claude Code (CLAUDE.md), Copilot (.github/copilot-instructions.md), Windsurf, Cline, Aider (CONVENTIONS.md), Continue, Cody (.sourcegraph/cody.md), and a generic system-prompt format for ChatGPT / Claude projects / any LLM.

Length warnings

Each AI tool has a different soft cap before it starts truncating context. Copilot is aggressive (~200 lines); Claude is generous (~600). The converter and generator surface these caps and warn before they’re exceeded — no surprises when you commit the file.

Static, fast, free

Every stack page is statically rendered. No client-side fetching of rules content. Lighthouse 95+ on every page. No accounts, no signup, no telemetry beyond aggregate page views. The full source for each rules file is visible on the page; nothing is hidden behind interactions.

How to use AI Coding Rules

  1. 1
    Browse the library

    Open /tools/ai-rules and filter by language, framework, or use case. Each stack page shows the full rules file with copy buttons for every AI-tool format.

  2. 2
    Or build your own

    Click "Generator" and walk through eight quick steps — language, framework, data layer, frontend, tooling, conventions, behavioral rules, output format. The wizard composes the file in real-time.

  3. 3
    Or convert an existing file

    Click "Converter," paste your existing .cursorrules / CLAUDE.md / Copilot instructions, and pick one or more target formats. Download all nine at once as a ZIP if you maintain a polyglot setup.

  4. 4
    Copy the right format

    Each output respects its target tool: Cursor .mdc files include YAML frontmatter, Copilot is concise, Claude is structured by H2 sections. The "Copy as X" button always emits the correct format.

  5. 5
    Drop the file in your repo

    Save the file at the path your AI tool expects — .cursorrules at the root, CLAUDE.md at the root, .github/copilot-instructions.md, etc. Commit it. Restart your AI tool. Done.

When to use this

Starting a new Next.js + Supabase project

Browse to /tools/ai-rules, click the Next.js + Supabase stack, copy as Cursor .mdc, paste into .cursor/rules/main.mdc. Two minutes; the AI now knows your stack.

Switching from Cursor to Claude Code

Open /tools/ai-rules/converter, paste your existing .cursorrules, pick "Claude (CLAUDE.md)" as target. The converter strips Cursor-specific syntax and re-organizes into Claude’s preferred section structure.

Onboarding a teammate using a different AI tool

Use the converter to download all nine formats as a ZIP. Commit them to the repo. Now anyone using any AI tool gets the same rules.

Adding behavioral rules without rewriting the whole file

Open the generator with your existing config, toggle on "Ask before installing dependencies" and "Run linter and tests before considering a task complete." Re-export. The rest stays unchanged.

Sharing your rules config with another developer

After running the wizard, copy the URL — it contains the full encoded state. Send it to a teammate; they see the exact same wizard with all your choices pre-filled.

Common errors & fixes

Copilot is ignoring my instructions file
Copilot truncates aggressively. If the file is over ~200 lines, the most important rules at the top often survive but later sections get dropped. Use the converter targeting Copilot to get a length-trimmed version.
Cursor isn’t loading my .cursorrules
Cursor now prefers .cursor/rules/main.mdc over the legacy .cursorrules. Both still work, but if you’re on a recent Cursor version, regenerate as the .mdc format with frontmatter.
My CLAUDE.md is huge and Claude responses are slow
Claude reads CLAUDE.md on every turn but counts it toward context, not latency. Slowness is usually caused by large transcripts, not rules. That said, keep CLAUDE.md under 600 lines for cleanliness — split into multiple nested CLAUDE.md files in subdirs if needed.
Conversion to Cursor .mdc lost my globs
Cursor’s glob system is unique. The converter preserves globs only when converting between Cursor formats. Going Cursor → Claude → Cursor will drop them. Annotate the resulting file manually if you need globs back.
The wizard URL is too long to share
The URL is LZ-compressed but very large configs can exceed some chat platforms’ link limits. Use the "Copy short link" button on the output step to generate a permalink instead.

Technical details

Library size at launch20 hand-curated stack rules files
Supported AI toolsCursor (legacy + .mdc), Claude Code, GitHub Copilot, Windsurf, Cline, Aider, Continue, Cody, generic system prompt
Generator steps8 (project basics, framework, data, frontend, tooling, conventions, behavioral rules, output)
URL state encodinglz-string compressToEncodedURIComponent — same scheme used elsewhere on devzone.tools
Format conversionDeterministic AST-based — input is parsed via marked’s lexer, transformations are declarative per (from, to) pair
RenderingServer-rendered markdown via marked@18, syntax highlighting via shiki at build time
Output bundlingJSZip for "download all nine formats" as a single archive

Why every AI coding tool needs a rules file

AI coding assistants are good at writing code in the abstract; they’re only as useful as the context you give them about your specific project. A rules file at the repo root tells the model the things it can’t infer in one pass: which framework version you’re on, where files go, what naming conventions you follow, which patterns you prefer, and which ones you’ve already tried and rejected.

Without it, the AI guesses based on the code it sees. It uses Pages Router conventions when you’re on App Router; it imports a default export when your project uses named-only; it adds a class component to a codebase that has been functional for two years. Each correction wastes a turn. The rules file front-loads the corrections that you’d otherwise have to type back into chat for the next six months.

The payoff compounds the longer the project runs. Every collaborator who installs the AI tool gets the same context immediately. Every refactor that touches a convention gets reflected back in the rules file. The file becomes a living style guide that humans and machines both read.

Why the format wars don’t actually matter

Cursor uses .cursorrules (or .mdc with frontmatter). Claude Code uses CLAUDE.md. GitHub Copilot uses .github/copilot-instructions.md. Windsurf uses .windsurfrules. Cline uses .clinerules. Aider uses CONVENTIONS.md. Continue uses .continuerules. Cody uses .sourcegraph/cody.md.

The content is 95% identical across all of them. The differences are mostly cosmetic — frontmatter or no frontmatter, section headers, length budgets, support for file globs. A well-written CLAUDE.md will be 90% useful as a Cursor rules file with five minutes of editing; a deterministic converter does the editing in zero seconds.

This means the right design decision is to write your rules once, in a format-neutral structure, then emit the tool-specific dialect on demand. That’s exactly what this generator and converter do. As new tools emerge, adding support is one new entry in a config file plus an emitter function — and your existing rules become available for the new tool immediately.

What separates a good rules file from a bad one

Bad rules files are platitudes — "write clean code," "follow best practices," "use TypeScript." The model already knows. Good rules files are opinionated and specific to the project: which version of which framework, where files go, what to import vs barrel-import, which library is forbidden, which patterns the team has already tried and rejected.

Good rules files also include the meta — behavioral rules for the AI itself. "Ask before installing dependencies." "Run the linter and tests before considering a task complete." "Never modify migrations after they’re committed." These are project policies the model would otherwise violate confidently. They’re also exactly the rules that compound — every prevented mistake is a turn you didn’t spend correcting.

The library files in this tool are written this way: opinionated, specific, with examples of patterns to follow and patterns to avoid. They’re curated from highly-rated public CLAUDE.md and .cursorrules files on GitHub, then edited heavily for current versions, consistency, and quality.

How the generator stays deterministic

The generator is a pure function: (your eight wizard answers) → markdown. There’s no LLM in the loop, no randomness, no "AI improving your rules." Pick the same options and you get the same file every time. This matters because rules files are committed to git — you don’t want them to drift between regenerations.

The templates the generator composes from are themselves hand-written, the same way the library files are. When you toggle "use TanStack Query," the generator inserts a specific paragraph about TanStack Query conventions; toggle it off and the paragraph disappears. No paraphrasing, no surprises. The output is also format-agnostic until the very last step, where the per-tool emitter wraps frontmatter or rewrites headers as needed.

The converter works the same way. Input is parsed through marked’s lexer into an AST; transformations are declarative ("strip frontmatter when going from .mdc to plain"); output is regenerated. You can audit every transformation rule in the source.

Frequently Asked Questions

What is a Cursor rules file?

A markdown file at your project root (.cursorrules) or in .cursor/rules/ that Cursor reads on every chat and inline-edit request. It tells the AI the conventions, patterns, and constraints of your project so the model doesn’t have to guess on each turn.

What is CLAUDE.md?

A markdown file at the root of your project that Claude Code (Anthropic’s CLI) reads automatically. It’s loaded into the model’s context on every interaction. Subdirectories can have their own CLAUDE.md files that get merged when Claude is working there.

What is the difference between .cursorrules and .cursor/rules/?

.cursorrules is the legacy single-file format. .cursor/rules/ is the modern multi-file format where each .mdc file has YAML frontmatter (description, globs, alwaysApply) and can be scoped to specific files via globs. Cursor still supports both. New projects should use .cursor/rules/.

Where do I put copilot-instructions.md?

At .github/copilot-instructions.md (relative to your repo root). VS Code Copilot Chat, Visual Studio, and copilot.com all read this file automatically. Keep it under ~200 lines — Copilot truncates aggressively.

Can I have multiple rules files in the same repo?

Yes — and you usually should. A single repo can have a CLAUDE.md (for Claude Code users), a .cursor/rules/ directory (for Cursor users), and a .github/copilot-instructions.md (for Copilot users) committed simultaneously. Each tool reads only its own file. The "download all nine" button in the converter generates them all in one go.

Should rules files be committed to git?

Yes. They’re project documentation that benefits every developer using the AI tool. The exception is personal-global instructions (e.g., ~/.claude/CLAUDE.md) which are user-scoped and stay out of the repo.

Do AI rules files work in monorepos?

Yes, with care. Claude Code merges nested CLAUDE.md files. Cursor’s .mdc system supports globs that scope rules to specific paths. Copilot is single-file. Aider is single-file. For a Turborepo, put a root file with monorepo-wide rules and per-package CLAUDE.md or .cursor/rules/ entries with package-specific conventions.

Will my CLAUDE.md slow down Claude’s responses?

It counts toward context but not noticeably toward latency. Claude reads it on every turn. The practical limit is the model’s context window — keep CLAUDE.md under 600 lines and the file itself won’t move the needle. Slowness in long chats is from the transcript, not the rules file.

How long should an AI rules file be?

150–500 lines for most stacks. Copilot tolerates ~200, Claude tolerates ~600, Cursor and Windsurf are in between. The library files in this tool target 250–400 lines as a sweet spot — long enough to cover real conventions, short enough to fit in every tool’s budget.

Are the library files written by AI?

No. Each stack file in the library is hand-curated from highly-rated public examples on GitHub, then edited heavily for current versions, consistency, and quality. The generator composes from hand-written templates. The converter is rule-based, not LLM-based. Output is deterministic and auditable.

Is this free?

Yes. No accounts, no signup, no paid tier, no telemetry beyond aggregate page views. The library, generator, and converter are entirely free, as is the rest of devzone.tools.

Can I contribute a stack?

Yes — email devzonetools@gmail.com with the stack name and either a draft rules file or a link to a great public example. We review submissions for quality and add accepted ones to the library.

Related Tools