# Patent Flowchart Generation

> Generate compliant patent flowchart images (A4@300DPI, black/white, no color) and assemble them into a WPS-compatible PPTX. Maps code logic into structured 2xN or 3xN grid flowcharts with precise arrows, bounded text, and formal layout.

- Skill: `geraltvitas/patent-flowchart-generation` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add geraltvitas/patent-flowchart-generation`
- Raw SKILL.md: https://api.skillmd.com/api/skills/geraltvitas/patent-flowchart-generation/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: GeraltVitas (https://skillmd.com/u/geraltvitas)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/geraltvitas/patent-flowchart-generation

---


# Patent Flowchart Generation

## Compliance Targets (patent drawings)
- **Size**: A4 @ 300DPI → **1890×2835 px** (width×height).
- **Color**: strict grayscale/black/white. No colored lines, fills, or color bars.
- **Typography**: Songti/Heiti (simhei/simsun). Title ~11–13pt, box label ~8.5pt, sublabel ~6–7pt. All text absolute, not relative.
- **Line thickness**: rectangles 4–5px (~0.3mm), arrows 5–6px (~0.35mm). No fine hairlines; no anti-aliasing artifacts after print scaling.
- **Margins**: 80–120px around the top title, 120px bottom margin for footer/notes.

## Design Layouts
- **Flow structure**: 2-row × 4-column or 3-row × 4-column grid. Column count is 4 unless the workflow has fewer branches; do not use variable column counts — cap at 4.
- **Box sizing**: 340–420px width, 110–140px height. Gaps: X 56–70px, Y 90–100px.
- **Title**: Centered top, 90px from top edge.
- **Footer**: Optional 1-line patent disclaimer centered near bottom.
- **Text truncation**: titles ≤10 chars, sublabels ≤20 chars. Never let text overflow the box.

## Arrow Rules (critical; multiple past failures)
- Horizontal arrows run at the **vertical midline** of the source box (`y + BOX_H//2`), from right edge of column `i` to left edge of column `i+1`.
- Vertical arrows run at the **horizontal center** of a column (`col_x(c) + BOX_W//2`), from bottom edge of the top box (`y_top + BOX_H`) to top edge of the bottom box (`y_bottom`).
- Arrowhead orientation: `x2 > x1` → right-pointing; `x2 < x1` → left-pointing. Vertical: `y2 > y1` → down-pointing.
- Arrow line width: 5–6px. Arrowhead size: ~12–14px half-width/height.

## Source-Code → Flowchart Mapping
Workflow nodes are derived from the project source (e.g. `main.py`). Follow the actual function/module call hierarchy in the code, not an imagined workflow — one box per real, callable unit.

## Canonical patterns
Fix the box labels for a given figure **once**, write them down, and reuse that list verbatim for every re-render. Do not invent new labels or reorder columns between iterations — see `references/code-to-flowchart-mapping.md` for how to derive the label list from code.

## Outputs
1. `fig*_300dpi.png` per figure with embedded DPI metadata.
2. `专利流程图_300DPI.pptx` (WPS-compatible):
   - 16:9 slide size (13.333" × 7.5").
   - One slide per figure.
   - Centered title textbox (bold, ~0.37–0.40 inches), image scaled ~90–94% of slide below it.
3. Deliver on user Desktop under a dedicated folder (e.g., `Desktop/patents_flows/`).

## Pitfalls
- **Arrow offset**: horizontal arrows must be at `row_y + BOX_H//2`, not arbitrary Y. Vertical arrows must be at column center X, not left/right edges.
- **Text overflow**: labels truncated; do not blindly trust PIL text alignment.
- **Color leakage**: never use rainbow colormaps in flows. Pure (0,0,0) and (255,255,255).
- **Reading PNGs back without vision_analyze**: binary files can’t be viewed with text tools; use `vision_analyze` when the user shares path to inspect layout quality.

## References
- `references/patent-figure-spec.md` — official regulation summary for Chinese patent drawings.
- `references/code-to-flowchart-mapping.md` — deriving flowchart nodes, labels and branching patterns from a codebase.
- `references/patent-claim-audit.md` — methodology for auditing patent claims against code, identifying gaps, and applying targeted patches to achieve full claim coverage.

