Skip to content
trae-rules-writer logo

trae-rules-writer

Create Trae IDE rules (.trae/rules/*.md) for AI behavior constraints. Use when user wants to: create a project rule, set up code style guidelines, enforce naming conventions, make AI always do X, or customize AI behavior for specific files. Triggers on: '创建 rule', 'project rule', '.trae/rules/', ...

SKILL.md

Full skill instructions

Trae Rules Writer

Create Trae IDE rules by analyzing project conventions first, then designing rules that match existing patterns.

Workflow

1. ANALYZE  → Scan project structure, code style (ls .trae/​rules/, cat AGENTS.md)
2. IDENTIFY → What conventions exist? What needs guidance?
3. DESIGN   → Choose rule type and application mode
4. CREATE   → Write rules in Trae's official format

Rule Format

---
description: When to apply this rule (for intelligent mode)
globs: "*.ts,*.tsx"
alwaysApply: false
---

# Rule Title

Concise guidance for AI.

Application Modes

ModeFrontmatterUse Case
Always ApplyalwaysApply: trueGlobal conventions (naming)
File-Specificglobs: "*.tsx,*.jsx"Language-specific rules
Apply Intelligentlydescription: "When doing X..."Context-dependent guidance
Manual Only(no frontmatter)Invoke with #RuleName

Rule Types

TypeLocationScope
User RulesSettings > Rules & SkillsAll projects
Project Rules.trae/​rules/​*.mdCurrent project

Compatible Files

FileDescription
AGENTS.mdReusable across IDEs
CLAUDE.mdCompatible with Claude Code
CLAUDE.local.mdLocal-only, gitignored

Example

User: "Create rules for this TypeScript React project"

Analysis:
- Structure: src/​components/, src/​hooks/
- Naming: PascalCase components, camelCase functions
- No existing .trae/​rules/

Creating: .trae/​rules/

📄 code-style.md
---
alwaysApply: true
---
# Code Style
- PascalCase for components and types
- camelCase for functions and variables

📄 react-patterns.md
---
globs: "*.tsx,*.jsx"
---
# React Patterns
- Use functional components with hooks
- Custom hooks go in src/​hooks/

References