返回 Skill 列表
extension
分类: 开发与工程无需 API Key

trae-rules-writer

创建Trae IDE规则(.trae/rules/*.md)以约束AI行为。当用户想要:创建项目规则、设置代码风格指南、强制命名约定、让AI始终执行X或为特定文件自定义AI行为时使用。触发条件包括:'创建 rule', 'project rule', '.trae/rules/', 'AGENTS.md', 'CLAUDE.md', 'make AI always use PascalCase'。不要用于技能(应使用trae-skill-writer)或代理(应使用trae-agent-writer)。

person作者: jakexiaohubgithub

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

| Mode | Frontmatter | Use Case | | ------------------- | -------------------------------- | ----------------------------- | | Always Apply | alwaysApply: true | Global conventions (naming) | | File-Specific | globs: "*.tsx,*.jsx" | Language-specific rules | | Apply Intelligently | description: "When doing X..." | Context-dependent guidance | | Manual Only | (no frontmatter) | Invoke with #RuleName |

Rule Types

| Type | Location | Scope | | ------------- | ------------------------- | --------------- | | User Rules | Settings > Rules & Skills | All projects | | Project Rules | .trae/rules/*.md | Current project |

Compatible Files

| File | Description | | ----------------- | -------------------------- | | AGENTS.md | Reusable across IDEs | | CLAUDE.md | Compatible with Claude Code| | CLAUDE.local.md | Local-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