$npx -y skills add ferdinandobons/brand-docs --skill brand-docxBrand-aware Word engine. Use to (1) EXTRACT a company's brand from a Word template into a reusable "Brand Profile", (2) COMPREHEND the template with the model (optional), (3) VERIFY it, (4) GENERATE new on-brand .docx documents FROM a saved profile. Trigger on "extract our brand"
| 1 | # brand-docx |
| 2 | |
| 3 | Use this skill when the user wants a reusable Word brand kit or wants to create |
| 4 | a new on-brand `.docx` from a company template and variable content. |
| 5 | |
| 6 | This is an AI-agent skill for Codex and Claude Code. The user should not need to |
| 7 | write JSON or run shell commands. The agent converts the user's content into an |
| 8 | IntermediateDocument, invokes the internal engine, verifies the output, and |
| 9 | returns the generated `.docx`. |
| 10 | |
| 11 | ## The seven verbs: three deterministic + four model-assisted |
| 12 | |
| 13 | Every brand skill (`brand-docx`, `brand-pptx`, `brand-xlsx`) implements the same |
| 14 | contract. The deterministic core is **extract / verify / generate**; on top of it |
| 15 | sit the optional learning verbs **comprehend / learn / propose-overrides / |
| 16 | refine**, each fail-closed (the engine validates every proposal and authors every |
| 17 | value). |
| 18 | |
| 19 | | Verb | Input | Output | |
| 20 | |---|---|---| |
| 21 | | **extract** | a company `.docx` template | a reusable Brand Profile | |
| 22 | | **comprehend** *(optional, model-driven)* | a saved profile + a model-authored `comprehension.json` | the profile with a validated, cached `comprehension` block | |
| 23 | | **verify** | a saved Brand Profile | QA findings + a verdict | |
| 24 | | **generate** | content (an IntermediateDocument) + a profile | a new on-brand `.docx` | |
| 25 | | **learn** *(deterministic distillation)* | the profile's cross-run generation history | recurring QA findings distilled into shell-frozen overrides, advisory until `--accept` | |
| 26 | | **propose-overrides** *(model-driven)* | the recurring remainder `learn` could not bind + a model-authored proposal | shell-backed corrections through the same fail-closed sink, advisory until `--accept` | |
| 27 | | **refine** | end-of-generation user feedback (text or a screenshot) as a `refinement.json` delta | the existing comprehension overlaid for FUTURE generations, advisory until `--accept` | |
| 28 | |
| 29 | `comprehend` is **optional**: `generate` works on the deterministic profile alone. |
| 30 | When a current comprehension is present, `generate` additionally reconciles the |
| 31 | template's preserved cover/index structures with the new content. See |
| 32 | [reference/comprehension.md](reference/comprehension.md) for the full step. |
| 33 | |
| 34 | ## Hard Rules |
| 35 | |
| 36 | - Treat `python scripts/cli.py ...` as an internal engine command, not the user-facing workflow. |
| 37 | - `scripts/cli.py` is a LAUNCHER that locates the engine root by itself: it works from this skill folder AND from the repo/plugin root (set `BRAND_DOCS_ROOT` to override). Never guess deeper paths like `scripts/brandkit/...`. |
| 38 | - Run the dependency preflight before starting extract / comprehend / verify / generate, and report missing or unusable dependencies before proceeding. |
| 39 | - Extract opens the source template read-only and saves `brand-kit/<name>/template/shell.docx` byte-for-byte. |
| 40 | - Generate opens the saved shell and resolves every semantic block through `profile.json`. |
| 41 | - Do not put style names, colors, fonts, or brand identifiers in an IntermediateDocument. |
| 42 | - If the user did not provide a template or enough content, ask for the missing input. |
| 43 | - Return the generated file path plus a QA summary. |
| 44 | - Consult `profile.json.artifact_catalog` before generation when the user asks to mimic a specific piece of the template. |
| 45 | |
| 46 | ## Preflight (always first) |
| 47 | |
| 48 | Before doing any work, run: |
| 49 | |
| 50 | ```bash |
| 51 | python scripts/cli.py doctor |
| 52 | ``` |
| 53 | |
| 54 | Use its output to decide the run mode: |
| 55 | |
| 56 | - If a required Python dependency is missing, install/repair it before extraction |
| 57 | or generation; the core engine is not ready. |
| 58 | - If only visual renderers are missing or unusable (`soffice` plus `pdftoppm` or |
| 59 | optional PyMuPDF/`fitz`), the |
| 60 | core L0 workflow can still run, but a full visual audit cannot be claimed. |
| 61 | Tell the user what is missing, include the install/repair hint printed by |
| 62 | `doctor`, and either proceed with degraded QA or install the renderer first. |
| 63 | - If optional OCR (`tesseract`) is missing, the visual audit can still run, but |
| 64 | rendered residual-text proof is incomplete. Report that limitation when |
| 65 | judging stale placeholders or field caches. |
| 66 | - For `--qa deep` or `--qa strict`, prefer repairing/installing renderers before |
| 67 | generation. If the environment cannot run them, `deep` generates a degraded |
| 68 | manifest and `strict` fails with a visual proof blocker. |
| 69 | |
| 70 | ## Agent Workflow |
| 71 | |
| 72 | 1. Run the dependency preflight above and report any degraded capability. |
| 73 | 2. Determine the brand name and locate the user-provided `.docx` template. |
| 74 | 3. If no matc |