TL;DR

TRAE Agent Rules, Cursor Rules, and GitHub Copilot Instructions all solve the same problem—making AI assistants follow your team's conventions—but take different approaches. TRAE offers the deepest hierarchy with workspace, project, and skill-level rules. Cursor provides the most flexible file-scoping with glob patterns and MDC format. Copilot Instructions integrate natively across the GitHub ecosystem. For most teams, maintaining rule files for your primary IDE plus Copilot Instructions for GitHub-based reviews delivers the best coverage.

📋 Table of Contents

✨ Key Takeaways

  • TRAE Agent Rules provide the most granular control with three hierarchy levels (workspace → project → skill) and deep integration with the TRAE Skills system, making them ideal for developers who want fine-grained AI behavior management.
  • Cursor Rules have the most mature ecosystem. The MDC format with glob-based auto-attach and agent-requested rules gives teams precise control over which rules apply to which files.
  • GitHub Copilot Instructions win on reach—they work across VS Code, JetBrains IDEs, and GitHub.com (code review, PR agents), making them the safest bet for organizations standardizing across multiple tools.
  • All three systems use Markdown-based formats and support version control, so switching between them requires adaptation, not rewriting.
  • Running multiple rule systems in parallel is practical and increasingly common in professional teams.

💡 Quick Tool: AI Directory — Discover the latest AI coding tools, IDEs, and assistants.

What Are AI Coding Rule Files?

AI coding rule files are persistent configuration files that tell your AI coding assistant how to behave in a specific project. Unlike one-off prompts that apply to a single conversation, rule files inject context into every interaction—defining code style, architectural constraints, preferred libraries, forbidden patterns, and domain-specific knowledge.

Think of them as the .editorconfig or .eslintrc of the AI era. Just as linters enforce style at build time, rule files enforce conventions at generation time.

The Evolution: From Prompts to Structured Rules

The journey looks like this:

code
2023: Copy-paste prompts into every chat session
2024: Single root-level rule files (.cursorrules, CLAUDE.md)
2025: Multi-file rule systems with scoping (glob patterns, auto-attach)
2026: Hierarchical rule architectures with skill integration

Early approaches relied on a single file dumped into the context window. This worked for small projects but collapsed at scale—a 2,000-line .cursorrules file wastes tokens and dilutes signal. Modern rule systems solve this through selective injection: only the rules relevant to the current task enter the context.

This evolution mirrors a broader shift in AI engineering known as Context Engineering—the discipline of curating exactly the right information for AI at exactly the right moment.

The Three Major Rule Systems

TRAE Agent Rules

TRAE uses a layered rule system stored in Markdown files. Rules operate at three distinct levels, giving teams the most granular control of any IDE.

File Locations:

Level Location Scope
Workspace Rules IDE Settings → Rules & Skills All projects on this machine
Project Rules .trae/rules/*.md Current project only
Skill Rules Embedded in skill definitions Per-skill behavior

Rule Properties (Frontmatter):

Every project rule file supports three frontmatter fields that control when the rule activates:

yaml
---
alwaysApply: true | false
description: "When to apply this rule"
globs: "*.tsx, src/**/*.ts"
---

Three activation modes:

  1. Always Apply (alwaysApply: true) — Injected into every AI interaction. Use for universal standards like code style, naming conventions, and security policies.
  2. File Pattern (alwaysApply: false, globs set) — Activated when the user works with files matching the glob patterns. Use for technology-specific rules (React patterns, API conventions).
  3. Intelligent Apply (alwaysApply: false, description set) — The AI reads the description and decides whether to include the rule based on the current task context. Use for situational rules like "apply when writing database migrations."

Strengths:

  • Deepest hierarchy—workspace rules for personal preferences, project rules for team standards, skill rules for specialized workflows
  • Intelligent rule activation via natural language descriptions
  • Direct integration with TRAE's Skills system (agents, MCP servers, custom tools)
  • Markdown-native—easy to read, write, and review in PRs

Cursor Rules (.cursor/rules/)

Cursor's rule system has gone through two generations. The legacy .cursorrules file (a single Markdown file in the project root) still works but is superseded by the newer .cursor/rules/ directory system.

File Locations:

Level Location Scope
Global Rules IDE Settings → Rules for AI All projects
Project Rules .cursor/rules/*.mdc Current project
Legacy .cursorrules (root) Current project (deprecated)

MDC Format (Markdown Configuration):

Cursor rules use .mdc files—Markdown with YAML frontmatter:

code
---
description: "React component conventions"
globs: "src/components/**/*.tsx"
alwaysApply: false
---

Use functional components with hooks.
Prefer named exports over default exports.

Four rule types based on frontmatter combinations:

  1. Always Rules (alwaysApply: true) — Injected into every chat and Cmd+K interaction.
  2. Auto-Attached Rules (globs set, alwaysApply: false) — Automatically included when the user references files matching the glob patterns.
  3. Agent-Requested Rules (description set, no globs, alwaysApply: false) — The AI agent reads the description and decides whether to pull in the rule.
  4. Manual Rules (no globs, no description, alwaysApply: false) — Only activated when the user explicitly references the rule with @ruleName.

Strengths:

  • Most mature community ecosystem—thousands of shared .cursorrules templates on GitHub
  • Fine-grained file scoping through glob patterns
  • Agent-requested rules enable context-aware activation without token waste
  • .cursor/rules/ directory supports subdirectories for organization

GitHub Copilot Instructions

GitHub Copilot takes a simpler, ecosystem-first approach. Instructions are Markdown files that integrate across every Copilot surface—VS Code, JetBrains, GitHub.com code review, and the Copilot CLI.

File Locations:

Level Location Scope
User Settings VS Code settings.json / JetBrains settings All projects for this user
Repository-wide .github/copilot-instructions.md Entire repository
Path-specific .github/instructions/*.instructions.md Files matching path globs
Organization .github repository (org-level) All org repositories

Path-specific instructions format:

markdown
---
applyTo: "src/api/**/*.ts"
---

All API routes must validate input with Zod schemas.
Return standardized error responses using the AppError class.

The applyTo frontmatter uses glob patterns, similar to Cursor's globs field. Multiple applyTo patterns can be specified as a YAML list.

Strengths:

  • Widest reach—same instructions apply in VS Code, JetBrains, GitHub.com, Copilot CLI, and the Coding Agent
  • Organization-level inheritance through GitHub's .github repository convention
  • Native integration with Copilot's code review agent and PR workflows
  • Simplest format—plain Markdown with minimal frontmatter

Side-by-Side Comparison Table

Feature TRAE Agent Rules Cursor Rules Copilot Instructions
File Format Markdown (.md) MDC (.mdc) Markdown (.md)
File Location .trae/rules/ .cursor/rules/ .github/instructions/
Scope Levels Workspace → Project → Skill Global → Project User → Org → Repo → Path
Glob/Pattern Support globs field globs field applyTo field
Auto-Attach ✅ (file pattern mode) ✅ (auto-attached rules) ✅ (path-specific files)
AI-Decided Activation ✅ (intelligent apply) ✅ (agent-requested)
Multi-File Support ✅ Multiple .md files ✅ Multiple .mdc files ✅ Multiple .instructions.md files
Version Control Friendly
Team/Org Sharing Via Git (project rules) Via Git (project rules) Git + GitHub org inheritance
Skill/Plugin Integration ✅ Native skills system ✅ Cursor plugins ❌ (separate MCP config)
IDE Support TRAE IDE only Cursor only VS Code, JetBrains, GitHub.com
Always-On Rules alwaysApply: true alwaysApply: true copilot-instructions.md
Manual Invocation Via rule description @ruleName reference
Legacy Format N/A .cursorrules (root file) N/A
Learning Curve Medium Medium Low
flowchart TD A[User sends message to AI] --> B{Which IDE?} B -->|TRAE| C[Load Workspace Rules] B -->|Cursor| D[Load Global Rules] B -->|VS Code + Copilot| E[Load User Settings] C --> C1["Load Project Rules from .trae/rules/"] C1 --> C2{Rule type?} C2 -->|alwaysApply: true| C3[Always inject] C2 -->|globs match| C4[Auto-attach to context] C2 -->|description set| C5[AI decides to include] D --> D1["Load Project Rules from .cursor/rules/"] D1 --> D2{Rule type?} D2 -->|alwaysApply: true| D3[Always inject] D2 -->|globs match| D4[Auto-attach to context] D2 -->|description only| D5[Agent-requested] D2 -->|neither| D6["Manual @mention only"] E --> E1["Load .github/copilot-instructions.md"] E1 --> E2["Load path-specific .instructions.md"] E2 --> E3{applyTo matches current file?} E3 -->|Yes| E4[Include in context] E3 -->|No| E5[Skip] C3 & C4 & C5 --> F[Final Context Window] D3 & D4 & D5 & D6 --> F E1 & E4 --> F F --> G[AI generates response]

Configuration Examples

Here is how you configure the same conventions—a Next.js + TypeScript project—across all three systems.

TRAE Example

Create .trae/rules/nextjs-conventions.md in your project root:

markdown
---
alwaysApply: false
globs: "src/**/*.tsx, src/**/*.ts, app/**/*.tsx"
---

## Next.js + TypeScript Conventions

### Architecture
- Use the App Router (app/ directory). Do not use the Pages Router for new routes.
- Server Components by default. Add "use client" only when hooks or browser APIs are needed.
- Place shared layouts in app/layout.tsx. Use route groups (parentheses) for organization.

### TypeScript
- Strict mode enabled. No `any` types—use `unknown` with type guards instead.
- Define props interfaces inline for single-use, or in a shared `types/` directory for reuse.
- Use Zod schemas for runtime validation at API boundaries.

### Styling
- Use Tailwind CSS utility classes. Avoid custom CSS unless Tailwind cannot express the design.
- Follow mobile-first responsive design: base → sm → md → lg.

### Data Fetching
- Use Server Actions for mutations. Use `fetch` with Next.js caching for reads.
- Always handle loading and error states with Suspense boundaries and error.tsx.

Cursor Example

Create .cursor/rules/nextjs-conventions.mdc:

code
---
description: "Next.js and TypeScript project conventions for App Router architecture"
globs: "src/**/*.tsx, src/**/*.ts, app/**/*.tsx, app/**/*.ts"
alwaysApply: false
---

## Next.js + TypeScript Conventions

### Architecture
- Use the App Router (app/ directory). Do not use the Pages Router for new routes.
- Server Components by default. Add "use client" only when hooks or browser APIs are needed.
- Place shared layouts in app/layout.tsx. Use route groups (parentheses) for organization.

### TypeScript
- Strict mode enabled. No `any` types—use `unknown` with type guards instead.
- Define props interfaces inline for single-use, or in a shared `types/` directory for reuse.
- Use Zod schemas for runtime validation at API boundaries.

### Styling
- Use Tailwind CSS utility classes. Avoid custom CSS unless Tailwind cannot express the design.
- Follow mobile-first responsive design: base → sm → md → lg.

### Data Fetching
- Use Server Actions for mutations. Use `fetch` with Next.js caching for reads.
- Always handle loading and error states with Suspense boundaries and error.tsx.

Copilot Example

Create .github/copilot-instructions.md for repository-wide rules:

markdown
## Project Overview
This is a Next.js 15 application using the App Router, TypeScript strict mode, and Tailwind CSS.

## Architecture Rules
- Use the App Router (app/ directory). Do not create Pages Router files.
- Default to Server Components. Only add "use client" when hooks or browser APIs are required.
- Use route groups (parentheses) to organize related routes without affecting URL structure.

## TypeScript Standards
- No `any` types. Use `unknown` with type guards for dynamic data.
- Use Zod for runtime validation at all API boundaries.

## Styling
- Use Tailwind CSS utility classes exclusively. No custom CSS files.
- Follow mobile-first responsive design patterns.

Then create .github/instructions/api-routes.instructions.md for path-specific rules:

markdown
---
applyTo: "app/api/**/*.ts"
---

## API Route Conventions
- Validate all request bodies with Zod schemas before processing.
- Return standardized JSON responses: `{ data, error, status }`.
- Use Next.js route handlers (GET, POST, PUT, DELETE exports).
- Always set appropriate HTTP status codes—never return 200 for errors.
- Log errors to the server console but never expose stack traces to clients.

Advanced Patterns

Multi-Level Rule Hierarchies

Each system handles precedence differently when rules conflict:

graph TB subgraph TRAE["TRAE Agent Rules"] TW["Workspace Rules"] --> TP["Project Rules"] TP --> TS["Skill Rules"] TS --> TF["Final: Skill > Project > Workspace"] end subgraph Cursor["Cursor Rules"] CG["Global Rules"] --> CP["Project Rules"] CP --> CA["Always > Auto-Attached > Agent-Requested"] CA --> CF["Final: Project > Global"] end subgraph Copilot["Copilot Instructions"] CU["User Settings"] --> CO["Org Instructions"] CO --> CR["Repo Instructions"] CR --> CS["Path-Specific Instructions"] CS --> CC["Final: All layers combined"] end

TRAE uses a strict override chain: skill-level rules override project rules, which override workspace rules. This means a team's project rules always take precedence over an individual developer's workspace preferences—a sensible default for team consistency.

Cursor merges all applicable rules rather than overriding. An always-on rule, an auto-attached rule for .tsx files, and an agent-requested rule can all contribute to the same prompt. Conflict resolution depends on the model's interpretation of contradictory instructions—so keep rules complementary, not conflicting.

Copilot combines repository-wide and path-specific instructions additively. When you edit an API route, both copilot-instructions.md and any matching *.instructions.md files contribute to the context. Organization-level instructions provide baseline standards that individual repos can extend.

Team Collaboration Strategies

Committing rules to version control is non-negotiable for teams. All three systems store rules as text files in predictable locations, making them perfect for Git:

code
# .gitignore — what NOT to commit
.trae/rules/personal-*.md    # Personal TRAE rules
.cursor/rules/my-shortcuts.mdc # Personal Cursor rules

# .gitattributes — ensure consistent line endings
.trae/rules/*.md  text eol=lf
.cursor/rules/*.mdc text eol=lf
.github/**/*.md     text eol=lf

Shared vs. personal rules: Establish a convention where team rules use descriptive names (nextjs-conventions.md, api-standards.mdc) and personal rules use a prefix (personal-*.md or my-*.mdc) excluded via .gitignore.

Onboarding new members: Rule files serve double duty as documentation. A new developer reads .trae/rules/architecture.md to understand both the team's conventions and how the AI enforces them. This is significantly more effective than wiki pages that drift out of sync with the codebase.

Migration Guide

From Cursor Rules to TRAE Agent Rules

The transition is straightforward because both systems use similar concepts:

  1. Copy .cursor/rules/*.mdc content to .trae/rules/*.md files. Change the file extension from .mdc to .md.
  2. Map frontmatter fieldsglobs and alwaysApply work identically. For Cursor's agent-requested rules (description-only, no globs), set alwaysApply: false with a description field in TRAE—the behavior maps directly to TRAE's "Intelligent Apply" mode.
  3. Handle manual rules — Cursor's manual rules (no description, no globs, alwaysApply: false) have no direct equivalent in TRAE. Convert them to intelligent-apply rules by adding a descriptive description field.

From Copilot Instructions to Cursor Rules

  1. Move .github/copilot-instructions.md to .cursor/rules/project-standards.mdc. Add alwaysApply: true to the frontmatter.
  2. Convert path-specific instructions — Replace applyTo with globs in the frontmatter. Rename from *.instructions.md to *.mdc.
  3. Note the behavioral difference — Copilot combines all matching instructions additively. Cursor may not load agent-requested rules unless the AI deems them relevant. Prefer auto-attached rules (globs set) over agent-requested rules for critical standards.

Running Multiple Systems in Parallel

Many professional teams maintain rule files for two or more systems simultaneously. This works because each IDE reads only its own rule directory:

code
project-root/
├── .trae/rules/         # TRAE reads these
│   ├── code-style.md
│   └── api-conventions.md
├── .cursor/rules/         # Cursor reads these
│   ├── code-style.mdc
│   └── api-conventions.mdc
├── .github/
│   ├── copilot-instructions.md    # Copilot reads this
│   └── instructions/
│       └── api.instructions.md    # Copilot path-specific

To keep rules synchronized, use a simple script or Makefile that generates IDE-specific rule files from a single source of truth. Alternatively, keep the rules nearly identical—the format differences are minimal.

Best Practices

1. Start with always-on rules, then specialize. Begin with a single always-apply rule covering your project's core conventions (language, framework, code style). Add file-scoped rules only when you notice the AI violating specific patterns for specific file types. Over-engineering rules upfront wastes tokens and creates maintenance burden.

2. Keep individual rule files under 500 lines. Large rule files dilute signal. If a rule file grows beyond 500 lines, split it by domain—separate code-style.md from architecture.md from testing.md. This also improves auto-attach precision since each file can target different glob patterns.

3. Write rules as instructions, not explanations. AI models respond better to direct imperatives than background context. Write "Use functional components with hooks. Never use class components." instead of "In our project, we have decided to use functional components because they offer better composability through hooks."

4. Version your rules alongside your code. Treat rule files like code—review them in PRs, track changes over time, and refactor when conventions evolve. A git blame on your rule files tells the story of your team's architectural decisions.

5. Test rules by generating code, not by reading them. The only way to know if a rule works is to ask the AI to generate code that should be governed by that rule. Create a "rule test" prompt: "Generate a new API route for user registration" and verify the output follows your API conventions. Iterate on the rule wording until the output is consistently correct.

⚠️ Common Mistakes:

  • Overloading a single rule file with everything. A 3,000-line rule file burns context tokens on irrelevant instructions. Split by domain and use glob patterns to inject only what matters for each task.
  • Writing rules that contradict each other. When an always-on rule says "use fetch" but a file-scoped rule says "use axios," the AI produces inconsistent code. Audit your rules for conflicts, especially when multiple team members contribute rules independently.
  • Forgetting to update rules when conventions change. Stale rules are worse than no rules—they actively teach the AI outdated patterns. Add "review rule files" to your sprint retrospective checklist.

FAQ

What are AI coding rule files?

AI coding rule files are configuration files (typically Markdown) placed in your project repository that define how AI coding assistants behave. They specify coding standards, architectural patterns, preferred libraries, naming conventions, and contextual instructions. When you interact with the AI, these rules are automatically injected into the context window so every response aligns with your team's conventions—without repeating yourself in every prompt.

Which AI coding rule system is best for teams?

It depends on your tool stack. If your team standardizes on one IDE, use that IDE's native rule system—Cursor Rules for Cursor, TRAE Agent Rules for TRAE. For organizations with mixed IDE environments, GitHub Copilot Instructions provide the broadest coverage since they work across VS Code, JetBrains, and GitHub.com. TRAE offers the most granular control for teams that want workspace-level personal rules cleanly separated from project-level team rules.

Can I use multiple AI coding rule systems together?

Yes, and this is increasingly common. Since each IDE reads only its own rule directory (.trae/rules/, .cursor/rules/, .github/instructions/), they coexist without conflict. Many teams maintain Cursor or TRAE rules for daily development and Copilot Instructions for GitHub-based code review. The maintenance cost is low since the rule content is nearly identical across formats.

How do AI coding rules differ from prompts?

Prompts are ephemeral—you type them once for a specific task, and they disappear when the conversation ends. Rules are persistent—they are automatically injected into every interaction within a project. Think of rules as your AI assistant's "default personality" that prompts can override for specific tasks. A rule says "always use TypeScript strict mode," while a prompt says "generate a quick prototype, skip type safety for now."

How often should I update my rule files?

Update rules whenever your team's conventions change—new library adoptions, architectural shifts, deprecated patterns. A practical cadence is reviewing rules once per sprint. Watch for signals: if you find yourself repeatedly correcting the AI's output in the same way, that correction belongs in a rule file. If the AI consistently ignores a rule, the rule's wording needs sharpening—not more rules.

Summary

AI coding rule files have evolved from a convenience into a critical part of professional development workflows. TRAE Agent Rules provide the deepest hierarchy with workspace, project, and skill-level control. Cursor Rules offer the most flexible scoping through MDC format and a thriving community ecosystem. GitHub Copilot Instructions deliver the broadest reach across IDEs and the GitHub platform. The right choice depends on your team's primary IDE, organizational structure, and whether you need cross-platform coverage. In practice, maintaining rules for your primary IDE plus Copilot Instructions for GitHub integration is the strategy that scales best.

👉 Explore AI Tools Directory — Find the best AI coding tools for your workflow.

Related Blog Posts:

Related Glossary Terms: