rules-capture

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Rules Capture Skill

Rules Capture Skill

This skill automatically detects when users express preferences, rules, or coding standards during conversations and documents them for future sessions.

该Skill会自动检测用户在对话中表达的偏好、规则或编码标准,并将其记录下来供后续会话使用。

When This Skill Activates

触发场景

Automatically activate when the user mentions ANY of these:
当用户提及以下任意内容时,自动激活:

Direct Rule Expressions

直接规则表述

  • "always do X" / "never do X"
  • "I prefer X" / "I don't like X"
  • "don't ever X" / "stop doing X"
  • "from now on X" / "going forward X"
  • "that's not how we do it" / "we do it this way"
  • "the rule is X" / "the standard is X"
  • "always do X" / "never do X"(总是做X / 绝不做X)
  • "I prefer X" / "I don't like X"(我偏好X / 我不喜欢X)
  • "don't ever X" / "stop doing X"(绝对不要做X / 不要再做X)
  • "from now on X" / "going forward X"(从现在起X / 今后X)
  • "that's not how we do it" / "we do it this way"(我们不是这么做的 / 我们要这么做)
  • "the rule is X" / "the standard is X"(规则是X / 标准是X)

Coding Style Expressions

编码风格表述

  • "use X pattern" / "don't use X pattern"
  • "name things like X" / "format like X"
  • "import from X" / "don't import from X"
  • "the convention is X"
  • "follow the X pattern"
  • "use X pattern" / "don't use X pattern"(使用X模式 / 不要使用X模式)
  • "name things like X" / "format like X"(像X这样命名 / 按照X这样格式化)
  • "import from X" / "don't import from X"(从X导入 / 不要从X导入)
  • "the convention is X"(惯例是X)
  • "follow the X pattern"(遵循X模式)

Frustration Indicators (Capture these especially!)

不满信号(重点捕获!)

  • "why did you X" / "stop doing X"
  • "I told you before" / "I already said"
  • "that's wrong" / "that's not right"
  • "fix this" / "change this"
  • Any profanity + instruction (strong signal!)
  • "why did you X" / "stop doing X"(你为什么要X / 不要再做X)
  • "I told you before" / "I already said"(我之前告诉过你 / 我已经说过了)
  • "that's wrong" / "that's not right"(这是错的 / 不对)
  • "fix this" / "change this"(修复这个 / 修改这个)
  • 任何脏话+指令(强烈信号!)

Questions About Standards

关于标准的问题

  • "what's the rule for X" / "how should I X"
  • "is it X or Y" / "which way is correct"
  • "what's the coding style for X"

  • "what's the rule for X" / "how should I X"(X的规则是什么 / 我应该如何做X)
  • "is it X or Y" / "which way is correct"(是X还是Y / 哪种方式是正确的)
  • "what's the coding style for X"(X的编码风格是什么)

Capture Process

捕获流程

When a rule/preference is detected:
当检测到规则/偏好时:

1. Acknowledge Detection

1. 确认检测到规则

I noticed you expressed a preference/rule. Let me capture this.
我注意到您表达了一项偏好/规则。我将记录下来。

2. Extract Rule Details

2. 提取规则细节

Parse the user's statement to identify:
  • Category: What area does this apply to? (coding, naming, imports, patterns, tools, communication)
  • Rule Type: ALWAYS, NEVER, PREFER, AVOID
  • Specific Action: What exactly should/shouldn't be done
  • Context: When does this apply
  • Example: Good vs bad example if mentioned
解析用户的语句,识别:
  • 类别:适用于哪个领域?(编码、命名、导入、模式、工具、沟通)
  • 规则类型:ALWAYS、NEVER、PREFER、AVOID
  • 具体操作:具体应该/不应该做什么
  • 上下文:适用场景
  • 示例:如果提到了正确与错误的示例

3. Document to Capture File

3. 记录到捕获文件

Append to
.agents/SYSTEM/CAPTURED-RULES.md
:
markdown
undefined
追加到
.agents/SYSTEM/CAPTURED-RULES.md
markdown
undefined

[YYYY-MM-DD HH:MM] - [Category]: [Short Title]

[YYYY-MM-DD HH:MM] - [类别]: [简短标题]

User said:
"[Exact quote from user]"
Rule extracted:
  • Type: [ALWAYS | NEVER | PREFER | AVOID]
  • Action: [What to do/not do]
  • Context: [When this applies]
  • Category: [coding | naming | imports | patterns | tools | communication | workflow]
Example:
// Good
[good example]

// Bad
[bad example]

**Status**: PENDING_REVIEW

```
用户原话:
"[用户的准确表述]"
提取的规则:
  • 类型:[ALWAYS | NEVER | PREFER | AVOID]
  • 操作:应该/不应该做的具体内容
  • 上下文:适用场景
  • 类别:[coding | naming | imports | patterns | tools | communication | workflow]
示例:
// 正确示例
[正确示例]

// 错误示例
[错误示例]

**状态**:PENDING_REVIEW

```

4. Confirm with User

4. 向用户确认


Captured this rule:

- [Brief summary of the rule]

Should I add this to the permanent rules? [Yes/No/Modify]

已记录以下规则:

- [规则简短摘要]

是否要将其添加到永久规则中?[是/否/修改]

5. On Confirmation

5. 确认后的操作

  • Move to
    USER-PREFERENCES.md
    under appropriate section
  • Or create new section in
    RULES.md
    if it's a coding standard
  • Remove from
    CAPTURED-RULES.md
    (or mark as PROCESSED)

  • 移动到
    USER-PREFERENCES.md
    对应的章节下
  • 如果是编码标准,在
    RULES.md
    中创建新章节
  • CAPTURED-RULES.md
    中移除(或标记为PROCESSED)

Rule Categories

规则类别

Coding Rules

编码规则

  • Pattern preferences
  • Import conventions
  • Naming conventions
  • File structure
  • Component patterns
  • 模式偏好
  • 导入惯例
  • 命名规范
  • 文件结构
  • 组件模式

Workflow Rules

工作流规则

  • Build/test preferences
  • Git workflow
  • Documentation requirements
  • Communication style
  • 构建/测试偏好
  • Git工作流
  • 文档要求
  • 沟通风格

Tool Rules

工具规则

  • CLI preferences
  • IDE settings
  • Terminal behavior
  • Background processes
  • CLI偏好
  • IDE设置
  • 终端行为
  • 后台进程

Communication Rules

沟通规则

  • Response style
  • Verbosity preferences
  • Explanation depth
  • Acknowledgment patterns

  • 回复风格
  • 详细程度偏好
  • 解释深度
  • 确认模式

Storage Locations

存储位置

Rule TypeStorage Location
Personal preferences
../.agents/SYSTEM/ai/USER-PREFERENCES.md
Coding standards
.agents/SYSTEM/RULES.md
Critical rules
../.agents/SYSTEM/critical/CRITICAL-NEVER-DO.md
Pending review
../.agents/SYSTEM/CAPTURED-RULES.md

规则类型存储位置
个人偏好
../.agents/SYSTEM/ai/USER-PREFERENCES.md
编码标准
.agents/SYSTEM/RULES.md
关键规则
../.agents/SYSTEM/critical/CRITICAL-NEVER-DO.md
待审核
../.agents/SYSTEM/CAPTURED-RULES.md

Auto-Capture File Format

自动捕获文件格式

File:
../.agents/SYSTEM/CAPTURED-RULES.md
markdown
undefined
文件:
../.agents/SYSTEM/CAPTURED-RULES.md
markdown
undefined

Captured Rules - Pending Review

Captured Rules - Pending Review

Rules automatically captured from conversations. Review and promote to permanent docs.

Rules automatically captured from conversations. Review and promote to permanent docs.

Pending Rules

Pending Rules

[Auto-captured rules appear here]

[自动捕获的规则将显示在此处]

Processed Rules

Processed Rules

[Rules that have been promoted to permanent docs]

---
[已升级到永久文档的规则]

---

Integration with Other Skills

与其他Skill的集成

This skill works with:
  • docs: For formatting captured rules properly
  • session-documenter: Rules captured during session are included in session docs

该Skill可与以下Skill配合使用:
  • docs:用于正确格式化捕获的规则
  • session-documenter:会话中捕获的规则会被包含在会话文档中

Cleanup Command

清理命令

When user says "clean up rules" or "process captured rules":
  1. Read
    CAPTURED-RULES.md
  2. Present each pending rule for review
  3. User can: Approve, Modify, Delete
  4. Approved rules get promoted to permanent docs
  5. File is cleaned up

当用户说"clean up rules"或"process captured rules"时:
  1. 读取
    CAPTURED-RULES.md
  2. 逐个展示待审核的规则
  3. 用户可以:批准、修改、删除
  4. 批准的规则会被升级到永久文档
  5. 文件会被清理

Example Interaction

交互示例

User: "stop using console.log for debugging, use the logger service"
Claude:
I noticed a new rule. Let me capture it:

Rule: Use logger service instead of console.log for debugging
Category: Coding
Type: NEVER (console.log) / ALWAYS (logger service)

Added to captured rules. Should I promote this to permanent coding rules?

用户:"stop using console.log for debugging, use the logger service"(不要再用console.log调试,要用日志服务)
Claude
我注意到一条新规则。我将记录下来:

规则:调试时使用日志服务而非console.log
类别:编码
类型:NEVER(console.log)/ ALWAYS(日志服务)

已添加到捕获规则中。是否要将其升级为永久编码规则?

Activation Triggers

激活触发器

The skill activates on these regex patterns:
regex
undefined
该Skill会在匹配以下正则表达式模式时激活:
regex
undefined

Direct commands

Direct commands

(always|never|don't|stop|from now on|going forward)\s+.+ (prefer|like|want|need)\s+(you to|it to|this to)\s+.+ (the rule is|the standard is|the convention is)\s+.+
(always|never|don't|stop|from now on|going forward)\s+.+ (prefer|like|want|need)\s+(you to|it to|this to)\s+.+ (the rule is|the standard is|the convention is)\s+.+

Frustration signals

Frustration signals

(why (did|do) you|stop doing|I told you|I already said)\s+.+ (that's (wrong|not right|incorrect)|fix this|change this)\s+.+
(why (did|do) you|stop doing|I told you|I already said)\s+.+ (that's (wrong|not right|incorrect)|fix this|change this)\s+.+

Questions about standards

Questions about standards

(what's the (rule|standard|convention) for|how should I|which way is)\s+.+

---

**When this skill is active**, you will automatically capture and document any rules, preferences, or standards the user expresses, ensuring nothing is forgotten between sessions.
(what's the (rule|standard|convention) for|how should I|which way is)\s+.+

---

**当该Skill处于激活状态时**,它会自动捕获并记录用户表达的任何规则、偏好或标准,确保会话之间不会遗漏任何信息。