원클릭으로
rule-extraction
// Extract a structured list of rules from all markdown files at the top level of a skill directory. Use this skill whenever you need to parse rules out of a skill for conflict checking, merging, or diffing.
// Extract a structured list of rules from all markdown files at the top level of a skill directory. Use this skill whenever you need to parse rules out of a skill for conflict checking, merging, or diffing.
| name | Rule Extraction |
| description | Extract a structured list of rules from all markdown files at the top level of a skill directory. Use this skill whenever you need to parse rules out of a skill for conflict checking, merging, or diffing. |
| version | 1.1.0 |
This skill teaches you how to extract a structured, line-numbered list of rules from a skill directory.
A rule is any statement that prescribes or constrains agent behavior. Recognize rules by their form:
var"Rules can appear as:
- or * or +)1., 2.)**Always do X**)Exclude the following from extraction:
vague: trueReturn a JSON array. Each rule is an object:
[
{
"id": 1,
"file": "SKILL.md",
"line": 12,
"text": "Always add type annotations to function parameters",
"source_text": "- Always add type annotations to function parameters",
"vague": false
},
{
"id": 2,
"file": "SKILL.md",
"line": 15,
"text": "Do not use var, prefer const or let",
"source_text": "**Do not use `var`** — prefer `const` or `let`",
"vague": false
},
{
"id": 3,
"file": "examples.md",
"line": 4,
"text": "Do good work",
"source_text": "- Do good work",
"vague": true
}
]
Field definitions:
id: Sequential integer starting from 1, across all files combinedfile: Filename (basename only, e.g. SKILL.md, examples.md) where the rule appearsline: Line number within that file where the rule appears (1-indexed)text: Cleaned rule text, stripped of markdown formattingsource_text: Original raw line as it appears in the filevague: true if the rule is too broad to be actionableThe input is a skill directory path (e.g. ~/.claude/skills/humanizer/).
Files to read: all *.md files directly inside the skill directory — SKILL.md first, then any other *.md files in alphabetical order.
Files to skip:
.sh, .py, .js, .json, etc.)*.md files at the top level of the skill directory (non-recursive). Read SKILL.md first if present; read remaining *.md files in alphabetical order.--- delimiters at the top of each file)``` fences) — these are examples, not rules-, *, **, backticks) but preserve the meaningtext, preserve original in source_textInput skill directory: ~/.claude/skills/code-style/
Files found at top level: SKILL.md, extra-rules.md
(Any subdirectory contents are ignored.)
SKILL.md:
---
name: Code Style
---
# Code Style Guidelines
Keep code clean and maintainable.
## Naming
- Use camelCase for variables and functions
- Use PascalCase for classes and types
- Never use single-letter variable names except for loop indices
## Comments
Always write comments in English.
Do not write comments explaining what the code does — only explain why.
## Example
\`\`\`python
# good
def calculate_total(items):
return sum(items)
\`\`\`
extra-rules.md:
- Prefer explicit returns over implicit ones
Output:
[
{
"id": 1,
"file": "SKILL.md",
"line": 10,
"text": "Use camelCase for variables and functions",
"source_text": "- Use camelCase for variables and functions",
"vague": false
},
{
"id": 2,
"file": "SKILL.md",
"line": 11,
"text": "Use PascalCase for classes and types",
"source_text": "- Use PascalCase for classes and types",
"vague": false
},
{
"id": 3,
"file": "SKILL.md",
"line": 12,
"text": "Never use single-letter variable names except for loop indices",
"source_text": "- Never use single-letter variable names except for loop indices",
"vague": false
},
{
"id": 4,
"file": "SKILL.md",
"line": 15,
"text": "Always write comments in English",
"source_text": "Always write comments in English.",
"vague": false
},
{
"id": 5,
"file": "SKILL.md",
"line": 16,
"text": "Do not write comments explaining what the code does — only explain why",
"source_text": "Do not write comments explaining what the code does — only explain why.",
"vague": false
},
{
"id": 6,
"file": "extra-rules.md",
"line": 1,
"text": "Prefer explicit returns over implicit ones",
"source_text": "- Prefer explicit returns over implicit ones",
"vague": false
}
]
Notes:
id is sequential across all files; line resets to 1 for each new file~/.claude/skills/code-style/ are not scanned