.claude/skills/prompt-builder/SKILL.md
# SKILL: prompt-builder Use when: building, reviewing, or debugging the structured prompt that combines LKB + document schema for the draft LLM. ## What Is the Prompt Builder The prompt builder is the core of v11.0. It replaces the 400-line `_build_lkb_brief_context()` flat dump with a ~100-line structured prompt builder that combines: 1. **Document schema** → section order + per-section instructions 2. **LKB Layer 1** → legal knowledge (statutes, limitation, facts guidance) 3. **LKB Layer 2
npx skillsauth add itmegirish/boardingmcp-server .claude/skills/prompt-builderInstall 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.
Use when: building, reviewing, or debugging the structured prompt that combines LKB + document schema for the draft LLM.
The prompt builder is the core of v11.0. It replaces the 400-line _build_lkb_brief_context() flat dump with a ~100-line structured prompt builder that combines:
Into ONE structured prompt with clear hierarchy (~1,500 tokens).
═══ DOCUMENT STRUCTURE (follow this section order exactly) ═══
Document type: Written Statement
Filed by: Defendant
Annexure prefix: D-
Sections (in this order):
1. COURT HEADING — Court name and place
2. PRELIMINARY OBJECTIONS — Limitation, jurisdiction, non-joinder
3. PARA-WISE REPLY — Reply to EVERY plaint paragraph: ADMITTED/DENIED/NOT ADMITTED
4. ADDITIONAL FACTS — New facts in defence
5. PRAYER — Dismiss suit with costs
6. VERIFICATION — Verification on oath
═══ LEGAL DATA (cite ONLY from this) ═══
Cause: Suit for Damages for Breach of Contract
Statutes to cite:
- Indian Contract Act, 1872: Section 73
- Code of Civil Procedure, 1908: Section 20
Limitation: Article 55 — Three years from date of breach
Reliefs:
- Decree for damages of Rs.{{AMOUNT}} (S.73 ICA)
- Interest at {{RATE}}% per annum (S.34 CPC)
- Pendente lite and future interest (Order XX Rule 11 CPC)
- Costs of the suit (S.35 CPC)
═══ FACTS GUIDANCE ═══
MUST COVER:
- Date and terms of contract
- Consideration paid/exchanged
- Specific breach
- Loss with quantification
- Mitigation efforts
DO NOT:
- Cite Section/Act numbers in FACTS section
- Use "on or about" for dates
- Mix S.73 and S.74 ICA
═══ CLIENT FACTS ═══
[user's actual request/facts from intake]
═══ UNIVERSAL RULES ═══
1. Cite ONLY from the statutes listed above
2. Do NOT include case law citations — use {{CASE_LAW_NEEDED: [topic]}}
3. Every document reference must use annexure label (D-1, D-2...)
4. Verification must distinguish personal knowledge from information
| Current (_build_lkb_brief_context) | New (structured prompt) |
|--------------------------------------|------------------------|
| 400 lines, 13 categories | 100 lines, 4 sections |
| Flat text, no hierarchy | Clear hierarchy with separators |
| All instructions at equal priority | Structure > Law > Facts > Rules |
| ~3,000 tokens | ~1,500 tokens |
| Same for all document types | Adapts per document type |
| Prayer as prose instructions | Prayer as exact text with statutes |
| LLM decides structure | Schema enforces structure |
def build_draft_prompt(lkb_entry, doc_schema, user_facts, decision_ir=None):
"""Build structured prompt from LKB + schema.
~100 lines. Replaces _build_lkb_brief_context() (400 lines).
"""
parts = []
# Section 1: Document structure (from schema)
parts.append("═══ DOCUMENT STRUCTURE (follow this section order exactly) ═══")
parts.append(f"Document type: {doc_schema['display_name']}")
parts.append(f"Filed by: {doc_schema['filed_by']}")
parts.append(f"Annexure prefix: {doc_schema['annexure_prefix']}")
parts.append("\nSections (in this order):")
for i, section in enumerate(doc_schema['sections'], 1):
parts.append(f" {i}. {section['key'].upper()} — {section['instruction']}")
# Section 2: Legal data (from LKB Layer 1 + 2)
parts.append("\n═══ LEGAL DATA (cite ONLY from this) ═══")
parts.append(f"Cause: {lkb_entry['display_name']}")
parts.append(format_acts(lkb_entry['primary_acts']))
parts.append(format_limitation(lkb_entry['limitation']))
parts.append(format_reliefs(lkb_entry.get('available_reliefs', [])))
# Section 3: Facts guidance (from LKB Layer 1)
parts.append("\n═══ FACTS GUIDANCE ═══")
if lkb_entry.get('facts_must_cover'):
parts.append("MUST COVER:")
for f in lkb_entry['facts_must_cover']:
parts.append(f" - {f}")
if lkb_entry.get('drafting_red_flags'):
parts.append("DO NOT:")
for r in lkb_entry['drafting_red_flags']:
parts.append(f" - {r}")
# Section 4: Client facts
parts.append(f"\n═══ CLIENT FACTS ═══\n{user_facts}")
return "\n".join(parts)
app/agents/drafting_agents/nodes/draft_single_call.py → _build_lkb_brief_context() (lines 176-400)app/agents/drafting_agents/prompts/draft_prompt.py → build_draft_prompt() (~100 lines)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: 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_
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