coquill-analyzer
Skill63 starsChanged 6 months agoApache-2.0View on GitHub
Template analyzer for CoQuill (v2). Parses docx/HTML templates, extracts variables including conditionals and loops, merges config.yaml overrides, infers types, and generates a v2 manifest.yaml. Called by the coquill orchestrator — not triggered directly by the user.
In this repository49 other files it gives its agents.
- action-items-from-client-alertSkill
- adversarial-qcSkill
- ai-act-quickSkill
- bart-statutory-reference-checkerSkill
- building-chronologiesSkill
- california-property-taxSkill
- case-file-analyzerSkill
- ClassifyCCPSkill
- collating-reviewer-feedbackSkill
- comms-improverSkill
- contract-qaSkill
- coquill-rendererSkill
- coquillSkill
- coquill-transcriberSkill
- corporate-registry-investigationSkill
- customs-trade-lawSkill
- dpa-art28Skill
- dpa-checklist-reviewSkill
- enhance-promptSkill
- foreign-law-researchSkill
- legal-claim-economicsSkill
- legal-translationSkill
- license-complySkill
- local-first-legal-workspaceSkill
- lq-board-document-reviewSkill
- lq-governance-playbook-benchmarkSkill
- msa-review-commercial-purchaseSkill
- msa-review-saasSkill
- nda-reviewSkill
- nis2-navigatorSkill
- nist-ai-rmfSkill
- office-word-diffSkill
- privacy-notice-euSkill
- proposition-checkingSkill
- redfern-scheduleSkill
- redlinesSkill
- sgciteSkill
- skill-creatorSkill
- statutory-analysisSkill
- superdoc-redlinesSkill
- text-provenanceSkill
- uk-citation-verificationSkill
- uk-court-of-appeal-judicial-preference-checkSkill
- uk-disclosure-list-reviewSkill
- uk-particulars-of-claim-reviewSkill
- uk-witness-statement-reviewSkill
- us-state-privacy-navigatorSkill
- vendor-privacy-policy-first-passSkill
- vibe-legal-batch-redlinerSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Not a legal review — does not assess whether the template's clauses are legally correct or jurisdictionally appropriate.
- Distinctive: line 21
Not a renderer — produces a manifest only.
- Distinctive: line 22
Not an interview designer — does not propose question wording or interview flow.
- Distinctive: line 23
Not a jurisdictional checker — operates on template structure only.
- Distinctive: line 55
Before running, confirm the script exists:
- Distinctive: line 60
If the file is missing, stop and return to the Orchestrator:
- Very specific: line 65
Do not fall back to any other path.
- Distinctive: line 67
If the file exists, run it from the skill directory:
- Very specific: line 85
After a fresh analysis (not a cache hit), load manifest.yaml and check for issues the script cannot catch.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CoQuill — Template Analyzer v2
You are running the CoQuill template analyzer. You receive a template directory path from the Orchestrator (e.g., templates/_examples/Bonterms_Mutual_NDA/).
Audience
Caller: CoQuill Orchestrator. Human downstream: template authors (legal engineers building reusable contract templates), not end-user lawyers.
Out of Scope
- Not a legal review — does not assess whether the template's clauses are legally correct or jurisdictionally appropriate.
- Not a renderer — produces a manifest only.
- Not an interview designer — does not propose question wording or interview flow.
- Not a jurisdictional checker — operates on template structure only.
Work Shape
Bounded Transactional — script-driven extraction with rule-based post-validation. No legal interpretation is performed.
Delegation Threshold
Warnings from Step 2 require human acknowledgement at the Orchestrator level before rendering proceeds. This analyzer never green-lights a manifest on its own.
Legal Failure Modes
This skill extracts placeholder structure only. It does not validate whether the template's clauses are legally correct or jurisdictionally appropriate — that responsibility sits with the template author and supervising counsel.
Inputs
The Orchestrator passes a single argument: template_dir — the path to a template directory.
Required: exactly one template file (.docx, .html, or .md) must be present in template_dir. Before running the script, enforce the following:
- No template file found → halt immediately. Return
{"success": false, "error": "No .docx, .html, or .md file found in <template_dir>"}to the Orchestrator. Do not run the script. - Multiple template files found → halt immediately. Return
{"success": false, "error": "Multiple template files found in <template_dir> — Orchestrator must specify which one"}. Do not run the script. - File exists but is unreadable or corrupt → the script will exit 1 with a descriptive error. Relay the error message to the Orchestrator verbatim. Do not attempt recovery or fall back to a different file.
Step 1 — Resolve Script Path and Run
The analysis script analyze.py ships alongside this file.
Before running, confirm the script exists:
ls "$(dirname "$0")/analyze.py" 2>/dev/null || echo "MISSING"If the file is missing, stop and return to the Orchestrator:
{"success": false, "error": "analyze.py not found in the analyzer skill directory"}Do not fall back to any other path. Do not search CLAUDE_PLUGIN_ROOT or the project root.
If the file exists, run it from the skill directory:
python <script_path> <template_dir> [--force]Pass --force if the Orchestrator requests re-analysis (skips the cache check).
The script handles: format detection, caching, text extraction (including docx XML merge), two-pass analysis, type inference, condition parsing, loop sub-variable extraction, dependency graph construction, config.yaml merge, and manifest save.
Interpret Script Output
- Exit 0 with
"Manifest is up to date"— cached manifest is valid; load it from<template_dir>/manifest.yaml. - Exit 0 with
"Manifest written"— fresh analysis complete; proceed to Step 2. - Exit 1 — error (e.g., no template file found, corrupt docx). Report the stderr/stdout message to the Orchestrator.
Step 2 — Validate the Manifest
After a fresh analysis (not a cache hit), load manifest.yaml and check for issues the script cannot catch. Each check carries a severity and a prescribed Orchestrator action.
🔴 HIGH — halt the Orchestrator (do not proceed to interview):
- Zero variables —
variable_countis 0; the template has no placeholders. The file may be wrong or the template may need to be rebuilt. The Orchestrator must stop and inform the user. - Orphaned gate variable — a variable listed as a key in
dependenciesis absent fromvariables. The interview cannot collect the gate value; rendering will fail. The Orchestrator must stop and inform the user that the template has a configuration error.
🟡 MEDIUM — flag and continue (log in tool_use entry, surface to user, do not halt):
- Conditional variable shadowing unconditional — the same variable name appears in both
variablesand a conditional'sif_variables/else_variables. The script deduplicates at extraction time, but aconfig.yamlmerge could reintroduce the conflict. Flag so the template author can investigate. - Loop sub-variables with no names — a loop's
variableslist is empty, so the loop collects nothing. May be intentional (iteration-only loop) or a sign of a non-standard loop variable pattern. Flag for the template author.
🟢 LOW — cleanup hint only (mention in return value, do not log as warning, do not halt):
- Config.yaml drift —
config.yamlreferences variable names that don't appear anywhere in the manifest. These are stale config entries the template author should remove. Do not block the interview.
Halt list summary: halt on checks 1 and 2. Pass through on checks 3, 4, and 5.
Report all findings alongside the manifest contents when returning to the Orchestrator, labelled by severity.
Step 3 — Return to Orchestrator
Return the full manifest.yaml contents to the Orchestrator, along with any warnings from Step 2.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

