Draft legal pieces (petitions, contracts, opinions, appeals, defenses) guided entirely by structured documentation created with plan-legal-docs. This skill reads a project's docs/ folder — CASO.md, ESTRATEGIA.md, matérias with teses/normas/fluxos — and produces a traceable legal draft where every argument is anchored to documented theses, catalogued legal norms, and strategic decisions approved by the lawyer. Use this skill when the user wants to: write/draft/redact a legal piece from existing documentation, generate a petition or contract or opinion based on a docs/ folder, produce a traceable legal draft, or convert structured legal documentation into a finished piece. Also trigger when the user says "redija a peça", "escreva a petição", "gere o contrato", "elabore o parecer", "draft the petition", "write the contract", or any variation of "transform this documentation into a legal piece". This skill is the writing counterpart to plan-legal-docs — it consumes what that skill helps produce.
Generate legal piece drafts guided entirely by structured documentation.
This skill is the second half of the Docs-First method applied to law: while plan-legal-docs
creates and audits the documentation, draft-legal-piece consumes that documentation to
produce the actual legal piece.
The core principle: the lawyer is the strategist, the AI is the drafter. Every argument, every clause, every conclusion in the generated piece traces back to a documented thesis, a catalogued legal norm, or a strategic decision. The AI does not invent — it redacts what has already been decided and documented.
Before writing anything, run the audit from the companion skill:
python3 <plan-legal-docs-path>/scripts/audit_legal_docs.py <repo-path>
Or, if the audit script is not available, manually verify:
docs/ directory exists with the canonical structure.CASO.md has real content (not just placeholders).ESTRATEGIA.md defines the piece structure and argument order.normas.md in each matéria has at least one concrete legal reference.REQUISITOS_FORMAIS.md defines the formatting rules.If BLOCKERs exist, refuse to enter writing mode. Explain what's missing and suggest
the lawyer use plan-legal-docs to resolve the gaps first. Drafting from incomplete
documentation defeats the purpose of the method — it forces the AI to improvise, which
is exactly what structured documentation exists to prevent.
If the documentation has only WARNs or INFOs, proceed but note the warnings at the top of the output so the lawyer is aware.
The documentation must be read in a specific sequence because each document builds context for the next. This order matters — skipping or reordering leads to loss of context:
docs/CASO.md — Establishes the factual universe: parties, facts, claims, urgency.
After reading this, the AI knows what happened and who is involved.
docs/ESTRATEGIA.md — Defines how the piece will be structured: type of action,
rite, jurisdiction, argument order, risks. This is the architectural blueprint.
docs/GLOSSARIO.md — Ensures domain-specific terms are used correctly and consistently.
docs/DECISOES.md — Reveals the strategic choices already made and their rationale.
The AI must respect these decisions, not second-guess them.
docs/materias/INDEX.md — Identifies all matérias and their priority/order.
For each matéria, in the order defined by ESTRATEGIA.md:
README.md — Theses (TESE-) and sufficiency criteria (CS-)normas.md — Legal foundations: legislation, jurisprudence, doctrine, subsumption tablesfluxos.md — Logical chains (premise → norm → subsumption → conclusion)notas.md — Strategic notes, risks, drafting guidancedocs/requisitos-formais/REQUISITOS_FORMAIS.md — Formatting constraints, deadlines,
filing requirements. Read last because these are applied as a final layer.
Read the appropriate reference file for the piece type before drafting:
references/estrutura-peticao.mdreferences/estrutura-contrato.mdreferences/estrutura-parecer.mdThe piece type is determined from ESTRATEGIA.md (field "Tipo de Peça") or from the
user's request.
Every argumentative paragraph must trace to at least one TESE-* ID. If a matéria has no teses defined, it must not appear in the piece. The AI must not generate arguments that are not grounded in the documentation — even if they seem relevant. This is the most important rule of the skill. When the AI has ideas for additional arguments, it should note them as suggestions at the end of the output, not weave them into the piece.
Legal references (legislation, jurisprudence, doctrine) must come from normas.md of the
relevant matéria. The AI must not fabricate citations, invent case numbers, or reference
statutes not documented. This directly combats legal hallucination — the most dangerous
form of AI error in law.
If the AI believes additional legal references would strengthen an argument, it should flag this as a suggestion: "Considerar incluir referência a [tema] em normas.md da matéria [X]."
The argument order comes from ESTRATEGIA.md. The AI must not reorder arguments based on what it considers a better flow. The lawyer has already made this strategic decision.
Formatting (font, spacing, margins, page limits) comes from REQUISITOS_FORMAIS.md. If the piece is being generated as markdown, include a header comment noting the formatting requirements for when the document is converted to its final format.
After each major section or argumentative block, include an HTML comment with the IDs that support that section:
<!-- Traces: TESE-NEXO-CAUSAL-001 | CS-NEXO-CAUSAL-001 | D003 -->
These markers are invisible in the rendered document but allow the lawyer to navigate from any paragraph back to its documentation source. They also enable the post-draft verification script to check coverage.
If the documentation is ambiguous on a point, or if a CS-* criterion is not fully satisfiable with the available information, mark it inline:
<!-- ATENÇÃO: CS-DANO-MORAL-002 depende de laudo pericial ainda não disponível (ver PENDENCIAS.md) -->
This prevents the AI from silently papering over gaps.
The skill produces two artifacts:
rascunho-<tipo>.md)The complete legal piece in markdown, following the structure defined by the piece variant and ESTRATEGIA.md. Includes traceability markers throughout.
relatorio-cobertura.md)A verification report showing:
Save both files to the repository's docs/relatorios/ directory.
After generating the draft, run the coverage verification:
python3 scripts/verify_coverage.py <repo-path> <draft-path>
This script:
<!-- Traces: ... --> markers from the draft.python3 scripts/check_readiness.py <repo-path>
Returns exit code 0 if ready for drafting, exit code 1 if BLOCKERs exist.
python3 scripts/verify_coverage.py <repo-path> <draft-path>
This skill fits into the broader cycle:
1. Caso / Necessidade
↓
2. Documentação estruturada (plan-legal-docs)
↓
3. Auditoria → Decisões humanas
↓
4. Documentação consolidada
↓
5. Redação guiada (draft-legal-piece) ← you are here
↓
6. Verificação de cobertura
↓
7. Revisão humana → Ajustes na documentação
↓
8. Nova redação (se necessário)
↓
9. Próximo incremento (contestação, recurso, aditivo...)
Each iteration strengthens both the documentation and the piece. The documentation survives the piece — if the case escalates to an appeal, the same docs/ folder serves as the foundation for the next piece, with matérias inherited and adapted.