AI coding rules best of CLAUDE.md cursorrules AGENTS.md 2026

20 Best AI Coding Rules and Configurations in 2026

The Prompt Shelf ·

We reviewed every rule in The Prompt Shelf gallery and selected the 20 that stand out for quality, practicality, and influence. These are not just popular — they are genuinely useful configurations that you can learn from and adapt for your own projects.

Each entry includes why it made the list and what specific patterns you can steal.

The Selection Criteria

We evaluated rules on four dimensions:

  • Specificity — Does it give concrete, actionable instructions, or just vague guidelines?
  • Completeness — Does it cover code style, architecture, testing, and project-specific context?
  • Real-world impact — Is it used in a production codebase with active contributors?
  • Adaptability — Can you take patterns from this rule and apply them to your own projects?

The 20 Best Rules

1. Vercel Next.js — CLAUDE.md

View full rule

The Next.js framework itself ships a CLAUDE.md, and it is one of the most comprehensive examples in existence. At 138K stars, it is also one of the most battle-tested.

What makes it great: It covers the entire monorepo structure, specifies how to handle the boundary between app router and pages router, defines testing expectations for each package, and includes contribution workflow details. If you maintain a large TypeScript monorepo, this is the template to start from.

Steal this pattern: Separate rules by package/workspace. Do not try to fit everything into one flat list — use headers for each area of the codebase.

2. n8n Workflow — AGENTS.md

View full rule

n8n is a workflow automation tool with 178K stars, and its AGENTS.md is a masterclass in documenting a complex codebase for AI agents. It covers the monorepo layout, database conventions, API patterns, and frontend component standards.

What makes it great: The level of detail about the internal architecture is exceptional. It does not just say “use TypeScript” — it explains the specific patterns used across the various packages and why.

Steal this pattern: Include architectural decision records (ADRs) inline. When you explain why a pattern was chosen, the AI agent makes better decisions in ambiguous situations.

3. LangChain — CLAUDE.md

View full rule

LangChain’s CLAUDE.md demonstrates how to document a Python library with multiple packages and a complex dependency graph. At 128K stars, it is the most important AI framework’s own AI configuration.

What makes it great: It specifies import conventions across packages (which is where most LangChain contributions go wrong), testing patterns for both unit and integration tests, and how to handle the relationship between langchain-core and langchain-community.

Steal this pattern: If your project has specific import ordering rules or package boundaries, spell them out explicitly with examples. This is the single highest-impact section for library projects.

4. Excalidraw — CLAUDE.md

View full rule

Excalidraw is a whiteboard tool with 118K stars, and its CLAUDE.md shows how to configure AI assistance for a complex React application with custom rendering logic.

What makes it great: It explains the canvas rendering system, state management approach, and component composition patterns. For a project where the UI is non-standard (canvas-based, not just DOM), this context is essential.

Steal this pattern: When your project does something unusual — custom rendering, non-standard state management, domain-specific abstractions — document it in your AI rules file. The AI will not guess correctly without this context.

5. awesome-go — AGENTS.md

View full rule

At 167K stars, awesome-go is the canonical resource for Go libraries, and its AGENTS.md reflects Go’s focus on clarity and simplicity. The rules are concise, direct, and idiomatic.

What makes it great: It encodes Go community norms — effective naming, error handling patterns, package organization — in a way that any AI agent can follow. The result is contributions that read like they were written by an experienced Go developer.

Steal this pattern: Match the tone and philosophy of your language community. Go rules should be terse. Rust rules should emphasize safety. Python rules should reference PEPs.

6. Deno Runtime — CLAUDE.md

View full rule

Deno’s CLAUDE.md covers a Rust-based runtime with a TypeScript API surface. At 106K stars, the project has a complex build system and cross-platform requirements that Claude needs to understand.

What makes it great: It documents build system quirks, platform-specific code paths, and the FFI boundary between Rust and TypeScript. This is critical information that Claude could not infer from the code alone.

Steal this pattern: Document your build system. If cargo build is not enough, or if there are environment variables, feature flags, or platform-specific steps, put them in your AI rules file.

7. llama.cpp — AGENTS.md

View full rule

The llama.cpp project (97K stars) pushes C++ to its limits for ML inference performance. Its AGENTS.md reflects this focus on performance-critical code.

What makes it great: It includes specific instructions about memory management, SIMD optimization patterns, and cross-platform compatibility requirements. This is a level of technical depth that most AI rules files miss.

Steal this pattern: For performance-critical projects, include performance requirements in your AI rules. Specify acceptable patterns for memory allocation, threading, and hot paths.

8. Bun Runtime — AGENTS.md

View full rule

Bun’s AGENTS.md covers a Zig-based JavaScript runtime with 82K stars. It is one of the few AGENTS.md files for a project written primarily in Zig.

What makes it great: It explains Zig-specific conventions, memory safety patterns, and how the runtime interacts with JavaScript semantics. For a language with fewer community resources, this kind of documentation is invaluable.

Steal this pattern: If your project uses a less common language, your AI rules file needs to work harder. Include language-specific idioms and conventions that the AI might not have internalized from training data.

9. Grafana — AGENTS.md

View full rule

Grafana is a 72K-star observability platform with a Go backend and React frontend. Its AGENTS.md covers both stacks in a single, well-organized file.

What makes it great: The dual-stack coverage is handled cleanly. Backend rules are separated from frontend rules, but shared conventions (API contracts, error handling patterns) are in a common section.

Steal this pattern: For full-stack projects, organize your AI rules by layer (frontend, backend, shared) rather than mixing them together.

10. Browser Use — CLAUDE.md

View full rule

Browser Use (79K stars) is a Python library for controlling browsers with AI agents. Its CLAUDE.md is focused and practical.

What makes it great: It specifies async patterns, browser automation conventions, and how to handle the inherent unreliability of web scraping. The error handling section is particularly detailed.

Steal this pattern: If your project deals with external systems (APIs, browsers, databases), document your error handling and retry conventions. AI agents tend to generate optimistic code unless told otherwise.

11. Zed Editor — CLAUDE.md

View full rule

Zed is a GPU-accelerated code editor (76K stars) built with a custom UI framework called GPUI. Its CLAUDE.md explains this framework in enough detail for Claude to generate correct UI code.

What makes it great: It teaches Claude a proprietary framework. Without this file, Claude would have no idea how GPUI works. With it, Claude can generate idiomatic Zed UI code.

Steal this pattern: If your project has custom abstractions, frameworks, or DSLs, document them in your AI rules. The AI cannot learn about proprietary systems from public training data.

12. OpenAI Codex CLI — AGENTS.md

View full rule

OpenAI’s own Codex CLI (63K stars) ships an AGENTS.md. It is a Rust codebase, and the file demonstrates how to write rules for a CLI tool.

What makes it great: It includes specific patterns for argument parsing, output formatting, and error messages. CLI conventions are often undocumented tribal knowledge, and this file captures them.

Steal this pattern: For CLI tools, document your output format expectations, error message conventions, and argument naming patterns.

13. Prisma ORM — AGENTS.md

View full rule

Prisma (45K stars) is the most popular TypeScript ORM, and its AGENTS.md covers database-specific conventions that AI agents frequently get wrong.

What makes it great: It specifies migration patterns, schema conventions, and the relationship between the Prisma client and the query engine. This prevents AI agents from generating migrations that break existing data.

Steal this pattern: For projects with database schemas, include migration conventions and data safety rules in your AI configuration.

14. Cal.com — AGENTS.md

View full rule

Cal.com is a scheduling platform with 40K stars. Its AGENTS.md is notable for covering not just code but also product-level constraints.

What makes it great: It includes business logic rules — timezone handling, availability calculation, booking conflict resolution — that go beyond pure coding style. This prevents AI agents from generating code that is technically correct but logically wrong.

Steal this pattern: Include domain-specific business rules. If your project has complex business logic, the AI needs to know about it to avoid generating plausible but incorrect code.

15. Next.js + TypeScript — .cursorrules

View full rule

The most popular .cursorrules file (1,240 stars) is a comprehensive guide for Next.js development with TypeScript, Tailwind CSS, and Shadcn UI.

What makes it great: It is opinionated in the right ways. It specifies Server Components first, ‘nuqs’ for URL state, and specific patterns for data fetching. The opinions are aligned with Next.js best practices, so the generated code is consistently good.

Steal this pattern: Be opinionated. An AI rules file that says “use nuqs for URL state management” produces better results than one that says “manage state appropriately.”

16. Vercel AI SDK — AGENTS.md

View full rule

The Vercel AI SDK (22K stars) is the most popular library for building AI applications in TypeScript. Its AGENTS.md covers streaming patterns, provider abstraction, and tool use conventions.

What makes it great: It documents the streaming architecture and tool calling patterns in enough detail that AI agents can generate correct integration code. This is crucial because the streaming API has many subtle edge cases.

Steal this pattern: If your project has complex async patterns (streaming, WebSockets, pub/sub), document them explicitly. AI agents frequently generate incorrect async code without guidance.

17. CockroachDB — CLAUDE.md

View full rule

CockroachDB’s CLAUDE.md (31K stars) covers a large Go codebase with strict performance and reliability requirements. It is one of the most thorough database-related AI configurations.

What makes it great: It specifies which subsystems are performance-critical, what kinds of changes require benchmarks, and which testing patterns to use for distributed systems. The constraints section is particularly valuable.

Steal this pattern: Use explicit constraint sections. “Do NOT modify the storage engine without benchmarks” is the kind of rule that prevents costly mistakes.

18. Rails + Ruby + Hotwire — .cursorrules

View full rule

This .cursorrules file (890 stars) shows that AI rules are not just for the JavaScript ecosystem. It covers Ruby on Rails with Hotwire, Stimulus, and Turbo.

What makes it great: It encodes the “Rails way” — convention over configuration, thin controllers, model-centric design — in a way that produces idiomatic Rails code. The Hotwire-specific rules are particularly useful since Hotwire has a specific mental model that AI often gets wrong.

Steal this pattern: For convention-heavy frameworks (Rails, Django, Laravel), document the conventions explicitly. AI tools may know the framework but not always respect its idioms.

19. Cloudflare Workers — AGENTS.md

View full rule

Cloudflare Workers has unique constraints — V8 isolate limitations, no Node.js APIs, edge runtime semantics — that AI agents must understand. This AGENTS.md (6,500 stars) captures all of them.

What makes it great: It documents the edge runtime constraints that would otherwise trip up any AI agent trained primarily on Node.js code. No fs, no process, specific fetch behavior — these are things that must be spelled out.

Steal this pattern: If your runtime has constraints that differ from the standard (edge workers, serverless, embedded systems), make them the first thing in your AI rules file.

20. Go Microservice — CLAUDE.md

View full rule

This CLAUDE.md covers Go microservice development using the standard library’s ServeMux. At 445 stars, it is smaller than the others on this list, but its quality-to-size ratio is exceptional.

What makes it great: It demonstrates that a good AI rules file does not need to be long. In roughly 100 lines, it covers project structure, handler patterns, middleware conventions, error handling, and testing — everything you need for a Go HTTP service.

Steal this pattern: Brevity is a feature. A concise, complete rules file is more effective than a sprawling one. Aim for the minimum set of rules that produces consistent results.

Common Patterns Across the Best Rules

After analyzing these 20 files, clear patterns emerge:

They all start with context. Every effective rules file opens with a description of the project — what it is, what it does, and what technologies it uses.

They use negative rules. “Do NOT use class components” is a consistent pattern. Telling the AI what to avoid is often more impactful than describing what to do.

They include examples. The best rules show code snippets that demonstrate the desired pattern. A short example is worth paragraphs of description.

They specify testing conventions. Almost every file on this list includes a section on how tests should be written, what framework to use, and where test files should live.

They document build and development commands. If npm run dev does not just work, the rules file explains what to run instead.

They are maintained. These files are actively updated as the projects evolve. A rules file from 6 months ago may be wrong today.

How to Use This List

  1. Find the closest match to your project’s stack and read that rules file first.
  2. Identify the patterns that apply to your project.
  3. Start small. Copy the structure, not the content. Your project has its own conventions.
  4. Iterate. Write your first rules file, use it for a week, and then update it based on what Claude or Cursor got wrong.

Browse the complete collection on The Prompt Shelf for more examples across every language, framework, and AI tool.

More from the blog

Explore the collection

Browse all AI coding rules — CLAUDE.md, .cursorrules, AGENTS.md, and more.

Browse Rules