.claude/skills/test-draft-pipeline/SKILL.md
# SKILL: test-draft-pipeline ## Purpose Run the drafting pipeline, evaluate output quality, and verify all 4 gates + review work correctly. ## When to Use - After modifying any pipeline node, gate, or prompt - After creating or updating an exemplar or LKB entry - For regression testing across multiple scenarios - For debugging pipeline failures ## Test Runners ### Quick Test (single scenario) ```bash agent_steer/Scripts/python.exe research/run_draft_live.py ``` ### Unit Tests ```bash agent_
npx skillsauth add itmegirish/boardingmcp-server .claude/skills/test-draft-pipelineInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Run the drafting pipeline, evaluate output quality, and verify all 4 gates + review work correctly.
agent_steer/Scripts/python.exe research/run_draft_live.py
agent_steer/Scripts/python.exe -m pytest tests/drafting/ -v
agent_steer/Scripts/python.exe research/run_review_benchmark.py
agent_steer/Scripts/python.exe research/run_v5_compare.py
[INTAKE+CLASSIFY] -> doc_type, law_domain, cause_type, facts extracted, parties
[RAG] -> query terms, chunks retrieved, dedup count
[ENRICHMENT] -> limitation article, verified_provisions count, LKB hit/miss
[LKB] -> hit/miss/alias resolution, conditional field resolution
[DRAFT] -> model used, prompt size, output chars, placeholders found
[EVIDENCE_ANCHORING] -> entities found, anchored, replaced with placeholder
[LKB_COMPLIANCE] -> primary acts check, superseded law replacements
[POSTPROCESS] -> formatting fixes applied
[CITATION_VALIDATOR] -> provisions verified, flagged, case citations found
[REVIEW] -> skipped? cycle count, blocking_issues, inline fix, token usage
| # | Check | What to verify |
|---|---|---|
| 1 | Court heading present | Court name + place |
| 2 | Title present | Document type stated |
| 3 | Parties section | Primary + opposite party |
| 4 | Jurisdiction section | Territorial + pecuniary + subject matter |
| 5 | Facts section | Numbered paragraphs, chronological |
| 6 | Legal basis section | At least one statutory provision |
| 7 | Prayer section | Specific relief(s) requested |
| 8 | Verification clause | Order VI Rule 15 for CPC |
| 9 | Continuous numbering | Paragraphs numbered sequentially |
| 10 | No fabricated citations | Zero AIR/SCC/ILR unless user-provided |
| 11 | Proper placeholders | {{NAME}} format for unknowns |
| 12 | Evidence referenced | Annexure labels used |
| 13 | Formal language | Court-ready register |
| # | Check | What to verify | |---|---|---| | 14 | LKB resolved | cause_type matched (direct or via alias) | | 15 | Primary acts cited | LKB primary_acts appear in draft | | 16 | Limitation correct | Matches LKB (or NONE when appropriate) | | 17 | No superseded acts | IPC/CrPC/Evidence Act replaced with BNS/BNSS/BSA | | 18 | Citation validator clean | No unverified provisions flagged | | 19 | Evidence anchoring clean | No unsupported tokens remain | | 20 | Review routing correct | Legal vs formatting severity handled properly |
When a draft scores below target:
[INTAKE+CLASSIFY] log[LKB] miss in logs. Check aliases[ENRICHMENT] logresolve_entry flatten conditionals? Check [LKB] conditional_build_lkb_brief_context[RAG] query terms[REVIEW] blocking_issues| Symptom | Cause | Fix |
|---------|-------|-----|
| 35 placeholders | LKB miss -> no acts/limitation fed to draft | Add alias in lkb/__init__.py or fix cause_type in intake prompt |
| Wrong limitation article | Conditional field not resolved | Check resolve_entry + _INFERENCE_MAP keywords |
| Hallucinated section content | LLM uses training memory not RAG | Check anti-hallucination instruction in LKB brief builder |
| Review too slow | Too many tokens sent | Already fixed — slim payload (~3.5K tokens) |
| Citation flagged incorrectly | Provision not in verified_provisions | Check enrichment RAG scan + user_cited_provisions |
| Wrong model used | Settings override in .env | Check OLLAMA_DRAFT_MODEL / OLLAMA_REVIEW_MODEL |
| Superseded act in draft | LKB compliance gate missed | Check superseded law patterns in lkb_compliance.py |
| Test | Input | Verify | Fail if |
|------|-------|--------|---------|
| Date hallucination | No dates provided | All dates {{PLACEHOLDER}} | Concrete date fabricated |
| Amount hallucination | Only principal amount | Principal matches exactly | Unrelated amount in draft |
| Citation hallucination | No case law request | Zero AIR/SCC/ILR | Case citation in draft |
| Name hallucination | No specific names | All names {{PLACEHOLDER}} | Invented name in draft |
| Statute hallucination | Check cited provisions | In verified_provisions | Unverified citation not flagged |
After ANY change, run scenarios covering:
Check:
development
# SKILL: v9-architecture Use when: planning, building, or reviewing v11.0 architecture components (LKB 2-layer model, document schemas, structured prompt builder, gates, family migrations). ## v11.0 Architecture — Scalable Context-Driven Pipeline ### Core Principles 1. **Better context to LLM = better draft** — no complex engine needed 2. **Separate law from structure** — cause type (92) × document type (12) = 1,104 combinations 3. **Decide law before drafting, enforce law after drafting** #
development
# SKILL: exemplar-builder ## Purpose Create, validate, and maintain document schemas and LKB Layer 2 data for the v11.0 scalable drafting pipeline. **v11.0 approach:** No exemplar documents in prompts. Instead: LKB 2-layer data + document schema → structured prompt → LLM drafts. ## When to Use - Creating a new document schema (e.g., written_statement, appeal_memo) - Enriching LKB entries with Layer 2 data (available_reliefs, jurisdiction_basis) - Reviewing schema quality against CPC rules - A
development
# SKILL: section-validator ## Purpose Build and maintain the 4 deterministic verification gates (Stage 3). Gates run on the full draft text with zero LLM calls. They validate, auto-fix formatting, and flag issues for review. ## When to Use - Building or modifying any gate - Adding new entity extraction patterns - Debugging false positives / false negatives - Extending verified provisions coverage ## Architecture Context (v5.1 — what's running) 4 gates run sequentially on `draft.draft_artifac
development
# SKILL: draft-prompt ## Purpose Build and refine the draft prompt that produces a complete court-ready legal document in a single LLM call. v5.1 uses free-text drafting — the LLM outputs the entire document (not section-keyed JSON, not gap-fill). Exemplar-guided, LKB-informed. ## When to Use - Building or modifying `prompts/draft_prompt.py` - Debugging why draft quality is low - Tuning exemplars or context injection - Adapting prompt for a new cause type - Optimizing prompt token count ## Ar