--- name: policy-export description: > Export a reviewed policy document as a Word (.docx) file. Use this skill whenever the user wants to export, download, or generate a Word document from a completed policy review. Triggers on: "export as Word", "download this policy", "generate a docx", "export policy", or any request to produce a final Word document from a reviewed policy. This skill receives the finalized policy content as HTML and converts it directly to a professional Word document. It is designed to be invoked by the soc2-policies skill or the policy-review skill after a review is complete, but can also be used standalone if the user provides HTML policy content. --- # Policy export skill Converts a finalized policy document (HTML) into a professional Word (.docx) file. This is the final step in the policy review pipeline. **Input is always HTML.** The soc2-policies and policy-review skills store all policy content as HTML. This skill receives HTML and converts it directly to Word format — no markdown intermediate step is involved at any point. --- ## When this skill triggers 1. User clicks "Export as Word" on a completed policy in the soc2-dashboard. 2. User asks to download or export a policy after completing a review. 3. User provides HTML policy content and asks for a Word document. --- ## Input format The export request comes from the dashboard's "Export as Word" button. The prompt includes ALL data needed to generate the document — Claude does NOT need to read from `window.storage` (which is only accessible from widget iframes, not from Claude's computer tools environment). The prompt contains: - Policy name, ID, and company name - Version metadata (version, date, author, approved by, description) - Full version history (all prior versions) - Audit trail entries (timestamped action log) - Rejected statements with justifications (if any) - Instruction to read HTML working copy from `soc2:working:{id}` **The HTML working copy is included directly in the export prompt** under the `FULL DOCUMENT (HTML):` header. Claude does NOT need to read from storage or render helper widgets — all data needed for the Word document is in the prompt. Example prompt from dashboard: ``` Export the completed policy "Incident Response Plan" (ID: incident-response) as a Word document using the policy-export skill. Read the HTML working copy from soc2:working:incident-response in persistent storage. Company name: Acme Corp Version: 1.1 Date: 2026-03-23 Author: Jane Smith Approved by: John Doe Description: Annual review and update FULL VERSION HISTORY: - v1.0 (2026-01-15): Initial revision - v1.1 (2026-03-23): Annual review and update by Jane Smith, approved by John Doe AUDIT TRAIL (15 entries): - 2026-03-23T10:15:00Z | approved | Purpose | - 2026-03-23T10:15:05Z | approved | Scope | - 2026-03-23T10:16:30Z | rewritten (AI) | Roles and responsibilities | - 2026-03-23T10:17:00Z | rejected | Root account compromise | Not applicable to our infrastructure REJECTED STATEMENTS: - Root account compromise: Not applicable to our infrastructure ``` The FULL DOCUMENT section contains the complete policy as HTML with all user rewrites already applied. This is the source of truth. --- ## Step 1: Validate the input Before generating the document, verify: 1. The FULL DOCUMENT section is present and non-empty. 2. No `[COMPANY NAME]` placeholders remain in the HTML. 3. The HTML is well-formed (check for unclosed tags). 4. If anything looks wrong, ask the user to confirm before proceeding. --- ## Step 2: Generate the Word document Use the docx skill to create a professional Word document. The docx skill accepts HTML input, so pass the HTML content directly — no conversion to markdown is needed. The document should include: 1. **Title page**: Policy name, company name, version, date, author, approver. Get version metadata from the export request message (Version, Date, Author, Approved by fields) or from `soc2:versions:{policy-id}` in storage. 2. **Table of contents**: See TOC instructions below. 3. **Policy body**: The full HTML content converted to Word formatting. - `

` → Document title / Heading 1 - `

` → Heading 2 (section headers) - `

` → Heading 3 (subsection headers) - `

` → Body text - `