Skip to content
Automation
Skill

/subcontract-writer

Generate a complete subcontract from a firm's template, awarded bid, and project specs. Outputs a Word document. Triggers: 'subcontract', 'sub agreement', 'write contract', 'draft subcontract'. Requires awarded bid.

From plugin
claude-code-construction
4113 skills
Install
$ npx -y skills add dleerdefi/claude-code-construction --skill subcontract-writer --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/subcontract-writer

Context preview

The summary Claude sees to decide when to auto-load this skill.

Generate a complete subcontract from a firm's template, awarded bid, and project specs. Outputs a Word document. Triggers: 'subcontract', 'sub agreement', 'write contract', 'draft subcontract'. Requires awarded bid.

SKILL.md

subcontract-writer.SKILL.md
name: subcontract-writer
description: >
  Generate a complete subcontract from a firm's template, awarded bid, and
  project specs. Outputs a Word document. Triggers: 'subcontract', 'sub
  agreement', 'write contract', 'draft subcontract'. Requires awarded bid.
argument-hint: "<scope_of_work>"
disable-model-invocation: true

Subcontract Writer

Generates a complete, execution-ready subcontract agreement from a firm's template, the awarded bid, and project specifications. **You are the intelligence layer** — you read every document, extract all data, generate every article's text, make legal/commercial judgments, and write fully-populated JSON files. The Python formatter is a thin rendering utility that makes no content decisions.

**Output:** Word document (.docx) matching the firm's template structure.

**Dependency:** Requires `python-docx` in the construction Python environment.

**Key principle:** The bid document is the PRIMARY input. It establishes what was priced, at what rates, with what inclusions and exclusions. Specifications inform scope descriptions and technical requirements. The template provides article structure and standard boilerplate.

---

Pipeline Position

This skill can be invoked directly when the user has an awarded bid and wants to generate a subcontract, or as the final step of the bid pipeline:

/bid-tabulator → /bid-evaluator → user confirms → THIS SKILL

Either way, the awarded bid document (Slot B) is the mandatory input.

Mode Detection

Check for `.construction/` directory at the project root.

  • **AgentCM mode**: Read specs from `.construction/spec_text/{section}.txt`. Use sheet index from `.construction/index/sheet_index.yaml` for drawing references. Read project metadata from `.construction/CLAUDE.md`.
  • **Flat File mode**: Discover spec PDFs via project `CLAUDE.md` paths or directory search. Read drawing sheets directly from PDF.

---

Architecture: Five Phases in Order

Execute in five sequential phases. Each phase has a defined output that must be completed before the next begins. **Do not skip phases or combine them.** The most common failure mode is attempting Phase 4 (writing) before Phase 3 (validation) is complete.

Subcontract Writer Progress:
Phase 1  →  Phase 2  →  Phase 3  →  USER CHECKPOINT  →  Phase 4  →  Phase 5
Triage     Extract     Validate      Confirm data         Write       Verify

---

Phase 1 — Document Triage and Slot Assignment

Before reading any document substantively, assign each uploaded file to its slot. State the assignments to the user before proceeding.

| Slot | Role | Source | What It Provides | |------|------|--------|-----------------| | A | Template | Subcontract PDF/DOCX | Article structure, boilerplate language, required sections | | B | Awarded bid | Subcontractor bid PDF | **Contract sum, quantities, unit rates, inclusions, exclusions, VE alternates** | | C | Specifications | Spec section PDFs | Scope descriptions, submittal requirements, warranty clauses, installer qualifications | | D | Drawings | Finish schedule, floor plans | Room codes, area takeoffs, scope boundaries |

**Slot B is mandatory.** If missing, stop and output:

I need the awarded subcontractor's bid document before I can generate this
subcontract. The bid is the source of truth for the contract sum, quantities,
and unit rates. Which file is the awarded bid?

Read Slot A first to understand the required article structure. Note every article heading. Flag any article that requires project-specific content (not just boilerplate) — these become required extraction targets in Phase 2.

If no template is provided, ask: "Do you have a standard subcontract template?" If none available, use AIA A401-style structure as fallback.

---

Phase 2 — Structured Extraction, One Slot at a Time

Run a separate extraction pass for each slot. Write extracted data to `scope_data.json` incrementally. Do not combine slots in a single read.

Slot B Extraction (Bid Document) — Run First

Read the bid PDF using vision. Extract every field below. Mark any field not found as `MISSING` — do not infer or estimate.

**Commercial data:**

  • Subcontractor company name (exact legal name from letterhead)
  • Address, phone, email
  • License/registration number
  • Estimator/contact name
  • Proposal number and date
  • Bid validity period (if stated)
  • Total contract sum (exact dollar amount)

**Scope data:**

  • Line items with: spec section, description, quantity, unit, unit rate, extended amount
  • Inclusions list (verbatim from bid)
  • Exclusions list (verbatim from bid — critical for scope gap prevention)
  • Value engineering alternates with VE ID, description, and deduct amount
  • Qualifications or clarifications

**Verify:** Line item amounts must sum to the total contract sum. If they don't, flag the discrepancy.

Slot A Extraction (Template)

**If .docx template:** Use python-docx to read headings, paragraphs, and identify article structure.

**If PDF template:** Use vision to read the template. Rasterize pages if needed:

${CLAUDE_SKILL_DIR}/../../bin/construction-python ${CLAUDE_SKILL_DIR}/../../scripts/pdf/rasterize_page.py template.pdf {page} --dpi 200 --output template_page_{page}.png

Extract the list of required articles and any fill-field placeholders (`[DATE]`, `[CONTRACT SUM]`, `[SUBCONTRACTOR]`).

For each article, determine:

  • `number` and `title` (exactly as shown in template)
  • `content_type`: one of:
  • `"preserve"` — standard boilerplate (payment terms, insurance, dispute resolution, indemnity, safety, default/termination, general provisions). Transcribe the EXACT text verbatim.
  • `"generate"` — scope-specific content (scope of work, contract documents, schedule, submittals, warranty). You will write this from extracted data.
  • `"fill-in"` — project-specific values (contract sum, dates). You will populate from the Data Model.

**Critical:** Transcribe ALL preserved article text verbatim. Do not summar

Read more
Ships withclaude-code-construction

Open-source skills that give Claude Code the working knowledge of a Project Engineer. Split drawings, parse specs, tabulate bids, generate subcontracts, and more — directly from your terminal or IDE.

Get the whole plugin
Stats
41
Stars
12
Forks
Maintained
Maintenance
Python
Language
MIT
License
5mo ago
Last commit
5mo ago
Created

Repo: dleerdefi/claude-code-construction

Other skills on claude-code-construction.