Create Rule logo

Create Rule

Community
ShenQingchuan
create-rule

为项目创建或沉淀规则约束文件(Rule)。当用户要求记录编码规范、固化团队开发约束、沉淀 Code Review 经验或在 .agents/rules/ 下新建规则时使用。

Overview

PublisherShenQingchuan
Repositoryskills
Skill namecreate-rule
Stars
28
Forks
3
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by ShenQingchuan on GitHub. Read the source before you install it.

Installation

Install the Create Rule AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/ShenQingchuan/skills/tree/main/registry/dev/agent-friendly-context/create-rule
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ShenQingchuan/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/registry/dev/agent-friendly-context/create-rule .claude/skills/create-rule
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Create Rule in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Create Rule on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Create Rule is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Create Rule

本技能用于为项目沉淀开发规范与约束规则,存放在项目根目录的 .agents/rules/ 目录下。


核心理念:规则是智识与经验的“轻量缓存”

  • 本质:把团队踩过的坑、达成的开发默契以及代码审查(Code Review)中沉淀的经验,以高信息密度、易于吸收的形式缓存起来。
  • 渐进式吸收:规则不需要靠复杂的程序去强行监控或自动拦截,而是作为项目知识库的一个个“锦囊”。当 Agent 准备修改某块逻辑或编写特定代码时,能直接去翻对应的规则快速吸收,避免重蹈覆辙。
  • 纯粹通用:不依赖特定 IDE 或工具专有的拦截机制,使用纯粹、标准的 Markdown 文件,对任何 Agent 都开箱即用。

核心工作铁律:严禁重新采访用户(No Re-interviewing)

  • 默认行为:用户通常是在刚刚讨论完某段代码的设计、纠正了一个 Bug、或者明确指出了代码偏好后调用本技能。
  • 直接提炼:直接从当前会话的讨论记录、代码比对中抽取规则核心,组织成精炼文档并直接落盘。
  • 拒绝八股文提问:绝不要像面试官一样反问“请问这条规则的背景是什么、希望应用在什么场景”。直接给出最佳初稿,由用户审阅确认。

物理存储规范:.agents/rules/<rule-name>.md

每个规则都是 .agents/rules/ 目录下的一个独立 Markdown 文件,建议采用小写英文字母与连字符命名:

text
.agents/rules/
├── error-handling.md         # 错误处理与日志捕获约定
├── api-conventions.md        # 接口命名与字段风格规范
├── state-management.md       # 状态管理与数据流约定
└── database-queries.md       # 数据库查询防坑指南
  • 单一职责(One Concern Per Rule):一个规则文件只说透一个具体的话题,绝不把所有规矩杂糅成无法阅读的长篇大论。

编写黄金法则:如何让 AI 3秒内吸收规则?

1. 篇幅精炼,去粗取精

控制在 30~80 行内。不要写长篇大论的宏观说教,开门见山,直接给出硬核要求。

2. 代码对比胜过千言万语(❌ BAD vs ✅ GOOD)

对 Agent 而言,最强有力的约束不是形容词,而是具象的代码对比:

  • 给出反面典型(❌ BAD),说明“别这么干”;
  • 给出标准示范(✅ GOOD),说明“应该怎么写”。

3. 一句话说清“为什么”(The Why)

简明交代这条规则背后的痛点(如:“防止并发下数据不一致”、“避免无意义的吞异常导致排查困难”),让 Agent 真正理解逻辑,遇到变形场景时也能正确推导。


标准规则模板参考

markdown
# [规则名称,如:错误处理与上报约定]

## 核心原则
所有业务操作的报错必须包含上下文信息,禁止静默吞掉异常,方便快速定位生产问题。

## 规范对比

### 1. 捕获与抛出

\`\`\`typescript
// ❌ BAD:捕获后什么都不做,或者只打个空日志丢弃原始堆栈
try {
  await fetchUserData(userId);
} catch (e) {
  console.log("error");
}

// ✅ GOOD:附带业务上下文并保留原始 cause 抛出,或者调用统一日志记录器
try {
  await fetchUserData(userId);
} catch (error) {
  logger.error("Failed to fetch user data for checkout", { userId, error });
  throw new UserDataFetchError("Unable to load user profile", { cause: error });
}
\`\`\`

## 关键要点
1. 错误日志必须携带关键入参(如 ID、流水号)。
2. 面向前端展示的文案与内部日志信息严格分离,内部日志保留完整堆栈。

标准执行流程

  1. 提取讨论成果:从上下文(如 Code Review 过程、Bug 修复讨论、用户口述偏好)中提取规范核心。
  2. 提炼规则主题:确定简短、精准的文件名(如 .agents/rules/<rule-name>.md)。
  3. 编写与落盘:组织原则、❌ BAD / ✅ GOOD 对比代码与核心要点,直接写入文件。
  4. 交付成果:通知用户文件生成路径与核心规则概要,请用户审阅。

Frequently asked questions

What does the Create Rule AI skill do?

为项目创建或沉淀规则约束文件(Rule)。当用户要求记录编码规范、固化团队开发约束、沉淀 Code Review 经验或在 .agents/rules/ 下新建规则时使用。

Why use Create Rule on TypingMind?

Because you install it once and use it with any model. Create Rule is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Create Rule in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/ShenQingchuan/skills/tree/main/registry/dev/agent-friendly-context/create-rule. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Create Rule?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Create Rule?

As many as you like. As long as a model supports skills, you can use Create Rule with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Create Rule AI skill free?

Yes. It is published on GitHub by ShenQingchuan under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇