craft-manual
Generate a user manual from a running web app: content-cropped screenshots, selector annotations, HTML plus PDF build with QA gates, plus optional status-labeled feature tables, business rules, route appendix, demo disclosure. Use for user manual, guide book, panduan pengguna, project doc, end-user docs with screenshots, PDF guide.
- License 许可
- MIT
- 最近更新
- 2026-11-05
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- craft-manual
- description
- Generate a user manual from a running web app: content-cropped screenshots, selector annotations, HTML plus PDF build with QA gates, plus optional status-labeled feature tables, business rules, route appendix, demo disclosure. Use for user manual, guide book, panduan pengguna, project doc, end-user docs with screenshots, PDF guide.
02 资源文件 8
- 参考文档agents/openai.yaml115 B
- 资产文件assets/print.css601 B
- 资产文件assets/template.html1.6 KB
- 参考文档CREDITS.md737 B
- 参考文档fixture/demo-page.html774 B
- 参考文档fixture/manual.json1.1 KB
- 脚本scripts/manual45.3 KB
- 脚本scripts/package.json233 B
03 SKILL.md 正文
User manual
Generate a user manual (guide book, panduan pengguna) from a running web app: deterministic screenshots cropped to content, selector-based annotations, and an HTML plus PDF build that fails on blank screenshots, orphan captions, or stale captures. Optional content blocks prove the product behind the clicks: status-labeled feature tables, business rules with enforcement sites, a route appendix, and a demo disclosure. Use when asked for a user manual, guide book, project doc, end-user documentation with screenshots, or a PDF guide.
One command regenerates everything: scripts/manual build. The build fails (nonzero exit plus the shot id, page, and percentage) instead of shipping a manual with long blank areas.
Manifest
One manual.json defines chapters, steps, and shots. A shot names a content target, never a viewport dump:
{
"app": { "name": "Shop", "baseUrl": "http://localhost:3000", "locale": "id" },
"shots": [
{
"id": "c10-done", "route": "/checkout/done", "target": "main",
"viewport": "mobile", "hide": ["header.site", ".toast"],
"annotations": [{ "n": 1, "selector": "[data-manual=receipt]", "label": "Nomor struk" }]
}
],
"chapters": [{ "title": "Pelanggan", "steps": [{ "n": 1, "title": "Selesai", "body": "...", "shot": "c10-done" }] }]
}
File names equal shot ids, no combined suffixes. A sequence id groups shots that run in manifest order on one page: later shots inherit earlier state unless they set their own route. --only <id> rebuilds one shot. Actions are Playwright ops (goto, click, fill, select, press, wait, waitFor, eval, scroll); a shot with a live clock takes freezeClock (ISO time) so two builds byte-match.
Capture
The target selector is captured (locator.screenshot() or the union clip of visible boxes inside it), never the full viewport or full page. Each shot runs in a fresh browser context (clean localStorage), reducedMotion, DPR 2; shots in one sequence share a context and run in order instead. Exploration may use agent-browser; regeneration always runs the bundled script, or two runs would never match. Presets: mobile (390x844), desktop (1440x900). Elements with position: fixed or sticky outside the target are hidden unless listed in keep; dialogs capture with their scrim, cropped to dialog plus margin.
Trim and QA gates
After capture, uniform edge rows and columns are trimmed to a fixed 16px CSS margin; the background color is read from the edge pixels, never hardcoded. Then the blank band is measured inside the content box (union of visible descendants, clipped to the target), not the target padding: padding owned by the target is a design decision, interior gaps are normal typography, and the gate hunts the leading or trailing canvas dump. The build fails when:
- A content edge band exceeds 15 percent of content height (
allowBlankper shot with a written reason overrides). - An annotation selector is missing or its box falls outside the crop.
- Any image in the built HTML fails to load (shot id reported).
- A figure taller than a print page (checked in Chromium with print media). Print CSS caps figure art at 225mm so whole figures ride to the next page instead of splitting;
break-inside: avoidkeeps each caption with its figure. - A print page under 40 percent full that is not a chapter end (warning, with page number and coverage).
- A shot reused without
"reuse": trueon the step (declared reuse is reported, silent duplication fails). - Any output exceeds its budget (PDF over 15 MB).
manual checkfinds commits touching the configured UI paths after the capture SHA (stale captures listed per shot).
Annotations
Boxes are { n, selector, label, pad? } resolved with boundingBox() at capture time, stored relative to the crop in a sidecar JSON. Boxes are measured before the screenshot on the same scroll position, and the screenshot origin (the target box) is subtracted, so boxes track their selectors. No hand-written pixel coordinates in the manifest, ever. manual verify re-checks every box against the live app (IoU >= 0.5, same viewport and visibility as capture), so drifted boxes fail instead of shipping.
Build
HTML frames follow the cropped image (phone frame for mobile, desktop frame for desktop), never a forced viewport ratio. Figures keep captions together (break-inside: avoid). Locales id and en switch template labels (Langkah, Tips, page X of Y, contents). Shots reused across steps declare "reuse": true on the reusing step. Two runs at the same commit produce the same file set. Every figure carries an <!-- SHOT id | route | actions --> trace comment.
Freshness
The manifest records the app commit SHA and the UI source paths at capture. manual check fails when any commit touches those paths after the SHA and names the affected shots. Wire it into CI.
Content blocks (optional, from the Linkbook case)
Screenshots prove the clicks. Four content blocks prove the product behind them. Declare any of them in the manifest. Each block is optional and each carries one QA rule.
- Feature table (
features): one row per feature. Each row states the claim, the proof, and the status. Status labels are closed: Selesai, Prototipe, Belum ada UI, Di luar MVP. Each Selesai row names its proof (commit SHA, route, endpoint, or test file). - Business rules (
rules): one row per rule. Each row states the rule, how it works, and where enforcement lives (server, client, manual ops). Server enforced beats client claimed. Say which one. - Route appendix (
routes): one row per route (address, name, user), generated from the app route table. - Demo disclosure (
demo): one block stating what is sample data, what is offline, and what cannot be done in demo mode.
QA: a Selesai row with no proof fails the build. An unknown status label fails the build. A rule with no enforcement site fails the build. A chapter step referencing a route missing from the table fails the build. A manifest with demo: true and no disclosure block fails the build. A feature repeated across chapters declares "reuse": true like shots do.
Review
After the build, open review.html: every final shot with its blank ratio and print page, sorted worst first, plus the must-watch list (top blank ratios, most annotations, shots changed since the last build). The agent views the must-watch shots before calling the manual done. Gate numbers alone are never enough.
Acceptance (fixture-local)
Verify with the shipped fixture only, never a live consumer repo: run node scripts/manual selftest (no browser needed; trim, measure, and QA gates) and build the preview from fixture/demo-page.html with fixture/manual.json in this skill dir. review.html and all proof generate locally from that fixture. Origin story stays in CREDITS.md; it is not a test target.
04 同仓库更多 Skills
whips
Route any non-trivial task through one entry: match a playbook, drive HIT skills plus subagents, open a reviewed ready PR with ship-pr-shaped evidence.
verify-upkeep
Periodic upkeep for a project's verification skill: source wave plus live pass per feature, at most one PR of proven corrections. Use to audit the verify skill.
verify-statechart
Check a TLA+ model of a system that moves between states, such as a product flow, a protocol, or a service, and draw it as a Mermaid statechart. The report gives the shortest path to each state that breaks a rule. Use to show a bug as a path through states.
verify-new
Generate a project-local skill that drives the app like a user (launch, doctor, drive, evidence, feature map), proven once. Use when a project has no scripted proof.
ship-triage
Move issues and external PRs through a state machine of triage roles, categorise, verify, interview if needed, and write agent-ready briefs.
ship-runner
Run ready-for-agent issue queues on any schedule through /whips intake, one fresh worktree each, landing per risk tier, with the agent and model you pick at setup.