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 | $0.00030 | $0.00851 |
| Sonnet 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 11d 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.
- 11d 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 (36 stars, last pushed 4mo ago), licensed MIT. It adds 59 tokens to every session and 1,703 once invoked, about $0.0003 per session on Opus 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.
Other skills, from other repositories
pydantic-ai
Build production-ready AI agents with PydanticAI — type-safe tool use, structured outputs, dependency injection, and multi-model support.
frontend-feature
Build a new page, view, or data-driven feature in the Next.js frontend. Use when adding a route under the dashboard/marketing area, wiring UI to a backend endpoint, adding client state, or creating a localized page. Covers App Router, data fetching, Zustand stores, and i18n.
rag-knowledge
Work with the RAG knowledge base — ingest documents, run semantic search, manage collections, or add a sync source/connector (Google Drive, S3). Use when populating or debugging the knowledge base, tuning retrieval, or adding a new document source. This project uses {{ cookiecutter.vectorstore }} + {{…
alembic-migration
Create, review, and apply database schema changes with Alembic. Use whenever a SQLAlchemy model is added or changed, a column/index/constraint needs to change, or a data backfill is required — anything that alters the PostgreSQL schema.
billing-stripe
Work with Stripe billing — subscriptions, plans/prices, the Customer Portal, credits, usage metering, invoices, and webhook events. Use when changing plans, handling a new Stripe webhook, debugging a payment/subscription flow, or touching credit balances and usage.
Agent Management
Create, edit, upgrade, delete, and audit agents.