Contract template authoring msa nda

From CraftOS-dev/craftbot-agent-bundles · View interactive version

Contract template authoring msa nda is an AI agent skill from the GitHub repository CraftOS-dev/craftbot-agent-bundles. Author reusable, conditional-logic contract templates (MSA, NDA, employment, vendor, customer T&C, DPA, AUP, BAA, SLA) anchored to Bonterms / Common Paper / YC / NVCA canonical templates. Variable fields + conditional clauses + version control + binding-language hand-off to legal-counsel. Use when t

How to use this skill

Skill file

Contract template authoring (MSA / NDA / employment / vendor / T&C)

This skill builds the source template — the master, conditional-logic-bearing artifact a doc-gen engine renders from. It does NOT produce binding contract language; for that, hand off to the legal-counsel sibling agent.

When to use

User says:

Companion skills:

Setup

# Author with code (Python / Node) — no SaaS required, free
pip install docxtpl python-docx jinja2     # Python docx templating
npm install -g docxtemplater                # Node docx templating
brew install pandoc                          # markdown ↔ docx ↔ pdf
pip install weasyprint                       # HTML → PDF

# Anchor templates — pull canonical sources
curl -fsSL https://commonpaper.com/standards/ -o sources/common-paper-index.html
curl -fsSL https://bonterms.com/ -o sources/bonterms-index.html
# Bonterms + Common Paper templates are downloadable docx — clone to source-of-truth repo

# SaaS authoring (commercial)
# Documate: https://documate.org/  (FOSS / hosted tier)
# HotDocs:  https://www.hotdocs.com/  (legal industry standard, paid)
# Templafy: https://www.templafy.com/  (brand + Office-native, enterprise)

Auth / API keys:

Common recipes

Recipe 1: Pick the authoring engine

| Engine | Best for | License | Trigger |

|---|---|---|---|

| python-docx-template (docxtpl) | code-first orgs; CI render | OSS | "render via Python", "no SaaS budget" |

| docxtemplater (Node) | code-first JS orgs | OSS | "render via Node" |

| Jinja2 + WeasyPrint | HTML source → pixel-perfect PDF | OSS | "high-fidelity PDF", "CSS Paged Media" |

| Documate | interview-driven legal authoring | FOSS / hosted | "self-serve interview flow" |

| HotDocs | legal-industry-standard conditional logic | Paid | "Big Law standard", "existing HotDocs shop" |

| Docassemble | Python-extensible interview engine | OSS | "self-host", "custom Python rules" |

| Templafy | Office-native + brand injection | Enterprise | "Word/PPT-first org", "brand-critical" |

Recipe 2: Pull a canonical base template

# Common Paper standardized templates (NDA, Cloud Service, DPA, AUP, MSA)
mkdir -p sources/common-paper
curl -fsSL "https://commonpaper.com/standards/cloud-service-agreement/" -o sources/common-paper/csa.html
# Common Paper publishes docx; manually download the latest revision

# Bonterms modules (Cloud Terms, AUP, DPA, SLA)
mkdir -p sources/bonterms
# Bonterms publishes docx + linked dictionary; download each module separately

# YC SAFE (post-money default) + advisor agreement
curl -fsSL "https://www.ycombinator.com/documents" -o sources/yc-index.html

# NVCA Series A canonical docs
curl -fsSL "https://nvca.org/resources/model-legal-documents/" -o sources/nvca-index.html

Recipe 3: Define the merge-field schema

# template_schema.yaml — single source of truth for every field downstream callers must supply
template: msa-saas-customer-side
version: 2.4.0
fields:
  effective_date:
    type: date
    required: true
    format: "YYYY-MM-DD"
  customer:
    name: { type: string, required: true }
    entity_state: { type: string, required: true }
    entity_type: { type: enum, values: [C-corp, LLC, LP, S-corp, GmbH, Ltd], required: true }
    jurisdiction: { type: string, required: true }
    requires_soc2: { type: bool, default: false }
    requires_baa: { type: bool, default: false }
    requires_dpa: { type: bool, default: false }
  vendor:
    name: { type: string, required: true }
    entity_state: { type: string, required: true }
  product:
    name: { type: string, required: true }
    sku: { type: string, required: true }
  fees:
    annual_fee: { type: currency, required: true }
    currency: { type: string, default: USD }
    payment_terms: { type: enum, values: [Net 30, Net 45, Net 60], default: "Net 30" }
  term:
    initial_months: { type: int, default: 12 }
    auto_renew: { type: bool, default: true }
    non_renewal_notice_days: { type: int, default: 60 }
  liability:
    cap_multiplier: { type: float, default: 1.0 }

Recipe 4: Author the conditional template (docxtpl)

# templates/msa/v2.4.0.docx — opened in Word with placeholders + Jinja2 blocks
# Inline syntax:
#   {{customer.name}}                           — merge field
#   {{effective_date|format("MMMM D, YYYY")}}   — Jinja2 filter
#   {%p if customer.requires_soc2 %}            — conditional paragraph
#   {%tr if line.included %}                    — conditional table row
#   {% for line in line_items %} ... {%endfor%} — loop over child records

Recipe 5: Render against test data

# pip install docxtpl
from docxtpl import DocxTemplate
import yaml

tpl = DocxTemplate("templates/msa/v2.4.0.docx")
with open("test/fixtures/acme.yaml") as f:
    ctx = yaml.safe_load(f)
tpl.render(ctx)
tpl.save(f"out/msa-{ctx['customer']['name'].lower().replace(' ','-')}-{ctx['effective_date']}.docx")

Recipe 6: Convert rendered docx → PDF

# LibreOffice headless (free, server-friendly)
soffice --headless --convert-to pdf:writer_pdf_Export \
        --outdir out out/msa-acme-2026-06-15.docx

# Pandoc (markdown / docx → PDF via WeasyPrint engine)
pandoc out/msa-acme-2026-06-15.docx -o out/msa-acme.pdf --pdf-engine=weasyprint

Recipe 7: Version control with semantic versioning

# Treat templates like code
git init templates/
git add templates/msa/v2.4.0.docx template_schema.yaml
git commit -m "msa: v2.4.0 — add SOC 2 addendum conditional + CA non-compete carve-out"
git tag -a v2.4.0 -m "MSA SaaS customer-side template v2.4.0"
git push origin main --tags

# PR-only changes — require legal-counsel review on clause edits
# Lint with Vale before merge:
vale --config .vale.ini templates/msa/v2.4.0.docx

Recipe 8: HTML / Jinja2 source for pixel-perfect PDF

<!-- templates/msa/v2.4.0.html -->
<!DOCTYPE html>
<html>
<head>
  <style>
    @page { size: letter; margin: 1in; }
    h1 { font-family: 'Helvetica'; }
  </style>
</head>
<body>
  <h1>Master Services Agreement</h1>
  <p>Effective: {{ effective_date.strftime('%B %d, %Y') }}</p>
  <p>Between <strong>{{ customer.name }}</strong>, a {{ customer.entity_state }}
     {{ customer.entity_type }}, and <strong>{{ vendor.name }}</strong>.</p>

  {% if customer.requires_soc2 %}
  <h2>Security Addendum</h2>
  <p>Vendor maintains SOC 2 Type II certification per AICPA TSP 100.</p>
  {% endif %}

  {% if customer.jurisdiction == "California" %}
  <p>Governing law: State of California.</p>
  {% elif customer.jurisdiction == "Delaware" %}
  <p>Governing law: State of Delaware.</p>
  {% else %}
  <p>Governing law: {{ customer.jurisdiction }}.</p>
  {% endif %}
</body>
</html>
# Render via WeasyPrint
python -c "
from jinja2 import Template
from weasyprint import HTML
ctx = {...}
html = Template(open('templates/msa/v2.4.0.html').read()).render(**ctx)
HTML(string=html).write_pdf('out/msa-acme.pdf')
"

Recipe 9: Document the binding-language hand-off

Every template MUST carry a LEGAL_REVIEW.md next to it:

# templates/msa/v2.4.0/LEGAL_REVIEW.md
- Base: Bonterms Cloud Terms v2.1.0 (2025-09)
- Diff vs base: added §4.3 SOC 2 addendum (conditional on `customer.requires_soc2`)
- Reviewer: Outside counsel — review date 2026-05-12
- Jurisdictions covered: US (CA, DE, NY); EU (not yet — DPA exhibit pending)
- Open issues: None
- Next review trigger: any §6 (indemnity) or §10 (LoL) edit

Recipe 10: Clause library pattern (modular snippets)

templates/
├── msa/
│   └── v2.4.0.docx
├── clauses/
│   ├── governing-law/
│   │   ├── ca.md           # California carve-outs
│   │   ├── de.md           # Delaware default
│   │   └── ny.md
│   ├── indemnity/
│   │   ├── mutual.md
│   │   └── one-way-vendor.md
│   └── liability-cap/
│       ├── 1x-fees.md
│       ├── 2x-fees.md
│       └── unlimited-gross-negligence-only.md

Template uses {% include "clauses/governing-law/" + customer.jurisdiction_slug + ".md" %}.

Recipe 11: Brand lint with Vale

# .vale.ini
StylesPath = .vale/styles
MinAlertLevel = warning
[*.{md,docx}]
BasedOnStyles = Vale, Brand

Brand-voice rules in .vale/styles/Brand/ enforce: no jargon, sentence case headings, oxford comma, no "very/really/just", first-person plural ("we") not third-person ("the Company"). Run on every PR via github MCP.

Examples

Example 1: SaaS MSA from Bonterms base, with conditional SOC 2 + CA carve-out

Goal: Author a customer-side SaaS MSA reusable across 200+ deals/year with two conditional branches.

Steps:

  1. Recipe 2 — pull Bonterms Cloud Terms docx into sources/bonterms/cloud-terms-v2.1.0.docx.
  2. Open in Word, save as templates/msa/v0.1.0.docx.
  3. Add merge fields per Recipe 3 schema; conditionals per Recipe 4.
  4. Render against fixture (Recipe 5); verify both branches in two test passes.
  5. Convert to PDF (Recipe 6); spot-check formatting.
  6. Commit + tag v0.1.0 (Recipe 7).
  7. Send to legal-counsel for clause review.
  8. Iterate based on counsel comments → v1.0.0 release.

Result: Versioned template + LEGAL_REVIEW.md + render harness.

Example 2: Multi-party mutual NDA from Common Paper base

Goal: Standardize cross-party NDAs without re-drafting every time.

Steps:

  1. Pull Common Paper Mutual NDA template.
  2. Identify variables: party_a, party_b, optional party_c, purpose, term_months, residual_clause_yn.
  3. Define schema; author docxtpl version supporting {% for party in parties %} loop.
  4. Test: 2-party vs 3-party renders.
  5. Hand to legal-counsel for sign-off.

Result: A single template that handles 2- and 3-party NDAs with one render call.

Example 3: Employment offer letter with state-by-state clauses

Goal: Author an offer letter that auto-adjusts non-compete + at-will + arbitration to the candidate's state.

Steps:

  1. Start from Cooley GO offer letter template.
  2. Build state-clauses library (Recipe 10): CA bans non-compete; MA restricts; TX permits.
  3. Schema includes candidate.state.
  4. Template includes {% include "clauses/non-compete/" + candidate.state + ".md" %}.
  5. Render for one candidate per region; counsel review.
  6. Tag v1.0.0; deploy via HR portal smart form (smart-form-jotform-formstack).

Result: Single template covering all 50 states without manual edits.

Edge cases / gotchas

Disclaimer: This skill builds the source artifact. The agent does not draft binding contract language. Hand off final clause review to legal-counsel (with consult-an-attorney disclaimer) before any executed document.

Sources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.