--- name: policy-review description: > Interactive policy document review workflow with AI-assisted rewrites. Use this skill whenever the user uploads a policy document (markdown, docx, PDF, or text) and wants to review, approve, rewrite, or reject individual statements. Triggers on: "review this policy", "help me approve this document", "policy review", "review these statements", "go through this policy with me", or any request to systematically walk through a governance/compliance/HR/security policy and make approve/reject/rewrite decisions on each part. Also triggers when the user uploads a file that looks like a policy and asks to "edit", "refine", "clean up", or "improve" it statement by statement. Use this skill even if the user only wants to review part of a policy or a single section. --- # Policy review skill Presents an interactive carousel-based review board for any policy document. The user reviews each statement one at a time — approving, rejecting (with justification), rewriting manually, or requesting an AI-assisted rewrite with iterative refinement. **All policy content is HTML.** The widget renders HTML directly via `innerHTML`. No markdown parsing happens at runtime. AI rewrites produce HTML. Manual edits save as HTML. Working copies in persistent storage are HTML. --- ## When this skill triggers 1. User uploads a policy file and asks to review it. 2. User references an already-uploaded policy. 3. User pastes policy text directly into the conversation. 4. The soc2-policies skill hands off a policy for review. --- ## HTML-only working copies — lazy creation This skill operates on **HTML working copies** of policies. **If launched from soc2-policies (typical flow):** The handoff prompt says "load from soc2:working:{id} in persistent storage. If no working copy exists, read the HTML template from references/templates/ and apply company name replacement to create one." Claude should: 1. First, try to read `soc2:working:{policy-id}` from persistent storage. If found, this is the working copy (may contain prior edits). Use it. 2. If NOT found (first time reviewing this policy), read the HTML template file from the soc2-policies skill's `references/templates/` directory. Apply company name replacement (`[COMPANY NAME]` → actual name). This HTML becomes the working copy. The review carousel will save it to `soc2:working:{policy-id}` on export — do not save it now. 3. Parse the HTML into sections and statements (Step 1), then render. **If launched standalone** (user uploads a file directly): 1. If the file is markdown, convert to HTML once. If already HTML, use as-is. 2. Check `soc2:company-name` in storage. If not found and the text contains `[COMPANY NAME]` placeholders, ask the user. Store at `soc2:company-name`. 3. Apply company name replacement on the HTML string. **Critical:** Never write back to template files. Never store markdown in working copies. All working copies are HTML in persistent storage. --- ## Step 1: Parse the HTML policy into sections and statements Read the HTML working copy. Extract the hierarchical structure: - **Sections** correspond to `
`, `
` wrapping). - The widget uses `innerHTML` for rendering — never `textContent` + `esc()`. --- ## Integration with soc2-policies skill When launched from soc2-policies (prompt includes "Policy ID" and "WORKING COPY (HTML)"), the export step persists everything to `window.storage`. The soc2-policies dashboard reads it back when re-rendered. --- ## Edge cases - **Partial review**: Unreviewed statements treated as approved on export. - **Very long policies**: Suggest reviewing by section if >30 statements. - **Non-standard structure**: Create a single "Policy statements" section. - **Multiple rounds**: Each export updates the HTML working copy. Next review starts from the latest approved HTML version. - **AI rewrite preserves state**: Re-rendering the carousel after an AI rewrite must carry forward all prior decisions.