Logo van Rule Extraction

Rule Extraction

Organisatie
KnowledgeXLab
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.

Overzicht

UitgeverKnowledgeXLab
Repositoryskill-git
SkillnaamRule Extraction
Sterren
42
Forks
1
Meegeleverde bestanden
Alleen instructies
LicentieMIT
Links
  • Instructies in Markdown

    Een SKILL.md-bestand dat het model laadt wanneer nodig, zodat het alleen tokens kost als een verzoek er daadwerkelijk bij past.

  • Werkt met elk LLM

    AI-skills zijn gewone Markdown, geen aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Compleet zonder extra bestanden

    Alles wat het model nodig heeft, staat in de instructies — geen extra bestanden om te synchroniseren.

  • Open source

    Gepubliceerd door KnowledgeXLab op GitHub. Lees de broninhoud voordat je de skill installeert.

Installatie

Installeer de AI-skill Rule Extraction in TypingMind om deze met elke LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map — het leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/KnowledgeXLab/skill-git/tree/main/skills/rule-extraction
  4. Schakel de skill in elke chat in waarin je deze beschikbaar wilt hebben.
Plug-ins → Skills → Nieuwe skill → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/KnowledgeXLab/skill-git.git /tmp/skill-git
mkdir -p .claude/skills
cp -r /tmp/skill-git/skills/rule-extraction .claude/skills/knowledgexlab-rule-extraction
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Rule Extraction in een willekeurige chat in TypingMind in en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek erbij past, laadt het model zelf de volledige instructies — je hoeft de skill nooit handmatig aan te roepen en deze kost pas tokens wanneer je de skill daadwerkelijk gebruikt.

Het model laadt Rule Extraction automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Rule Extraction niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

Rule Extraction

This skill teaches you how to extract a structured, line-numbered list of rules from a skill directory.

What Counts as a Rule

A rule is any statement that prescribes or constrains agent behavior. Recognize rules by their form:

  • Imperative directives: "Always add type annotations", "Never use var"
  • Prohibition patterns: "Do not X", "Avoid X", "禁止 X"
  • Requirement patterns: "Must X", "Should X", "需要 X", "必须 X"
  • Conditional behavior: "If X, then Y", "When X, do Y"
  • Style/format mandates: "Use camelCase", "Limit lines to 80 characters"
  • Preference statements: "Prefer X over Y", "优先使用 X"

Rules can appear as:

  • Bullet list items (- or * or +)
  • Numbered list items (1., 2.)
  • Bold or emphasized sentences (**Always do X**)
  • Plain sentences within a paragraph that contain directive language
  • Section headers that are themselves imperatives ("Never commit secrets")

What Does NOT Count as a Rule

Exclude the following from extraction:

  • Descriptive text: Explanations of why a rule exists, background context
  • Examples: Code blocks, sample outputs, "for example..." passages
  • Metadata: YAML frontmatter, version info, author notes
  • Headings that introduce a section (unless the heading itself is an imperative rule)
  • Vague non-actionable statements: "Do good work", "Be helpful" — extract these but flag them as vague: true

Output Format

Return a JSON array. Each rule is an object:

json
[
  {
    "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 combined
  • file: Filename (basename only, e.g. SKILL.md, examples.md) where the rule appears
  • line: Line number within that file where the rule appears (1-indexed)
  • text: Cleaned rule text, stripped of markdown formatting
  • source_text: Original raw line as it appears in the file
  • vague: true if the rule is too broad to be actionable

Input Scope

The 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:

  • Subdirectories and any files inside them (no recursive scan)
  • Non-markdown files (.sh, .py, .js, .json, etc.)

Extraction Process

  1. List all *.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.
  2. For each file, read it line by line, tracking line numbers within that file.
  3. Skip frontmatter (everything between --- delimiters at the top of each file)
  4. Skip code blocks (between ``` fences) — these are examples, not rules
  5. For each line, determine if it contains a rule using the criteria above
  6. For paragraph text: split into sentences, check each sentence independently
  7. Clean the extracted text: remove markdown syntax (-, *, **, backticks) but preserve the meaning
  8. Assign line numbers based on where the rule text starts within its file
  9. Record the source filename for every rule

Handling Ambiguous Cases

  • Compound bullet: "Use camelCase and limit lines to 80 chars" → split into two rules, both on the same line number
  • Nested bullets: Treat each nested item as an independent rule
  • Conditional rules: Keep the full conditional ("If Python, use type hints") as one rule — do not split on the condition
  • Negated rules: "Don't use X" and "Never use X" are equivalent — normalize to a consistent form in text, preserve original in source_text

Example

Input 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:

json
[
  {
    "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:

  • SKILL.md lines 18–23 (the code block) are skipped entirely
  • id is sequential across all files; line resets to 1 for each new file
  • Any subdirectories inside ~/.claude/skills/code-style/ are not scanned

Veelgestelde vragen

Wat doet de AI-skill 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.

Waarom Rule Extraction gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Rule Extraction bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model, en je kunt midden in een chat van model wisselen zonder dat de skill niet meer werkt. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Rule Extraction in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/KnowledgeXLab/skill-git/tree/main/skills/rule-extraction. TypingMind leest het bestand SKILL.md en installeert het als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Rule Extraction gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Rule Extraction gebruiken?

Zoveel als je wilt. Zolang een model skills ondersteunt, kun je Rule Extraction ermee gebruiken: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama en meer. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Rule Extraction gratis?

Ja. Deze skill is door KnowledgeXLab op GitHub gepubliceerd onder de licentie MIT. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. Deze volgt het open Agent Skills-formaat: een bestand met de naam SKILL.md met een naam en beschrijving, plus eventuele scripts, sjablonen of referentiebestanden die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇