From legalcode-pro-claude-code
Run a comprehensive quality assurance audit on any legal document — contract, agreement, deed, policy, or court filing — to detect drafting errors before execution or filing. Covers nine QA dimensions: defined term audits (undefined, orphaned, duplicate, and miscapitalized terms); cross-reference integrity (stale section numbers, broken references); party name consistency (synonym drift, signature block mismatches); date and deadline logic (effective date ambiguity, impossible dates, notice period arithmetic); numbering and hierarchy (skipped items, inconsistent hierarchy, non-parallel structure); gender and pronoun consistency (mixed gendered pronouns, orphaned antecedents); formatting and layout (tracked changes, residual comments, font inconsistency, page numbering); signature block validation (missing titles, undated lines, entity name mismatches); and substance completeness gaps (missing essential provisions, undefined relative standards). Generates a prioritized correction report with exact proposed corrections. Use when proofreading a contract before execution, auditing a template for quality, reviewing a redlined draft, or preparing a document for filing. Works on any document type and any jurisdiction.
How this skill is triggered — by the user, by Claude, or both
Slash command
/legalcode-pro-claude-code:legalcode-document-qaclaude-opus-4-6general-purposeThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use Legalcode MCP for source lookup while keeping documents and matter context in the user's agent environment.
Use Legalcode MCP for source lookup while keeping documents and matter context in the user's agent environment.
https://mcp.legalcode.md for anonymous laws and case law.https://mcppro.legalcode.md for stronger search, up to 20 results per query, guidance, agreements, downloads, and authenticated higher-throughput access.Disclaimer: This skill provides a framework for AI-assisted document quality assurance. It does not constitute legal advice. All outputs should be reviewed by a qualified legal professional before use. This skill checks for drafting and formatting errors — it does not review substantive legal risk, negotiation positions, or the commercial adequacy of terms. Statutory and case law references cited from memory carry hallucination risk — verify against authoritative sources before relying on them.
This skill runs a systematic quality assurance audit on a legal document across nine dimensions of drafting and formatting quality. It identifies errors, classifies them by severity, generates exact proposed corrections, and produces a prioritized correction report ready to implement.
Covers:
Does not:
legalcode-contract-review for that analysis)This skill is jurisdiction-agnostic. Document QA checks — defined term consistency, cross-reference accuracy, formatting standards — apply regardless of governing law.
[JURISDICTION-SPECIFIC] When the document is governed by a specific jurisdiction, note:
This skill uses interactive clarification at key decision points. The workflow pauses and asks when:
Use the ask-user-question pattern wherever marked with ⟁ CLARIFY below. If the user has already provided the information, skip the question and proceed.
Accept the document in any of these formats:
If no document is provided, prompt the user to supply one.
⟁ CLARIFY — Before beginning the audit, ask the user these questions. Skip any already answered in the initial prompt:
Document type: What kind of legal document is this?
Stage in the drafting process: Where is this document in the workflow?
Scope: Should this be a full nine-dimension audit or a targeted check?
Known issues: Are there any known problem areas to prioritize?
Proceed with reasonable defaults if the user provides partial context.
Before running QA checks, map the document:
⟁ CLARIFY — If the document references external documents by incorporation ("as defined in the Master Agreement," "subject to the Schedules listed at Annex A"), ask whether those incorporated documents are available for cross-check, or whether the audit should proceed on the main document only.
Execute all applicable dimensions in order. For each dimension, produce a findings list using the format specified in the Correction Entry Format section.
What to check:
| Check | Description | Default Severity |
|---|---|---|
| UNDEF | Capitalized term used in the operative provisions but not defined anywhere | CRITICAL |
| ORPHAN | Term defined but never used in the operative provisions | MEDIUM |
| DUPLICATE | Same term defined in more than one location with potentially different scope | HIGH |
| MISCAP | A defined term appears in lower case (or inconsistent case) in at least one location | HIGH |
| SYNONYM | Two or more different terms appear to mean the same thing (e.g., "Purchaser" and "Buyer" for the same party) | HIGH |
| CIRCULAR | A defined term's definition relies on another term that directly or indirectly relies on it | HIGH |
| NEVER-NEEDED | A term is defined with extensive qualification but could have been left as plain English | LOW |
How to check:
⟁ CLARIFY — When a capitalized term appears without a definition but could plausibly be a deliberate use of a common-English capitalized word (e.g., "Party," "Law," "Person"), ask the user whether this is intentional before classifying as UNDEF.
What to check:
| Check | Description | Default Severity |
|---|---|---|
| MISSING-TARGET | Cross-reference points to a section, clause, exhibit, or schedule that does not exist in the document | CRITICAL |
| WRONG-NUMBER | Cross-reference appears to point to a real section but the number is wrong (e.g., "Section 4.2" exists but the reference should be "Section 4.3" based on context) | HIGH |
| SUBJECT-MISMATCH | The referenced section does not cover the subject matter stated in the cross-reference ("as defined in Section 2.1" but Section 2.1 doesn't define that term) | HIGH |
| MISSING-HEADING | Cross-reference uses a section number only, without the heading name — making errors invisible | LOW |
| STALE-AFTER-DELETION | The referenced section was deleted in a prior draft and no longer exists | CRITICAL |
How to check:
What to check:
| Check | Description | Default Severity |
|---|---|---|
| INTRO-BODY-MISMATCH | A party's defined term in the Introduction differs from the term used in the body | CRITICAL |
| SYNONYM-DRIFT | A party is referred to by different terms in different parts of the document (e.g., "Buyer" in clauses 1–5, "Purchaser" in clauses 6–12) | HIGH |
| SIG-BLOCK-MISMATCH | The entity name in the signature block differs from the entity name in the Introduction or Parties clause | CRITICAL |
| FULL-NAME-USAGE | Party's full legal name is used in body clauses instead of the defined short-form term | MEDIUM |
| PRECEDENT-BLEED | A party name from a prior contract has been left in the document (copy-paste error) | CRITICAL |
| WRONG-PARTY | An obligation or right is attributed to the wrong party | HIGH |
How to check:
What to check:
| Check | Description | Default Severity |
|---|---|---|
| NO-EFFECTIVE-DATE | Document does not explicitly state an effective date (relying only on execution date) | HIGH |
| DATE-ARITHMETIC | A deadline calculated from the effective date or execution date does not match the stated date (e.g., "30 days from the Effective Date" but the stated deadline is wrong) | HIGH |
| IMPOSSIBLE-DATE | A date that cannot exist (February 29 in a non-leap year, day-of-week mismatch, dates before 1900) | CRITICAL |
| DATE-INCONSISTENCY | The same event has different dates in different parts of the document | CRITICAL |
| RETROACTIVE-AMBIGUITY | Effective date is earlier than the execution date with no provision addressing the retroactive period's obligations | MEDIUM |
| NOTICE-ARITHMETIC | Notice period stated in one clause is inconsistent with the termination/renewal logic in another clause | HIGH |
| FORMAT-INCONSISTENCY | Dates use different formats in different places (e.g., "March 15, 2025" in one clause and "15/03/2025" in another) | LOW |
How to check:
What to check:
| Check | Description | Default Severity |
|---|---|---|
| SKIPPED-NUMBER | A list or section sequence skips a number (e.g., items 1, 2, 4, 5 — 3 is missing) | MEDIUM |
| DUPLICATE-NUMBER | Two different items share the same number | HIGH |
| HIERARCHY-INCONSISTENCY | Heading levels are applied inconsistently (e.g., some third-level headings use bold, others use indented plain text) | MEDIUM |
| NON-PARALLEL-STRUCTURE | Items in the same list use inconsistent grammatical structure | MEDIUM |
| NUMERAL-WORD-INCONSISTENCY | Numbers are sometimes spelled out ("fifteen") and sometimes in numerals ("15") for the same category | LOW |
| ORDINAL-INCONSISTENCY | Ordinals switch between "1st" and "first" form | LOW |
| POST-EDIT-DRIFT | Numbering was not updated after a section was moved, added, or deleted | HIGH |
How to check:
What to check:
| Check | Description | Default Severity |
|---|---|---|
| MIXED-GENDERED | Document uses "he" in some clauses and "she" or "they" in others for the same role | HIGH |
| GENDERED-FOR-ENTITY | A corporate entity is referred to as "he" or "she" instead of "it" | MEDIUM |
| ORPHANED-PRONOUN | A pronoun ("it," "they," "he," "she") appears without a clear antecedent — ambiguous referent | HIGH |
| RESIDUAL-GENDERED | Gendered pronouns remain from a precedent document that were intended to be replaced | MEDIUM |
| INCONSISTENT-APPROACH | Document adopts different gender-neutrality techniques in different clauses (e.g., role-based terms in Section 1, singular "they" in Section 2, noun repetition in Section 3) | LOW |
How to check:
What to check:
| Check | Description | Default Severity |
|---|---|---|
| TRACKED-CHANGES | Document contains accepted or unaccepted tracked changes in the final version | HIGH |
| RESIDUAL-COMMENTS | Document contains comment bubbles or review annotations | HIGH |
| PLACEHOLDER-TEXT | Document contains "[INSERT]", "TBD," "DRAFT," or similar placeholder text | CRITICAL |
| FONT-INCONSISTENCY | Body text uses inconsistent fonts, sizes, or weights | MEDIUM |
| SPACING-INCONSISTENCY | Line spacing or paragraph spacing is inconsistent within sections | LOW |
| PAGE-NUMBERING | Page numbers are missing, restarted mid-document, or formatted inconsistently | MEDIUM |
| HIDDEN-METADATA | Prior party names, author information, or document history carried in metadata | MEDIUM |
| BLANK-FIELDS | Date lines, party address blocks, or other fill-in fields are left blank | HIGH |
| WRONG-DOCUMENT-TITLE | Document title or header carries the name of a prior document | HIGH |
How to check:
What to check:
| Check | Description | Default Severity |
|---|---|---|
| MISSING-DATE-LINE | A party's signature block does not include a date line | HIGH |
| MISSING-TITLE | A corporate signatory's signature block does not include a title line | HIGH |
| ENTITY-MISMATCH | The entity name in the signature block differs from the entity name in the Introduction | CRITICAL |
| MISSING-WITNESS | A signature block that requires a witness (deed, statutory form) has no witness block | CRITICAL |
| MISSING-NOTARY | A signature block that requires notarization has no notarial certificate block | CRITICAL |
| COUNTERPARTS-MISSING | A multi-party document has no counterparts clause permitting separate execution | MEDIUM |
| WRONG-PARTY-COUNT | Fewer signature blocks than contracting parties, or additional signature blocks for non-parties | HIGH |
| AUTHORITY-RECITAL | No "duly authorized" or equivalent authority recital for corporate signatories | MEDIUM |
How to check:
⟁ CLARIFY — Whether witnesses or notarization are required depends on the jurisdiction and document type. If unclear, ask the user before classifying these as CRITICAL, since the requirement varies: deeds in England & Wales require witnesses; mortgages in many US states require notarization; corporate resolutions require board authorization recitals. Flag the check as [JURISDICTION-SPECIFIC] if the user cannot confirm.
This dimension checks only for the presence or absence of fundamental provisions — not their substantive quality (which is the domain of contract review skills).
What to check:
| Check | Description | Default Severity |
|---|---|---|
| NO-PARTIES | Document does not identify the contracting parties | CRITICAL |
| NO-GOVERNING-LAW | Document has no governing law or jurisdiction clause | HIGH |
| NO-TERM | Document has no stated term, commencement date, or duration | HIGH |
| NO-DISPUTE-RESOLUTION | Document has no dispute resolution mechanism | HIGH |
| UNDEFINED-STANDARD | Document uses undefined relative standards ("promptly," "reasonable efforts," "materially") without qualification or context | MEDIUM |
| AMBIGUOUS-OBLIGATION | An operative clause cannot be determined to impose an obligation ("shall") or grant discretion ("may") from its language | HIGH |
| INCOMPLETE-PROVISION | A provision appears incomplete — stops mid-sentence, references a section not yet drafted | CRITICAL |
How to check:
⟁ CLARIFY — For documents where some of these elements are intentionally absent (e.g., side letters, amendments that incorporate the main agreement by reference), confirm with the user before flagging as gaps.
For every finding, assign a severity level from the Issue Severity Classification section below. Then apply the Prioritization Framework to rank all findings.
⟁ CLARIFY — For any borderline CRITICAL/HIGH classification where the severity depends on business context not visible in the document, present both classifications and ask:
For each finding, generate a complete correction entry using the Correction Entry Format below. Organize findings by:
Before delivering the correction report, run these checks:
Deliver the output using the Output Format Template below.
⟁ CLARIFY — For large documents with many findings, ask the user whether to:
Errors that create legal ambiguity, could void or misapply provisions, or will cause material problems at execution or in dispute resolution.
Examples:
Action: Provide an exact proposed correction. Do not deliver the document without resolving CRITICAL items.
Errors that materially affect the document's quality, create interpretive risk, or are likely to be challenged by a counterparty or court.
Examples:
Action: Provide an exact proposed correction and flag for review before execution.
Errors that reduce document quality and may create minor interpretive issues, but do not create immediate legal risk.
Examples:
Action: Provide a proposed correction and a brief note on why the fix improves the document.
Minor editorial or stylistic inconsistencies that do not affect legal meaning.
Examples:
Action: Note the issue and the preferred consistent approach. Implement during the next revision cycle.
For every finding, provide a complete correction entry:
**Finding**: [CRITICAL / HIGH / MEDIUM / LOW] — [Dimension] — [Check Code]
**Location**: [Section/Clause reference, page number if available, or quoted text]
**Description**: [One sentence explaining the error and its potential legal impact]
**Current text**: "[Exact quoted text from the document showing the error]"
**Proposed correction**: "[Exact replacement text, ready to insert]"
**Confidence**: [Definite / High / Probable / Possible — see Confidence Scoring]
When presenting findings, organize by these tiers:
Issues that must be resolved before the document is used for any purpose. A document with unresolved CRITICAL items should not be executed, filed, or delivered.
Instruction: Resolve all Tier 1 items before circulating the document further.
Issues that materially affect quality and should be resolved before the document is executed or formally delivered, but do not necessarily require halting progress.
Instruction: Assign to the responsible drafter with a target resolution date that falls before the execution deadline.
Issues that improve document quality but can be addressed in the next revision cycle, at a dedicated template cleanup session, or over time.
Instruction: Log these findings in the document management system. Resolve during the next scheduled revision rather than holding up execution.
Run these 5 gates silently before delivering any output. Revise before delivering if any gate fails.
| Gate | Rule | Fail Action |
|---|---|---|
| Source | Every classification as CRITICAL is based on an identifiable error in the document, not speculation | Add specific location reference or downgrade to HIGH |
| Format | Every proposed correction is in exact, ready-to-insert form | Provide specific language rather than vague guidance |
| Currency | Every check for jurisdiction-specific requirements is marked [JURISDICTION-SPECIFIC] when not universally applicable | Add marker and clarifying note |
| Domain | Analysis stays within the document QA scope — do not venture into substantive legal risk analysis | Remove or mark [OUT OF SCOPE FOR QA] |
| Confidence | Uncertainty explicitly stated — do not classify an error as CRITICAL if the intent is ambiguous | Add confidence qualifier or downgrade severity |
For any item classified as CRITICAL, apply this 2-pass review before delivering:
Pass 1 — Error Verification: Is the error actually present in the document? Could the apparent error be intentional (e.g., a term left undefined because it has a plain English meaning, a deliberate retroactive effective date)?
Pass 2 — Correction Completeness: Is the proposed correction specific and ready to implement? Does it resolve the full scope of the error, or only the most obvious manifestation?
If either pass reveals a weakness, revise the finding before delivery.
| Level | Range | Meaning | Action |
|---|---|---|---|
| Definite | 0.95-1.0 | Error is unambiguous and verifiable from the text alone | State with confidence |
| High | 0.80-0.94 | Strong evidence of an error, minor ambiguity possible | State with brief caveat |
| Probable | 0.60-0.79 | Likely an error, but could be intentional | Flag with note: "[Verify intent with drafter]" |
| Possible | 0.40-0.59 | Possible error, genuinely uncertain | Flag for human review rather than correcting |
| Unlikely | 0.0-0.39 | Weak basis — may not be an error | Do not flag as an error; note as an observation |
Every QA audit MUST include a Glass Box audit section:
glass_box:
skill_name: "legalcode-document-qa"
document: "[Document title and date]"
document_type: "[Contract / Deed / Policy / Court Filing / etc.]"
document_stage: "[Draft / Near-final / Final / Template]"
dimensions_audited:
- "Defined Term Audit"
- "Cross-Reference Integrity"
- "Party Name Consistency"
- "Date and Deadline Logic"
- "Numbering and Hierarchy"
- "Gender and Pronoun Consistency"
- "Formatting and Layout"
- "Signature Block Validation"
- "Substance Completeness Gaps"
findings_summary:
critical: "[N]"
high: "[N]"
medium: "[N]"
low: "[N]"
total: "[N]"
legalcode_mcp: "Connected / Not connected"
self_interrogation: "PASS / REVISED / NOT APPLICABLE (no CRITICAL items)"
confidence: "HIGH / MEDIUM / LOW — [rationale]"
limitations:
- "[Any scope limitations — e.g., 'Incorporated documents not reviewed', 'Metadata not accessible']"
- "[Any jurisdiction-specific checks deferred — e.g., 'Witness requirement not confirmed for jurisdiction']"
reviewer: "AI-assisted — requires qualified legal review before execution"
Explicit catalogue of what NOT to do when running a document QA audit:
Flagging intentional capitalization as undefined terms — Not every capitalized word is a defined term. "Government," "Law," "Person," and "Agreement" are commonly capitalized without a definition because they have accepted plain-English meanings. Check whether a capitalized word is being used as a technical defined term before classifying it as UNDEF.
Correcting substance under the guise of QA — The scope of this skill is drafting and formatting errors. Identifying a liability cap as "too low" or an indemnification clause as "too broad" is substantive legal analysis, not document QA. Stay in scope.
Generating vague proposed corrections — "Update the cross-reference" is not a correction. A correction must state the exact replacement text: "Replace 'Section 4.2' with 'Section 4.3 (Payment Terms)'." The correction must be ready to insert.
Missing the holistic defined-term picture — Auditing defined terms one by one without building a complete register first. The most important checks — synonym drift, duplicate definitions, and orphaned definitions — are only visible when you hold the full picture of every defined term in the document simultaneously.
Classifying all missing elements as CRITICAL — The absence of a governing law clause in a near-final commercial agreement is HIGH. The same absence in a side letter to an agreement that already specifies governing law may be intentional and fine. Context matters; apply the severity classification thoughtfully.
Skipping Dimension 7 (Formatting) because it seems trivial — Tracked changes and residual comment bubbles in an "executed" version of a contract have caused significant litigation. The document parties execute must be clean. Tracked changes are HIGH, not LOW.
Running QA without a section map — Validating cross-references by searching for the referenced section number without first building a complete list of all sections in the document will miss cases where both the reference and the target are wrong. Build the section map first.
Ignoring incorporated documents — Many contracts incorporate schedules, exhibits, annexes, or external agreements by reference. A cross-reference may be technically correct in the main agreement but point to a section in an attached schedule that has been deleted. Ask whether incorporated documents are available.
Correcting pronoun consistency by always choosing one approach — There are multiple valid approaches to gender-neutral drafting (role-based terms, singular "they," noun repetition). The goal is consistency within the document, not imposing a particular style. Flag inconsistency; do not override a deliberate drafting choice.
Flagging "DRAFT" as CRITICAL when the document is, in fact, a draft — Placeholder text and "DRAFT" watermarks are appropriate in working documents. The stage-context from Step 2 determines whether a placeholder is CRITICAL (near-final document), HIGH (clean draft being shared externally), or acceptable (internal working version).
Validating dates without checking the calendar — Stating "February 30 is an invalid date" is obvious. The subtler checks — February 29 in non-leap years (e.g., 2025), day-of-week mismatches (e.g., "Wednesday, March 15, 2025" when March 15, 2025 was a Saturday), and notice period arithmetic — require actually calculating against a calendar. Do the math.
Delivering corrections without locations — A correction without a location reference ("Clause 4.2, second sentence") cannot be implemented. Every correction entry must include the exact location so the drafter can find it in seconds.
Treating party name consistency as a low-priority check — Party name inconsistency ("Buyer" / "Purchaser") is a documented source of contract disputes. Courts have held that inconsistent use of party name terms can create ambiguity about which party an obligation was intended to bind. Classify synonym drift as HIGH, not MEDIUM.
Single-dimension analysis — Running only the defined terms check because that is what the user asked about, then overlooking a signature block mismatch or a CRITICAL broken cross-reference. Unless the user explicitly requests a targeted check, run all nine dimensions. The most dangerous errors are often not in the dimension the user suspected.
Confusing substantive gaps with QA gaps — A missing limitation of liability clause
is a substantive risk issue (→ legalcode-contract-review). A missing governing law
clause in a document type that always requires one is a completeness gap (→ this
skill). The distinction is: QA gaps are about whether the document is correctly
assembled; substantive gaps are about whether the terms protect the client.
Apply plain-language discipline to all output:
For correction descriptions (may be shared with the drafting team):
For proposed corrections:
Quality gates before delivery:
With legalcode-mcp connected (preferred):
Without legalcode-mcp:
legalcode_mcp: "Not connected"The nine QA dimensions are largely universal, but several jurisdiction-specific overlays apply:
Signature block requirements:
Language requirements:
Date format conventions:
Structure the final deliverable as:
## Document QA Report
**Document**: [Document title / identifier]
**Document Type**: [Contract / Deed / Policy / Filing / etc.]
**Document Stage**: [Draft / Near-final / Final / Template]
**Audit Date**: [date]
**Dimensions Audited**: [List of dimensions audited]
---
## Executive Summary
| Severity | Count |
|----------|-------|
| CRITICAL | [N] |
| HIGH | [N] |
| MEDIUM | [N] |
| LOW | [N] |
| **Total** | **[N]** |
**Assessment**: [1-2 sentence assessment of the document's overall QA status, e.g.,
"This document has 2 CRITICAL issues that must be resolved before execution: an undefined
capitalized term in the payment clause and a broken cross-reference in the termination
clause. Once resolved, the document is otherwise in good shape with 4 HIGH items and 6
MEDIUM items that should be addressed before signing."]
**Recommendation**: [HOLD — resolve CRITICAL issues first / PROCEED WITH CAUTION — HIGH
items should be resolved / CLEAR FOR EXECUTION — only MEDIUM/LOW items remain]
---
## Tier 1 — Pre-Execution Blockers (CRITICAL)
[List each CRITICAL finding using the Correction Entry Format]
---
## Tier 2 — Pre-Execution Preferred (HIGH)
[List each HIGH finding using the Correction Entry Format]
---
## Tier 3 — Revision Cycle Items (MEDIUM and LOW)
[List each MEDIUM/LOW finding using the Correction Entry Format]
---
## Dimensions Audited — Summary by Category
| Dimension | Status | Findings |
|-----------|--------|----------|
| 1. Defined Term Audit | PASS / ISSUES | [N] findings |
| 2. Cross-Reference Integrity | PASS / ISSUES | [N] findings |
| 3. Party Name Consistency | PASS / ISSUES | [N] findings |
| 4. Date and Deadline Logic | PASS / ISSUES | [N] findings |
| 5. Numbering and Hierarchy | PASS / ISSUES | [N] findings |
| 6. Gender and Pronoun Consistency | PASS / ISSUES | [N] findings |
| 7. Formatting and Layout | PASS / ISSUES | [N] findings |
| 8. Signature Block Validation | PASS / ISSUES | [N] findings |
| 9. Substance Completeness Gaps | PASS / ISSUES | [N] findings |
---
[Glass Box Audit Trail — YAML as specified above]
Created by Legalcode (2026-03-21). Original synthesis drawing on:
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub roberthh-is/legalcode-plugin --plugin legalcode-pro-claude-code