Manage knowledge domains (e.g., Medical, Finance). An agent skill from FabioYanezRomero/Knowledge-Graph-Builder.

MITAuto-check passedAI & LLM Engineering

Install Add Domain

skills CLI
$ npx skills add FabioYanezRomero/Knowledge-Graph-Builder --skill add-domain -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install FabioYanezRomero/Knowledge-Graph-Builder add-domain --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/FabioYanezRomero/Knowledge-Graph-Builder.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agent/skills/add-domain .claude/skills/add-domain && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
add-domain
GitHub stars
103
Token cost
~3.1k tokens
SKILL.md length
415 words
Files
1
Skills in repo
6
Repo updated
First seen
Licence
MIT

At a glance

Manage knowledge domains (e.g., Medical, Finance). An agent skill from FabioYanezRomero/Knowledge-Graph-Builder.

  • Works in 5 steps: Create Resource Files → Create Schema (Optional) → Implement the Domain Class → …
  • Tasks that involve Prompt engineering
  • SKILL.md covers Overview, Architecture, Dependencies and Directory Structure, plus 10 more sections
  • Calls python

What it does

Add Domain is an agent skill from FabioYanezRomero/Knowledge-Graph-Builder. Manage knowledge domains (e.g., Medical, Finance). Covers adding new domains, updating prompts, and adding few-shot examples.

Its SKILL.md is about 3.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Prompt engineering. The repository describes itself as: Repository for building knowledge graphs from specific datasets using generative language model through ollama. The licence is MIT.

When your agent uses it

  • Tasks that involve Prompt engineering

Example prompts

  • “/add-domain”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Create Resource Files
  2. Create Schema (Optional)
  3. Implement the Domain Class
  4. Register in Domain Hub
  5. Verify

What it can do on your machine

Read from SKILL.md and the folder at commit 588f0d9. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Add Domain loads about 3.1k tokens when it runs. Until then it costs about 34 tokens; SKILL.md has 415 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~34
When it runs · the whole SKILL.md, loaded when a task matches
~3.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from FabioYanezRomero/Knowledge-Graph-Builder at commit 588f0d9, republished under its MIT licence (© FabioYanezRomero). 415 words, ~3,084 tokens.

Download SKILL.mdSave it as .claude/skills/add-domain/SKILL.md (or your agent's skills folder).
name
add-domain
description
Manage knowledge domains (e.g., Medical, Finance). Covers adding new domains, updating prompts, and adding few-shot examples.

Adding a Knowledge Domain

This skill documents how to add a new knowledge domain to kgb/domains/.

Overview

Domains are bundled resource sets containing prompts and few-shot examples for extraction and augmentation. The system provides:

  • Registry pattern with @domain() decorator
  • Automatic resource discovery via inspect.getfile()
  • Strategy-based augmentation folders
  • Optional schema constraints (entity types + relation types)

Architecture

                          Domains Module
    ┌───────────────────────────────────────────────────────────┐
    │                                                           │
    │  registry.py                base.py                       │
    │  ├─ @domain()               ├─ KnowledgeDomain (ABC)      │
    │  ├─ register_domain()       ├─ DomainComponent            │
    │  ├─ get_domain()            ├─ DomainLike (Protocol)      │
    │  └─ list_available_domains()└─ DomainResourceError        │
    │                                                           │
    │  models.py                                                │
    │  ├─ Triple, InferenceType, ExtractionMode                 │
    │  ├─ Extraction, ExtractionExample                         │
    │  ├─ AugmentationExample, DomainSchema                     │
    │  └─ DomainExamples                                        │
    │                                                           │
    │  legal/                     default/                      │
    │  ├─ __init__.py             ├─ __init__.py                │
    │  ├─ extraction/             ├─ extraction/                │
    │  ├─ augmentation/           └─ augmentation/              │
    │  └─ schema.json                                           │
    │                                                           │
    └───────────────────────────────────────────────────────────┘

Registration Flow:
  @domain("name") → register_domain() → _DOMAIN_REGISTRY → get_domain()

Dependencies

ComponentLibraryPurpose
Schema validationpydantic>=2.0Triple validation
Extractionlangextract>=0.1Prompt framework
Resource loadingpathlib (stdlib)File operations

Directory Structure

text
kgb/domains/<domain_name>/
├── __init__.py                 # Domain class with @domain decorator
├── extraction/
│   ├── prompt_open.md          # Open extraction prompt
│   ├── prompt_constrained.md   # Type-constrained extraction prompt
│   └── examples.json           # Few-shot extraction examples
├── augmentation/
│   └── connectivity/           # Strategy folder (one per strategy)
│       ├── prompt.md           # Strategy-specific augmentation prompt
│       └── examples.json       # Few-shot augmentation examples
└── schema.json                 # Optional: entity/relation type constraints

File extensions: Prompts use .md (markdown). The base class resolves prompt_open.md or prompt_constrained.md based on extraction_mode, and prompt.md for augmentation strategies.

Step 1: Create Resource Files

Extraction Prompts

Create extraction/prompt_open.md:

markdown
Extract all knowledge graph triples from the following biomedical text.
Focus on explicit relationships between biomedical entities.

For each relationship identified, extract:
- **head**: The source entity
- **relation**: The relationship type
- **tail**: The target entity

{{schema_constraints}}

Important: Do NOT include output format instructions. The langextract framework generates format instructions from examples. You can include {{schema_constraints}} to inject entity/relation type guidance.

Create extraction/prompt_constrained.md (for --mode constrained):

markdown
Extract knowledge graph triples from the following biomedical text.
Only extract entities and relations that match the provided schema types.

{{schema_constraints}}
Extraction Examples (extraction/examples.json)
json
[
  {
    "text": "Aspirin is used to treat headaches and reduce fever.",
    "extractions": [
      {
        "extraction_class": "Triple",
        "extraction_text": "Aspirin is used to treat headaches",
        "char_start": 0,
        "char_end": 35,
        "attributes": {
          "head": "Aspirin",
          "relation": "treats",
          "tail": "headaches",
          "inference": "explicit"
        }
      },
      {
        "extraction_class": "Triple",
        "extraction_text": "Aspirin is used to reduce fever",
        "char_start": 0,
        "char_end": 50,
        "attributes": {
          "head": "Aspirin",
          "relation": "reduces",
          "tail": "fever",
          "inference": "explicit"
        }
      }
    ]
  }
]

Key fields: char_start/char_end must be valid character positions in the text. extraction_text is the span that justifies the extraction. inference must be "explicit" for extraction examples.

Augmentation Prompt (augmentation/connectivity/prompt.md)
markdown
You are a biomedical knowledge graph expert.

Given the following text and a partially extracted knowledge graph with disconnected components,
generate new triples that bridge the disconnected components.

## Source Text
{{text}}

## Current Triples
{{current_triples}}

## Disconnected Components
{{disconnected_components}}

{{schema_constraints}}

Generate bridging triples as a JSON array. Each triple must have:
- head, relation, tail, inference ("contextual"), justification
Augmentation Examples (augmentation/connectivity/examples.json)
json
[
  {
    "input": {
      "text": "Aspirin treats headaches. Ibuprofen is an NSAID.",
      "components": [
        {"entities": ["Aspirin", "headaches"]},
        {"entities": ["Ibuprofen", "NSAID"]}
      ]
    },
    "output": [
      {
        "head": "Aspirin",
        "relation": "is_a",
        "tail": "NSAID",
        "inference": "contextual",
        "justification": "Aspirin is also classified as an NSAID, bridging the two components."
      }
    ]
  }
]

Step 2: Create Schema (Optional)

Create schema.json:

json
{
  "entity_types": ["Drug", "Disease", "Symptom", "Gene", "Protein"],
  "relation_types": ["treats", "causes", "indicates", "inhibits", "binds_to"]
}

When present, schema constraints are:

  • Injected into prompts via {{schema_constraints}}
  • Used for validation warnings (not hard enforcement by default)
  • Accessible via domain.schema.entity_types and domain.schema.relation_types

Step 3: Implement the Domain Class

Create kgb/domains/biomedical/__init__.py:

python
"""Biomedical knowledge domain for clinical and research document analysis."""

from __future__ import annotations
from ..base import KnowledgeDomain
from ..registry import domain


@domain("biomedical")  # This name is used with --domain CLI flag
class BiomedicalDomain(KnowledgeDomain):
    """Domain for biomedical and clinical document analysis.

    Focuses on:
    - Biomedical entities (drugs, diseases, symptoms, genes)
    - Clinical relationships (treats, causes, indicates, inhibits)
    """
    pass


__all__ = ["BiomedicalDomain"]
How Auto-Discovery Works

The KnowledgeDomain base class uses inspect.getfile() to find resources:

python
# In KnowledgeDomain.__init__():
self._root_dir = Path(inspect.getfile(self.__class__)).parent
# → resolves to kgb/domains/biomedical/

From there it finds:

  • extraction/prompt_open.md (or prompt_constrained.md)
  • extraction/examples.json
  • augmentation/<strategy>/prompt.md
  • augmentation/<strategy>/examples.json
  • schema.json

Override with root_dir= for testing.

Step 4: Register in Domain Hub

Update kgb/domains/__init__.py:

python
# Import domains to trigger registration
from . import legal
from . import default
from . import biomedical  # Add this — triggers @domain decorator

Step 5: Verify

Show full SKILL.md (167 more words)Show less
Check Registration
bash
python -c "from kgb.domains import list_available_domains; print(list_available_domains())"
# Output: ['legal', 'default', 'biomedical']
Unit Tests
python
import pytest
from kgb.domains import get_domain, list_available_domains, DomainResourceError


def test_domain_registered():
    assert "biomedical" in list_available_domains()


def test_extraction_prompt_loads():
    domain = get_domain("biomedical")
    assert len(domain.extraction.prompt) > 50


def test_extraction_examples_valid():
    domain = get_domain("biomedical")
    examples = domain.extraction.examples
    assert isinstance(examples, list)
    assert len(examples) > 0
    assert "text" in examples[0]
    assert "extractions" in examples[0]


def test_augmentation_strategy_exists():
    domain = get_domain("biomedical")
    assert "connectivity" in domain.list_augmentation_strategies()

    conn = domain.get_augmentation("connectivity")
    assert len(conn.prompt) > 0
    assert isinstance(conn.examples, list)


def test_schema_loads():
    domain = get_domain("biomedical")
    assert "Drug" in domain.schema.entity_types
    assert "treats" in domain.schema.relation_types


def test_constrained_mode():
    domain = get_domain("biomedical", extraction_mode="constrained")
    assert "constrained" in domain.extraction._prompt_path.name


def test_missing_strategy():
    domain = get_domain("biomedical")
    with pytest.raises(DomainResourceError):
        domain.get_augmentation("nonexistent")

CLI Usage

bash
# Extract with your domain
kgb extract --input data.jsonl --domain biomedical

# Constrained mode (uses prompt_constrained.md)
kgb extract --input data.jsonl --domain biomedical --mode constrained

# Augment with connectivity strategy
kgb augment connectivity --input data.jsonl --domain biomedical

# List available domains
kgb list domains

Troubleshooting

"DomainResourceError: Resource not found"
  • Verify file exists: ls kgb/domains/biomedical/extraction/
  • Check filename matches exactly: prompt_open.md (not .txt)
  • Augmentation prompts must be prompt.md inside strategy folders
"ValueError: Unknown domain 'biomedical'"
  • Add import in kgb/domains/__init__.py: from . import biomedical
  • Restart Python interpreter (imports are cached)
"ValidationError: examples[0]..."
  • Check examples.json matches the ExtractionExample schema
  • Validate JSON: python -m json.tool examples.json
  • Ensure char_start/char_end are valid integers

Error Handling

python
from kgb.domains import get_domain, DomainResourceError

try:
    domain = get_domain("biomedical")
    prompt = domain.extraction.prompt
except DomainResourceError as e:
    print(f"Resource error: {e} (file: {e.resource_path})")
except ValueError as e:
    print(f"Domain not found: {e}")

Files to Create/Modify

FileAction
kgb/domains/biomedical/__init__.pyCreate — domain class
kgb/domains/biomedical/extraction/prompt_open.mdCreate — open extraction prompt
kgb/domains/biomedical/extraction/prompt_constrained.mdCreate — constrained prompt
kgb/domains/biomedical/extraction/examples.jsonCreate — few-shot examples
kgb/domains/biomedical/augmentation/connectivity/prompt.mdCreate — augmentation prompt
kgb/domains/biomedical/augmentation/connectivity/examples.jsonCreate — augmentation examples
kgb/domains/biomedical/schema.jsonCreate — entity/relation types
kgb/domains/__init__.pyModify — add import

Verification Checklist

  • Directory structure matches layout above (.md extensions for prompts)
  • @domain("name") decorator applied to class
  • Class inherits from KnowledgeDomain
  • Extraction prompts do NOT include format instructions (langextract handles that)
  • examples.json includes char_start/char_end and extraction_text
  • Augmentation folder per strategy (at least connectivity/)
  • Import added in kgb/domains/__init__.py
  • Optional schema.json with entity_types and relation_types
  • Tests pass for registration, resource loading, and schema

© FabioYanezRomero, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agent/skills/add-domain of FabioYanezRomero/Knowledge-Graph-Builder.

Open the folder on GitHubat commit 588f0d9

Compare with similar skills

Add Domain next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Add Domain compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Add Domain this skillFabioYanezRomero/Knowledge-Graph-Builder103—~3.1kAutomated safety check: PassMIT
Prompt Improverseverity1/claude-code-prompt-improver1.9k1 repos~1.7kAutomated safety check: PassMIT
Prompt Engineering Patternsynulihao/AgentSkillOS61814 repos~1.7kAutomated safety check: PassNone
Patch CreationPiebald-AI/tweakcc2.5k—~1.6kAutomated safety check: PassMIT
Senior Prompt Engineermaslennikov-ig/claude-code-orchestrator-kit2603 repos~1.4kAutomated safety check: PassCustom licence
Codex Fable5baskduf/FableCodex437—~1.6kAutomated safety check: PassAGPL-3.0

Similar skills

  • Prompt Improver

    severity1/claude-code-prompt-improver

    This skill enriches vague prompts with targeted research and clarification before execution.

    1.9k GitHub starsUsed in 1 repo~1.7k tokens
    AI & LLM EngineeringAuto-check passed
  • Prompt Engineering Patterns

    ynulihao/AgentSkillOS

    Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability in production.

    618 GitHub starsUsed in 14 repos~1.7k tokens
    AI & LLM EngineeringAuto-check passed
  • Patch Creation

    Piebald-AI/tweakcc

    Create and register new patches for tweakcc. An agent skill from Piebald-AI/tweakcc.

    2.5k GitHub stars~1.6k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Senior Prompt Engineer

    maslennikov-ig/claude-code-orchestrator-kit

    Provides reference guides and Python scripts for prompt optimization, RAG evaluation, and agent orchestration when building or tuning LLM systems.

    260 GitHub starsUsed in 3 repos~1.4k tokens
    AI & LLM EngineeringAuto-check passed
  • Codex Fable5

    baskduf/FableCodex

    Apply a Claude Fable 5 inspired operating style inside Codex.

    437 GitHub stars~1.6k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed
  • Reference for designing and tuning production LLM prompts: few-shot examples, chain-of-thought, structured outputs, templates and system prompts.

    40k GitHub stars~1.3k tokensUpdated 6 days ago
    AI & LLM EngineeringAuto-check passed

More from FabioYanezRomero/Knowledge-Graph-Builder

  • Add LLM Client

    FabioYanezRomero/Knowledge-Graph-Builder

    Adds a new LLM client provider to the clients module. An agent skill from FabioYanezRomero/Knowledge-Graph-Builder.

    103 GitHub stars~3.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Add Augmentation Strategy

    FabioYanezRomero/Knowledge-Graph-Builder

    Adds a new iterative augmentation strategy (e.g., enrichment, summarization) to the builder module.

    103 GitHub stars~3.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Add Converter

    FabioYanezRomero/Knowledge-Graph-Builder

    Adds a new output format converter (e.g., CSV, RDF) to the IO writers module.

    103 GitHub stars~2.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Add Dataset Format

    FabioYanezRomero/Knowledge-Graph-Builder

    Adds a new input format loader (e.g., Parquet, Excel) to the IO readers module.

    103 GitHub stars~1.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Add Visualization

    FabioYanezRomero/Knowledge-Graph-Builder

    Adds a new visualization engine or style to the visualization module.

    103 GitHub stars~3.3k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Add Domain

What does Add Domain do?

Manage knowledge domains (e.g., Medical, Finance). An agent skill from FabioYanezRomero/Knowledge-Graph-Builder. Add Domain is an agent skill from FabioYanezRomero/Knowledge-Graph-Builder., Medical, Finance).

When should I use Add Domain?

Add Domain fits situations like: tasks that involve Prompt engineering.

How do I install Add Domain in Claude Code?

Run `npx skills add FabioYanezRomero/Knowledge-Graph-Builder --skill add-domain -a claude-code`. Or copy the skill folder (.agent/skills/add-domain in FabioYanezRomero/Knowledge-Graph-Builder) into .claude/skills/add-domain in your project. Claude Code loads it when a task matches its description.

How do I install Add Domain in Codex?

Run `npx skills add FabioYanezRomero/Knowledge-Graph-Builder --skill add-domain -a codex`. Or copy the skill folder (.agent/skills/add-domain in FabioYanezRomero/Knowledge-Graph-Builder) into .agents/skills/add-domain in your project. Codex loads it when a task matches its description.

Can I use Add Domain in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add FabioYanezRomero/Knowledge-Graph-Builder --skill add-domain -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/add-domain, .gemini/skills/add-domain, .github/skills/add-domain and .opencode/skills/add-domain in your project.

What does Add Domain need to run?

Going by SKILL.md and its folder, Add Domain needs the command-line tools its instructions call (python). Our summary lists: Python 3.

Does Add Domain access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Add Domain safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Add Domain use?

Add Domain is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Add Domain use?

About 3.1k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Add Domain?

Skills that share tags, products or a category with Add Domain: Prompt Improver (severity1/claude-code-prompt-improver, 1.9k stars), Prompt Engineering Patterns (ynulihao/AgentSkillOS, 618 stars), Patch Creation (Piebald-AI/tweakcc, 2.5k stars) and Senior Prompt Engineer (maslennikov-ig/claude-code-orchestrator-kit, 260 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Add Domain?

FabioYanezRomero (a GitHub user) maintains it in FabioYanezRomero/Knowledge-Graph-Builder, which has 103 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on August 28, 2026.

Source: FabioYanezRomero/Knowledge-Graph-Builder on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.