aiskillstore/marketplace / skills/1102tools-dev/sow-pws-builder
sow-pws-builder
VerifiedTrigger for: writing, revising, converting, or descoping a federal Statement of Work, Performance Work Statement, SOW, PWS, or SOO; develop executable requirements; define contract scope; create measurable performance standards; or prepare requirements before an IGCE. Produce a contract-file-ready .docx plus separate chat-only staffing and Section B handoffs. Never place FTEs, SOC codes, staffing estimates, IGCE content, CLINs, or pricing schedules inside the SOW/PWS body. Do NOT use for the IGCE, market research report, acquisition plan, QASP, or clause-selection matrix.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 12.0 KB |
| agents/openai.yaml | config | 295 B |
| references/document-specification.md | markdown | 5.3 KB |
| references/handoff-specification.md | markdown | 2.9 KB |
| references/question-blocks.md | markdown | 3.5 KB |
| references/regulatory-and-content-rules.md | markdown | 3.5 KB |
| references/runtime-adaptation.md | markdown | 1.7 KB |
| references/validation-gates.md | markdown | 2.5 KB |
| scripts/validate_docx.py | script | 6.9 KB |
| skill-report.json | config | 39.9 KB |
| test.md | markdown | 3.3 KB |
| testing.md | markdown | 24.3 KB |
scripts/validate_docx.py
View on GitHub#!/usr/bin/env python3
"""Validate SOW/PWS DOCX structure, headings, TOC, and artifact separation."""
from __future__ import annotations
import argparse
import json
import re
import sys
import zipfile
from pathlib import Path
from docx import Document
CORE_SECTIONS = [
"introduction",
"definitions and acronyms",
"requirements",
"deliverables",
"period of performance",
"place of performance",
"government-furnished property and information",
"security and privacy",
"key personnel",
"reporting and oversight",
"quality",
"transition",
"constraints and assumptions",
]
FORBIDDEN = {
"staffing handoff": re.compile(r"staffing\s+handoff\s+table", re.I),
"IGCE skill plumbing": re.compile(r"\bIGCE\s+Builder\b|\bbuild\s+the\s+IGCE\b", re.I),
"Section B handoff": re.compile(r"(?:CLIN|Section\s+B)\s+handoff\s+table", re.I),
"SOC code": re.compile(r"\bSOC\s+Code\b", re.I),
"FTE staffing": re.compile(r"\bFTEs?\b", re.I),
"CLIN content": re.compile(r"\bCLINs?\b", re.I),
"labor-category ceiling-hours table": re.compile(r"Labor\s+Category\s+Ceiling\s+Hours", re.I),
"wrong FAR 37 citation": re.compile(r"FAR\s+37\.102\s*\(d\)", re.I),
"wrong key-personnel clause": re.compile(r"FAR\s+52\.237-2", re.I),
"TOC refresh instruction": re.compile(r"(?:Ctrl|Cmd)\+A.{0,40}F9", re.I | re.S),
"local runtime path": re.compile(r"/(?:mnt|tmp|Users)/|[A-Za-z]:\\", re.I),
}
def normalize_heading(text: str) -> str:
text = re.sub(r"^\s*(?:section\s+)?\d+(?:\.\d+)*[.):-]?\s*", "", text, flags=re.I)
return re.sub(r"\s+", " ", text).strip().lower()
def document_text(document: Document) -> str:
parts = [paragraph.text for paragraph in document.paragraphs]
for table in document.tables:
for row in table.rows:
for cell in row.cells:
parts.append(cell.text)
return "\n".join(parts)
def heading_level(paragraph: object) -> int | None:
style = getattr(paragraph, "style", None)
name = getattr(style, "name", "") or ""
match = re.fullmatch(r"Heading\s+([1-9])", name, re.I)
return int(match.group(1)) if match else None
def has_toc_and_update(path: Path) -> tuple[bool, bool]:
with zipfile.ZipFile(path) as archive:
document_xml = archive.read("word/document.xml").decode("utf-8", errors="replace")
settings_xml = archive.read("word/settings.xml").decode("utf-8", errors="replace")
has_toc = bool(re.search(r"<w:instrText[^>]*>[^<]*\bTOC\b", document_xml, re.I))
update = bool(re.search(r"<w:updateFields\b[^>]*(?:w:val=[\"'](?:true|1)[\"'])?", settings_xml, re.I))
return has_toc, update
def validate(path: Path, document_type: str) -> dict[str, object]:
failures: list[str] = []
try:
if not zipfile.is_zipfile(path):
return {"status": "fail", "failures": ["file is not a valid DOCX ZIP"]}
with zipfile.ZipFile(path) as archive:
names = set(archive.namelist())
for required in ("[Content_Types].xml", "word/document.xml", "word/styles.xml"):
if required not in names:
failures.append(f"missing DOCX part: {required}")
document = Document(path)
except (OSError, ValueError, zipfile.BadZipFile) as exc:
return {"status": "fail", "failures": [f"cannot read DOCX: {exc}"]}
text = document_text(document)
for label, pattern in FORBIDDEN.items():
if pattern.search(text):
failures.append(f"document contains forbidden {label}")
h1 = [
normalize_heading(paragraph.text)
for paragraph in document.paragraphs
if heading_level(paragraph) == 1 and paragraph.text.strip()
]
if len(h1) < len(CORE_SECTIONS):
failures.append(f"only {len(h1)} Heading 1 sections found; expected at least {len(CORE_SECTIONS)}")
positions: list[int] = []
for expected in CORE_SECTIONS:
if expected == "quality":
candidates = [
index
for index, value in enumerate(h1)
if value in {"qasp summary", "inspection and acceptance"}
]
else:
candidates = [index for index, value in enumerate(h1) if value == expected]
if not candidates:
failures.append(f"missing Heading 1 section: {expected}")
else:
positions.append(candidates[0])
if positions and positions != sorted(positions):
failures.append("core Heading 1 sections are out of order")
if document_type == "pws":
if "qasp summary" not in h1:
failures.append("PWS is missing a Heading 1 QASP Summary")
if not re.search(r"\bAQL\b|Acceptable Quality Level", text, re.I):
failures.append("PWS does not contain an AQL")
if not re.search(r"performance standard|assessment method|method of assessment", text, re.I):
failures.append("PWS does not contain measurable performance or assessment language")
else:
if "inspection and acceptance" not in h1:
failures.append("SOW is missing a Heading 1 Inspection and Acceptance section")
if re.search(r"\bCPARS\b", text, re.I) and re.search(
r"\b(?:Exceptional|Very Good|Satisfactory|Marginal|Unsatisfactory)\b", text, re.I
):
failures.append("document ties CPARS language to rating labels")
if len(h1) > 8:
try:
has_toc, update = has_toc_and_update(path)
except (KeyError, OSError, zipfile.BadZipFile) as exc:
failures.append(f"cannot audit TOC settings: {exc}")
else:
if not has_toc:
failures.append("document with more than eight sections has no dynamic TOC field")
if not update:
failures.append("document does not set updateFields-on-open")
return {
"status": "pass" if not failures else "fail",
"document_type": document_type,
"heading_1_count": len(h1),
"table_count": len(document.tables),
"failures": failures,
}
def main() -> int:
parser = argparse.ArgumentParser(description="Validate a SOW or PWS DOCX.")
parser.add_argument("document", type=Path)
parser.add_argument("--document-type", required=True, choices=("sow", "pws"))
parser.add_argument("--json", action="store_true")
args = parser.parse_args()
if not args.document.is_file():
print(f"ERROR: document not found: {args.document}", file=sys.stderr)
return 2
result = validate(args.document, args.document_type)
if args.json:
print(json.dumps(result, indent=2, sort_keys=True))
elif result["status"] == "pass":
print("DOCX structure, content separation, and TOC settings passed.")
else:
print("VALIDATION FAILED")
for failure in result["failures"]:
print(f"- {failure}")
return 0 if result["status"] == "pass" else 1
if __name__ == "__main__":
raise SystemExit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |