Logo di Rule Extraction

Rule Extraction

Organizzazione
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.

Panoramica

AutoreKnowledgeXLab
Repositoryskill-git
Nome della skillRule Extraction
Stelle
42
Fork
1
File inclusi
Solo istruzioni
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da KnowledgeXLab su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Rule Extraction in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/KnowledgeXLab/skill-git/tree/main/skills/rule-extraction
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella nella cartella delle skill di quell'agente.

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
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Rule Extraction in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Rule Extraction non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Rule Extraction non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

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

Domande frequenti

Cosa fa la skill IA 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.

Perché usare Rule Extraction su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Rule Extraction è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Rule Extraction in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/KnowledgeXLab/skill-git/tree/main/skills/rule-extraction. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Rule Extraction?

Qualsiasi modello che colleghi in TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Rule Extraction?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Rule Extraction: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Rule Extraction è gratuita?

Sì. È pubblicata su GitHub da KnowledgeXLab con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, modelli o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇