شعار Rule Extraction

Rule Extraction

مؤسسة
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.

نظرة عامة

الناشرKnowledgeXLab
المستودعskill-git
اسم المهارةRule Extraction
النجوم
42
التفريعات
1
الملفات المرفقة
تعليمات فقط
الترخيصMIT
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • مكتفية بذاتها

    كل ما يحتاجه النموذج موجود في التعليمات — لا ملفات إضافية لمزامنتها.

  • مفتوحة المصدر

    نشرها KnowledgeXLab على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Rule Extraction في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى الإضافات → المهارات.
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/KnowledgeXLab/skill-git/tree/main/skills/rule-extraction
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات → المهارات → إضافة مهارة → من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

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
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Rule Extraction في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج Rule Extraction تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Rule Extraction بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تترتب أي تكلفة على المهارة غير المستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

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

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي 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.

لماذا تستخدم Rule Extraction على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Rule Extraction عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Rule Extraction في TypingMind؟

افتح الإضافات → المهارات → التثبيت من GitHub في TypingMind والصق https://github.com/KnowledgeXLab/skill-git/tree/main/skills/rule-extraction. يقرأ TypingMind ملف SKILL.md الخاص بها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Rule Extraction؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Rule Extraction؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Rule Extraction معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Rule Extraction مجانية؟

نعم. نشرها KnowledgeXLab على GitHub بموجب ترخيص MIT. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا البريدية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇