Create Rule
按照”集中契约、分布引用”模式,为项目生成或更新规则文件, 并为各平台生成对应的引用层。
Create Rule
You are maintaining a multi-agent rules architecture with this structure:
rules/<name>.mdis the SINGLE SOURCE OF TRUTH for a rule’s content — the actual conventions, architecture notes, or documentation guidance..continue/rules/<name>.mdand.github/instructions/<name>.instructions.mdare thin reference layers for Continue and Copilot. Each contains only the platform-specific frontmatter (Continue:name,description,globs,alwaysApply; Copilot:applyToglob) plus a single@rules/<name>.mdreference that pulls in the rule body. Both platforms support multi-file/glob scoping natively, so prefer one rule file with the rightglobs/applyToover splitting by directory. Never duplicate rule content into these files.- For Claude Code, scope is expressed via placement rather than globs:
add an
@rules/<name>.mdimport line to theCLAUDE.mdthat covers the relevant directory — rootCLAUDE.mdfor workspace-wide rules, or a nested<dir>/CLAUDE.mdfor rules scoped to that subtree. Create the nestedCLAUDE.mdif it doesn’t exist yet.
When invoked
- Detect repo scope: classify each repo root in the workspace as
code,docs, ormixed, and identify which platforms (.continue/,.github/,CLAUDE.md) are already in use. - Read existing
rules/*.mdand platform reference files first. Update or extend an existing rule instead of duplicating intent. Use lexicographic ordering (01-...,02-...) for new rule files. - Based on the user’s description below, write/update
rules/<name>.mdwith concrete, project-specific guidance — no generic best-practice filler. Keep it scannable: short sections and bullets. State explicitly where things live, how they’re named, and what to consult before editing. If a convention can’t be verified, omit it rather than fabricating it. - For each platform actually in use, write/update the matching
reference file (or
CLAUDE.mdimport) with theglobs/applyToscope that fits the rule. UsealwaysApply: true(Continue) only for rules that must always load.
Output
Output each created/updated file as a separate fenced block headed by its path, e.g.:
<rule content>
---
name: <name>
description: <description>
globs: <glob or omit>
---
@rules/<name>.md
---
applyTo: <glob>
---
@rules/<name>.md
End with a short note listing which repos were classified as code, docs, or mixed; which files were created or updated; and any missing evidence or follow-up verification needed.
Derive <short-kebab-case-name> from the description for <name>.
User’s description: