Borrowing it
Nothing to install: this file belongs to Artesiana/agent2. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/Artesiana/agent2/main/.agents/skills/building-domain-experts/SKILL.mdgit clone --depth 1 https://github.com/Artesiana/agent2Wrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/artesiana/agent2/building-domain-experts)<a href="https://agentmods.dev/skills/artesiana/agent2/building-domain-experts"><img src="https://agentmods.dev/badge/skills/artesiana/agent2/building-domain-experts/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/artesiana/agent2/building-domain-experts"><img src="https://agentmods.dev/badge/skills/artesiana/agent2/building-domain-experts.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00059 | $0.01703 |
| Opus 5.5 | $0.00024 | $0.00681 |
| Sonnet 5.5 | $0.00012 | $0.00341 |
| Haiku 4.5 | $0.00006 | $0.00170 |
Grade A, and why
building-domain-experts scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 188 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Building Domain Expert Agents
Overview
A domain expert agent is the most powerful pattern in Agent2. It combines: document reading (OCR), domain knowledge (R2R search), context-aware reasoning, human-in-the-loop, and structured output. Think: an experienced professional sitting at a desk with reference books, tools, and the ability to ask questions.
Before building a serious domain expert, study docs/brain-clone-pattern.md and
agents/procurement-compliance-officer. The procurement agent is the canonical
public example for the full Agent2 pattern.
When to Activate
- User wants an agent that processes documents against professional standards
- Agent needs to "look things up" in reference material before deciding
- Agent needs to ask clarifying questions and resume after human answers
- Agent must produce structured output that follows domain-specific rules
- Industries: legal, medical billing, accounting, compliance, insurance, HR, procurement
The Domain Expert Pattern
Document arrives (PDF, email, text)
→ Agent reads it (OCR via Docling MCP or text input)
→ Agent checks context (who is this for? what rules apply?)
→ Agent searches knowledge (R2R via Knowledge MCP)
→ Agent decides: complete? or needs clarification?
→ If complete: structured result + confidence score
→ If incomplete: clarifying question → pause → human answers → resume
→ Human approves final result
Architecture
1. The Schema — Your Domain Contract
Design the output schema around the three possible outcomes every domain expert faces:
class ExpertResult(BaseModel):
status: Literal["complete", "needs_clarification", "rejected"]
# Domain-specific structured output
findings: list[Finding] = Field(default_factory=list)
# Clarification path
question: ClarificationRequest | None = None
# Rejection path
rejection_reason: str | None = None
# Always present
reasoning: str # The expert's thought process
confidence: float = Field(ge=0.0, le=1.0)
review_steps: list[str] = Field(default_factory=list)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 188 lines · 59 tokens per session scan A 5a3f28a62f47
building-domain-experts is a skill published in the GitHub repository Artesiana/agent2 (37 stars, last pushed 6mo ago), licensed MIT. It adds 59 tokens to every session and 1,703 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
building-domain-experts compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| building-domain-expertsArtesiana/agent2 | Skill | 37 | 6mo ago | MIT | A | 59 | Claude Code, Codex |
| alembic-migrationvstorm-co/full-stack-ai-agent-template | Skill | 2.0k | 7d ago | MIT | A | 56 | Claude Code |
| frontend-featurevstorm-co/full-stack-ai-agent-template | Skill | 2.0k | 7d ago | MIT | A | 64 | Claude Code |
| billing-stripevstorm-co/full-stack-ai-agent-template | Skill | 2.0k | 7d ago | MIT | A | 56 | Claude Code |
| Agent Managementsseshachala/conductai | Skill | 32 | 2d ago | Apache-2.0 | A | 14 | Claude Code |
| video_action_recognitionfdueblab/Micro-Agent | Skill | 100 | 1mo ago | MIT | A | 0 | Claude Code, Codex |
| trade_compliancefdueblab/Micro-Agent | Skill | 100 | 1mo ago | MIT | A | 0 | Claude Code, Codex |