creating-trae-rules
Skill18 starsChanged 7 months agoMITView on GitHub
Create, modify, review, or organize Trae IDE rules that live under .trae/rules, module-level .trae/rules folders, AGENTS.md, CLAUDE.md, or git message rule files. Use when the user asks to 创建 rule, 创建规则, 编写 Trae 规则, 适配 Trae rules, set alwaysApply/globs/description/scene, create commit message rules, split project rules by module, or convert team conventions into reusable Trae project rules.
In this repository37 other files it gives its agents.
- a11y-debuggingSkill
- agent-blueprint-architectSkill
- brainstormingSkill
- chart-visualizationSkill
- chinese-copywritingSkill
- chinese-git-workflowSkill
- chrome-devtoolsSkill
- debug-optimize-lcpSkill
- discovering-subagent-capabilitiesSkill
- dispatching-parallel-agentsSkill
- everything-searchSkill
- executing-plansSkill
- find-docsSkill
- finishing-a-development-branchSkill
- frontend-designSkill
- gh-cliSkill
- git-commitSkill
- image-manipulation-python-magickSkill
- memory-kernelSkill
- memory-leak-debuggingSkill
- mineru-to-mdSkill
- model-config-lookupSkill
- receiving-code-reviewSkill
- requesting-code-reviewSkill
- self-improvementSkill
- skill-creatorSkill
- skill-language-policySkill
- skill-stability-reviewSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- troubleshootingSkill
- using-git-worktreesSkill
- verification-before-completionSkill
- visual-brainstormingSkill
- workflow-runnerSkill
- writing-plansSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 10 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this Skill to produce rules that are valid for Trae IDE and easy for Trae to apply.
- Distinctive: line 10
When the user writes in Chinese, discuss choices and final summaries in Simplified Chinese.
- Distinctive: line 14
Do not use this Skill when:
- Distinctive: line 31
Ask one concise question only when the target path or rule purpose is impossible to infer safely.
- Very specific: line 39
Commit message rules: rules containing scene: git_message
- Very specific: line 41
Use .trae/rules/<name>.md for project rules.
- Very specific: line 42
Use <module>/.trae/rules/<name>.md for module-only behavior.
- Distinctive: line 43
Use AGENTS.md only when the user wants a lightweight project instruction file that can be reused by tools supporting AGENTS.md.
- Very specific: line 46
Always apply: set alwaysApply: true.
- Very specific: line 50
Commit message: add scene: git_message.
- Distinctive: line 51
Write the rule with YAML frontmatter followed by Markdown instructions.
- Distinctive: line 58
No new rule contradicts an existing rule.
- Distinctive: line 63
Use templates only when helpful:
- Distinctive: line 90
Write instructions as actionable constraints, not explanations about why the rule exists.
- Distinctive: line 110
Use forward slashes in examples and globs.
- Very specific: line 122
Do not create rules below the fourth nested level under .trae/rules/.
- Very specific: line 130
Commit message rule already exists: update the existing scene: git_message rule instead of creating a duplicate unless the user asks for …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Creating Trae Rules
Use this Skill to produce rules that are valid for Trae IDE and easy for Trae to apply. Prefer creating or editing actual rule files when the target project path is known.
When the user writes in Chinese, discuss choices and final summaries in Simplified Chinese. Keep file names, frontmatter keys, glob patterns, and code identifiers in their original form.
Do Not Use
Do not use this Skill when:
- The user wants general project documentation, prompt writing, or one-off notes that are not intended to become Trae rules.
- The task is ordinary code editing, debugging, or refactoring unrelated to
.trae/rules,AGENTS.md,CLAUDE.md, or git message rules. - The user is asking for broad workflow advice without asking to create, modify, organize, or review actual rule files.
- The request is about editing Skills instead of rules; use the Skill workflow for
SKILL.mdand related Skill assets.
Inputs
Collect or infer:
- Target scope: whole project, specific module, specific file pattern, intelligent trigger, manual trigger, personal rule draft, or commit message generation.
- Target project or module path. If omitted, inspect the current workspace before asking.
- Rule purpose and constraints.
- Desired activation mode.
- Existing rule files that may conflict or overlap.
Ask one concise question only when the target path or rule purpose is impossible to infer safely.
Workflow
- Inspect existing Trae rule surfaces before editing:
- Project rules:
<project>/.trae/rules/**/*.md - Module rules:
<module>/.trae/rules/**/*.md - Agent files:
AGENTS.md,CLAUDE.md,CLAUDE.local.md - Commit message rules: rules containing
scene: git_message
- Project rules:
- Choose the smallest correct rule surface:
- Use
.trae/rules/<name>.mdfor project rules. - Use
<module>/.trae/rules/<name>.mdfor module-only behavior. - Use
AGENTS.mdonly when the user wants a lightweight project instruction file that can be reused by tools supporting AGENTS.md. - Draft personal rules as plain text for Trae settings; do not invent a filesystem location for personal rules.
- Use
- Choose activation mode:
- Always apply: set
alwaysApply: true. - Specific files: set
alwaysApply: falseandglobs. - Intelligent apply: set
alwaysApply: falseanddescription. - Manual only: set
alwaysApply: falseand omitglobsanddescriptionunless the user explicitly wants metadata for clarity. - Commit message: add
scene: git_message; this can coexist withalwaysApply,description, andglobs.
- Always apply: set
- Write the rule with YAML frontmatter followed by Markdown instructions.
- Keep each rule focused. Split rules when one file mixes unrelated concerns such as UI style, API design, testing, and commit messages. When a file exceeds the line limit (50 for rules, 30 for alwaysApply), apply the Line Limit Decision Strategy from
resources/trae-rules-reference.md: identify whether it contains multiple independent concerns (split) or a single coherent concern (keep). Never delete actionable content just to meet a line count. - Validate:
- Frontmatter is bounded by
---. - Boolean fields are real booleans, not quoted strings.
globsuses project-root-relative patterns.- Rule files are no deeper than three nested levels under
.trae/rules/. - No new rule contradicts an existing rule.
- Frontmatter is bounded by
- Summarize changed files, activation behavior, and any assumptions.
Rule Templates
Use templates only when helpful:
templates/always-apply.md: whole-project rule.templates/specific-files.md: file-pattern rule.templates/intelligent-apply.md: semantic trigger rule.templates/manual-only.md: #Rule-only rule.templates/git-message.md: commit message generation rule.
For exact Trae behavior and examples, read resources/trae-rules-reference.md when creating or reviewing non-trivial rules.
Writing Rules
Use this structure:
---
alwaysApply: false
description: [触发此规则的简短场景描述]
---
# [规则名称]
- [执行这个具体操作]
- [避免这种具体错误模式]
- [在这个场景下,优先使用此本地约定]Write instructions as actionable constraints, not explanations about why the rule exists. Prefer bullets that Trae can follow during execution.
Good rule content:
- Use the existing repository test helper instead of introducing a new test runner.
- Keep generated files out of source changes unless the user explicitly asks for regenerated artifacts.
- When editing React components, follow the nearby component naming and import order.Avoid vague content:
- Make the code better.
- Follow best practices.
- Be careful.File Placement
Use forward slashes in examples and globs.
Examples:
.trae/rules/general-style.md
.trae/rules/frontend/react-components.md
frontend-module/.trae/rules/react-best-practices.md
backend-module/.trae/rules/api-design.md
AGENTS.mdDo not create rules below the fourth nested level under .trae/rules/; Trae recognizes up to three levels of nesting.
Failure Handling
- Missing target project: inspect the current directory. If no project root is clear, ask for the target folder.
- Existing conflicting rule: report the conflict and either update the existing rule or ask before creating a competing one.
- Personal rule request: provide the rule text and tell the user it belongs in Trae settings, not
.trae/rules. - Unknown activation mode: choose intelligent apply for scenario-specific guidance, specific-files for file-pattern guidance, always apply only for truly universal constraints, and manual only for rarely needed specialist guidance.
- Commit message rule already exists: update the existing
scene: git_messagerule instead of creating a duplicate unless the user asks for multiple commit rules.
Output Contract
## 规则创建/更新结果
**文件路径:** `.trae/rules/...`
**规则意图:**
- [简述规则的核心目的]
**覆盖范围:**
- [受影响的文件或场景]
**下一步:** [如无则写 "- 无"]Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

