Package domain expertise as queryable knowledge for humans and AI agents.
Technical knowledge trapped in experts' heads. Teams lack instant access to guidance on upgrades, debugging, optimization. AI agents lack domain depth.
3-layer knowledge architecture:
- Human docs - Narrative guides with examples
- AI skills - Quick-reference patterns optimized for LLM consumption
- Validation tests - Automated checks that knowledge stays current
# 1. Create structure
mkdir -p docs/{domain}-expert .ambient/skills/{domain}-expert tests/expert-validation
# 2. Write human guide (docs/{domain}-expert/README.md)
# 3. Distill to AI skill (.ambient/skills/{domain}-expert/SKILL.md)
# 4. Add validation tests (tests/expert-validation/test_{domain}.py)docs/{domain}-expert/ # Human layer (comprehensive)
├── README.md # Hub + quick reference
├── USAGE.md # Integration guide
├── UPGRADE.md # Version migration
└── OPTIMIZATION.md # Performance tuning
.ambient/skills/{domain}-expert/ # AI layer (concise)
├── SKILL.md # Quick patterns, checklists, Q&A
└── USAGE-FOR-AI.md # How AI should use the skill
tests/expert-validation/ # Validation layer
└── test_{domain}.py # Verify knowledge is current
# {Domain} Expert
## Quick Reference
- Common task 1: Answer [details →](USAGE.md#task1)
- Common task 2: Answer [details →](USAGE.md#task2)
## Guides
- [Usage](USAGE.md) - Integration patterns
- [Upgrade](UPGRADE.md) - Version migration
- [Optimization](OPTIMIZATION.md) - Performance
- [Troubleshooting](TROUBLESHOOTING.md) - Debug guide
## Code Examples
\```language
# Concrete examples from your codebase
# Include file paths: src/foo.py:123
\```Rules:
- Use real examples from your codebase (not generic tutorials)
- Include file paths and line numbers
- Explain why, not just what
- Keep examples runnable
# {Domain} Expert Skill
**Version:** 1.0.0
**Purpose:** {One-line description}
## When to Use
- {Trigger 1}
- {Trigger 2}
## Quick Patterns
### {Task}
\```language
# Minimal code example
\```
## Configuration
| Setting | Default | Purpose |
|---------|---------|---------|
## Troubleshooting
When X fails:
1. Check Y
2. Verify Z
## Q&A Templates
### "{Common question}?"
**Response:**
\```
Direct answer.
Source: [file.md#section]
\```
## Documentation Links
- **USAGE.md** - Integration patterns
- **UPGRADE.md** - Version migrationRules:
- Concise (tables, checklists, not prose)
- Self-contained sections
- Always link to human docs for details
- Include Q&A templates for instant answers
"""Validate {domain} expert knowledge."""
import pytest
def test_config_examples_valid():
"""Config examples in docs actually work."""
# Extract configs from markdown
# Validate they parse correctly
pass
def test_version_info_current():
"""Version numbers not outdated."""
# Check versions against registries
# Flag if CVEs found
pass
def test_code_examples_run():
"""Code snippets execute without errors."""
# Extract code blocks
# Run in isolated environment
passRun in CI:
# .github/workflows/validate-expert.yml
on:
push:
paths: ['docs/{domain}-expert/**', '.ambient/skills/{domain}-expert/**']
schedule:
- cron: '0 0 * * 0' # Weekly
jobs:
validate:
runs-on: ubuntu-latest
steps:
- run: pytest tests/expert-validation/ -vplatform/
├── docs/claude-agent-sdk/ # 15K words
│ ├── README.md
│ ├── SDK-USAGE.md # Integration (~5K)
│ ├── UPGRADE-GUIDE.md # Migration (~4K)
│ └── AG-UI-OPTIMIZATION.md # Performance (~6K)
│
├── .ambient/skills/claude-sdk-expert/ # 700 lines
│ ├── SKILL.md # Patterns, checklists
│ └── USAGE-FOR-AMBER.md # Meta-guide
│
└── tests/smoketest/
├── test_sdk_integration.py # 15+ tests
└── README.md
Impact:
- "Should we upgrade?" → Instant answer (was: hours of research)
- SDK debugging → Follow checklist (was: trial and error)
- Performance → 3-5x improvement roadmap documented
git submodule add https://github.com/org/experts.git .experts
# Reference in agent: skills: [.experts/{domain}-expert]# mcp_server_{domain}_expert.py
from mcp.server import Server
server = Server("domain-expert")
@server.call_tool()
async def call_tool(name: str, args: dict):
if name == "query_expert":
# Load SKILL.md, search for answer
return {"content": [{"type": "text", "text": answer}]}Usage:
# .mcp.json or Claude Desktop config
{
"mcpServers": {
"domain-expert": {
"command": "python",
"args": ["-m", "domain_expert_mcp.server", "/path/to/knowledge"]
}
}
}pip install {domain}-expert-system
# Installs docs/, skills/, tests/- Interview domain expert
- Ask: "What do people always ask you?" "Biggest mistakes?" "What took longest to learn?"
- Document in human guides with real examples
- Extract key patterns from human docs
- Create decision trees for troubleshooting
- Build Q&A templates
- Write SKILL.md
- Extract testable claims
- Write validation tests
- Add to CI
- Add to agent skills
- Create shortcuts (slash commands)
- Monitor usage
Track usage to find gaps:
# Log queries
telemetry = {
"timestamp": time.time(),
"question": question[:100],
"question_type": categorize(question), # upgrade, perf, debug
"confidence": "HIGH|MEDIUM|LOW",
"sources_used": len(sources),
"duration_ms": duration
}Analyze:
# Most common questions
cat telemetry.jsonl | jq -r '.question_type' | sort | uniq -c
# Knowledge gaps (low confidence)
cat telemetry.jsonl | jq 'select(.confidence == "LOW")'| Metric | Before | After |
|---|---|---|
| Time to answer | Hours | Seconds |
| Expert bottleneck | 1 person | Zero |
| Knowledge drift | Undetected | CI catches |
| New hire onboarding | Slow | Fast |
Knowledge drift: Domain evolves, docs don't. → Fix: Weekly CI validation, check against external sources
Over-generalization: Generic advice, not specific to your codebase. → Fix: Use real file paths, actual code from your repo
AI hallucination: Invents answers beyond knowledge base. → Fix: Explicit boundaries in USAGE-FOR-AI.md, require source citation
# In database-expert/SKILL.md
## Related Experts
- **cache-expert** - Cache invalidation
- **security-expert** - SQL injection prevention
When query involves caching → consult cache-expertdocs/k8s-expert/
├── v1.28/
├── v1.29/
└── VERSION-MAP.md # Which version to use
**Response (Confidence: HIGH - tested in prod):**
Yes, feature X is ready.
Source: tests/production/test_x.pyStart with: Domain where team asks most repeat questions.
High-value domains:
sdk-expert- Third-party SDK integrationskubernetes-expert- K8s deployment, debuggingdatabase-expert- Query optimization, schemasecurity-expert- OWASP Top 10, complianceperformance-expert- Profiling, optimization
- Pick domain with most repeat questions
- Interview expert, extract knowledge
- Create structure (docs/, .ambient/skills/, tests/)
- Write first guide (USAGE.md)
- Distill to SKILL.md
- Add 3-5 validation tests
- Add to CI
- Deploy (submodule/MCP/package)
- Monitor telemetry
- Iterate based on usage
- Democratize knowledge - Juniors access senior expertise
- 24/7 availability - No human bottleneck
- Consistency - Same answer every time
- Scalability - Unlimited concurrent users
- AI capability - Agents gain domain depth
- Preservation - Survives employee turnover
- Validation - Tests catch knowledge drift