Skip to content
Agentmart
Submit a tool

word-contract-formatting

Apply Darwin Legal formatting conventions when drafting or generating any contract, agreement, amendment, or legal document as a Word (.docx) file.

Skill by bstevescherer

IndexedMIT★ 43
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/bstevescherer-word-contract-formatting

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Apply Darwin Legal formatting conventions when drafting or generating any contract, agreement, amendment, or legal document as a Word (.docx) file. Use this skill whenever Ryan asks to draft, generate, or format any agreement — including RSPAs, consulting agreements, amendments, board consents, side letters, or any other legal document — even if the request doesn't explicitly mention formatting. Also use when asked to reformat or clean up an existing contract. Always read this skill before producing any .docx legal document.

Use cases: documents, legal

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/word-contract-formatting

What's inside

Skill name
word-contract-formatting
Description
Apply Darwin Legal formatting conventions when drafting or generating any contract, agreement, amendment, or legal document as a Word (.docx) file. Use this skill whenever Ryan asks to draft, generate, or format any agreement — including RSPAs, consulting agreements, amendments, board consents, side letters, or any other legal document — even if the request doesn't explicitly mention formatting. Also use when asked to reformat or clean up an existing contract. Always read this skill before producing any .docx legal document.
License
MIT
Instructions
323 lines in SKILL.md · view on GitHub

Files (3)

  • SKILL.md
  • Darwin_Legal_Base_Template.dotx · assets/
  • skill.yml

SKILL.md (first lines)

# Darwin Legal Word Contract Formatting

## Overview

This skill governs how all Darwin Legal contracts and legal documents are formatted in Word. Apply these rules to every document generated as a .docx, regardless of agreement type.

Also read the docx SKILL.md at `/mnt/skills/public/docx/SKILL.md` for general Word document mechanics. This skill governs Darwin Legal-specific content and style choices.

The base template lives at: `assets/Darwin_Legal_Base_Template.dotx`

---

## Document Generation Workflow

**Always start from the template.** Do not create a blank document. The template contains the Darwin Legal Numbering style, Normal style with correct font/spacing, and all numbering definitions.

```bash
# Step 1: Copy template as working docx
cp assets/Darwin_Legal_Base_Template.dotx /tmp/output.docx

# Step 2: Unpack
python scripts/office/unpack.py /tmp/output.docx /tmp/unpacked/

# Step 3: Edit word/document.xml — replace body content, preserve structure
# Step 4: Pack
python scripts/office/pack.py /tmp/unpacked/ /tmp/output.docx --original /tmp/output.docx

# Step 5: ALWAYS run post-processing fix (see below) before saving to workspace
```

Clear the existing body content in `document.xml` (the template contains test paragraphs) and replace with the contract content. Preserve the `<w:body>` wrapper and `<w:sectPr>` (section properties) at the end.

### CRITICAL: Post-Processing Fix (Required After Every pack.py Run)

The `.dotx` base template causes two bugs that make Word refuse to open the output file. Both must be patched after pack.py runs, every time, without exception.

**Bug 1 — Wrong content type.** The template registers `word/document.xml` as `wordprocessingml.template.main+xml` in `[Content_Types].xml`. A `.docx` must use `wordprocessingml.document.main+xml`. pack.py preserves the template type and Word rejects the file.

**Bug 2 — Missing `standalone="yes"`.** pack.py strips the `standalone="yes"` attribute from the XML declaration in `word/document.xml`. Some versions of Word reject files missing this attribute.

A reusable fix function lives at `/sessions/funny-ecstatic-ride/mnt/.claude/fix_docx.py`. Call it immediately after pack.py, before saving anywhere:

```python
import sys
sys.path.insert(0, '/sessions/funny-ecstatic-ride/mnt/.claude')
from fix_docx import fix_docx
fix_docx('/tmp/output.docx', '/sessions/funny-ecstatic-ride/mnt/Drafts and Comments/FINAL_NAME.docx')
```

Do not save the raw pack.py output to the workspace — always run fix_docx first.

### CRITICAL: Preserve `<w:document>` Opening Tag Verbatim

Never reconstruct the `<w:document>` opening tag from scratch. The tag declares many optional namespace prefixes (`cx1`–`cx8`, `w16sdtdh`, `w16sdtfl`, `w16du`, `wp14`, etc.) that must match the `mc:Ignorable` attribute exactly. If any declared prefix is missing or mismatched, Word rejects the file.

Always extract the header from the template itself:

```python
import zipfile, re

with zipfile.ZipFile('/tmp/output.docx') as z:
    orig = z.read('word/document.xml').decode()
m = re.match(r'(.*?<w:body>)', orig, re.DOTALL)
header = m.group(1)  # use this verbatim as the opening of document.xml
```

Then build the new document.xml as `header + body_content + sectPr + '</w:body></w:document>'`.

### `w:pPr` Element Ordering

OOXML schema requires this order inside `<w:pPr>` for numbered paragraphs:

```xml
<w:pPr>
  <w:pStyle w:val="ListParagraph"/>
  <w:numPr>
    <w:ilvl w:val="0"/>
    <w:numId w:val="3"/>
  </w:numPr>
  <w:spacing w:after="360" w:line="240" w:lineRule="auto"/>
  <w:contextualSpacing w:val="0"/>
  <w:jc w:val="both"/>
</w:pPr>
```

Order must be: `pStyle → numPr → spacing → contextualSpacing → jc`. Any other order causes a schema validation error and may prevent the file from opening.

---

## Font and Page Setup

These are already baked into the template's Normal style. Do not override them in paragraph-level XML unless correcting a specific paragraph.

- Font: Times New Roman, 12pt
- Margins: 1 inch all sides
- Spacing after: 360 twips (18pt) — `<w:spacing w:after="360" w:line="240" w:lineRule="auto"/>`
- Justification: full — `<w:jc w:val="both"/>`
- Page numbers: plain Arabic numerals, centered footer, no decoration

---

## Document Title and Date

- Title: centered, all caps — use a plain Normal paragraph with `<w:jc w:val="center"/>` and a bold run
- Effective date appears in the first sentence of the body, not in the signature block
- Opening pattern: `This [Agreement Name] (this "Agreement") is made as of [Date] by and between...`

---

## Numbering — Darwin Legal Numbering Style

The template defines a four-level multilevel list style. Reference it by setting `numId="3"` and the appropriate `ilvl` in each paragraph's `<w:pPr>`.

### Level Reference Table

| Level | Format | ilvl | Example |
|-------|--------|------|---------|
| First | `1.` `2.` `3.` | 0 | `1.   Services.` |
| Second | `a.` `b.` `c.` | 1 | `a.   Scope.` |

From bstevescherer/heycounsel-community, MIT.

More from bstevescherer/heycounsel-community

Signals

Stars
43
Forks
6
Open issues
0
Last commit (this folder)
May 4, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from bstevescherer

Cite this page

word-contract-formatting skill. Agent Mart. https://agentmart.dev/skills/bstevescherer-word-contract-formatting (last updated 2026-10-24)