ai-visual-accuracy-check
AIが、レンダリングされたHTMLと元のPDFページを比較し、視覚的な正確さを文脈に沿って判断、85%未満の場合はパイプラインを停止することで、品質を厳格にチェックするSkill。
📜 元の英語説明(参考)
Use AI to compare rendered HTML to original PDF page. AI makes contextual judgment about visual accuracy with explainable reasoning. BLOCKING quality gate - stops pipeline if score below 85%.
🇯🇵 日本人クリエイター向け解説
AIが、レンダリングされたHTMLと元のPDFページを比較し、視覚的な正確さを文脈に沿って判断、85%未満の場合はパイプラインを停止することで、品質を厳格にチェックするSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o ai-visual-accuracy-check.zip https://jpskill.com/download/16955.zip && unzip -o ai-visual-accuracy-check.zip && rm ai-visual-accuracy-check.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/16955.zip -OutFile "$d\ai-visual-accuracy-check.zip"; Expand-Archive "$d\ai-visual-accuracy-check.zip" -DestinationPath $d -Force; ri "$d\ai-visual-accuracy-check.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
ai-visual-accuracy-check.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
ai-visual-accuracy-checkフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
AI Visual Accuracy Check Skill
目的
これは、生成された HTML の視覚的な正確性を元の PDF ページと比較検証するために AI を使用する BLOCKING 品質ゲートです。ピクセルパーフェクトな比較とは異なり、AI は以下を理解します。
- 視覚的な階層とレイアウトの意図
- 文脈的な違い (ウェブレンダリング vs PDF)
- 読者が同様の体験を得られるかどうか
- CSS の制約と HTML の正確さの間のトレードオフ
AI は以下を提供します。
- 客観的な類似度スコア (0-100%)
- 評価基準ごとの内訳
- 指摘された特定の違い
- 明確な合格/不合格の推奨
- 決定の理由
これは、AI の文脈的な理解と 決定論的なゲーティング (継続するには 85 以上に合格する必要がある) を組み合わせたものです。
実施事項
-
入力ファイルをロードする
chapter_XX.html(生成された統合 HTML) を読み込む02_page_XX.png(元の PDF ページ画像) を読み込む
-
HTML を画像にレンダリングする
- ヘッドレスブラウザ (Playwright/Selenium) を使用して HTML を PNG としてレンダリングする
- フルページスクリーンショットをキャプチャする
- 比較のためにレンダリングされた画像を保存する
-
Claude を視覚的な比較で呼び出す
- 元の PDF PNG を画像 1 として添付する
- レンダリングされた HTML スクリーンショットを画像 2 として添付する
- 詳細な視覚的な比較をリクエストする
- 複数の基準でスコアリングするように AI に依頼する
-
AI の応答を解析する
- 全体的な類似度スコアを抽出する
- 基準固有のスコアを抽出する
- 指摘された違いを解析する
- 推奨 (PASS/FAIL) を取得する
-
比較レポートを保存する
- 以下に保存する:
output/chapter_XX/chapter_artifacts/ai_visual_accuracy.json - タイムスタンプ、使用された入力、AI モデルを含める
- 以下に保存する:
-
ゲートの決定を行う
- スコアが ≥ 85 の場合: PASS (終了コード 0, 継続)
- スコアが < 85 の場合: FAIL (終了コード 1, フックをトリガー)
入力パラメータ
html_file: <str> - chapter_XX.html へのパス
pdf_page_png: <str> - 元の PDF ページ PNG へのパス (複数ページの場合は複数)
output_dir: <str> - レポートのディレクトリ
chapter: <int> - 章番号 (レポート用)
book_pages: <str> - ページ範囲 (レポート用)
threshold: <float> - 合格するための最小スコア (デフォルト: 85.0)
AI プロンプトテンプレート
あなたは、生成された HTML ページの視覚的な正確性を元の PDF と比較検証しています。
元の PDF ページ:
[元の PDF ページの PNG 画像が添付されています]
生成された HTML (レンダリング):
[レンダリングされた HTML ページの PNG 画像が添付されています]
タスク:
これら 2 つの画像を比較し、HTML が PDF ページの視覚的な外観とレイアウトを正確に再現しているかどうかを判断してください。
評価基準:
1. レイアウトの一致 (40% の重み)
- ページ全体の構造が元のものと一致する
- セクションが正しい順序と位置にある
- 要素間の間隔が適切である
- ページの寸法/アスペクト比が類似している
2. 視覚的な階層 (30% の重み)
- 見出しが適切な重要度で目立つ
- セクション区切りが明確に表示される
- 強調 (太字、斜体) が保持されているか、同等のものになっている
- 要素間の視覚的な関係が明確である
3. コンテンツの配置 (20% の重み)
- 要素が正しく配置されている (左、中央、右)
- リストが適切な間隔でインデントされている
- 表/図が正しく配置および配置されている
- 段落のフローが元のものと一致する
4. タイポグラフィとスタイリング (10% の重み)
- フォントサイズが互いに対して正しい
- テキストのスタイリングが適切である (太字、斜体、大文字)
- カラースキームが保持されている (該当する場合)
- 全体的な読みやすさが同等以上である
スコアリングガイドライン:
各基準について:
- 90-100%: 優秀、問題なし
- 80-89%: 良好、わずかな外観の違い
- 70-79%: 許容範囲、目立つが重要ではない
- 70% 未満: 不良、重大な違い
重要なコンテキスト:
- ブラウザでの HTML レンダリングは PDF とわずかに異なる場合があります (間隔、フォント)
- ピクセルパーフェクトな一致ではなく、意図と読みやすさに焦点を当てる
- 小さな間隔/マージンの違い (2-5px) は許容範囲内です
- 階層が保持されていれば、フォントのレンダリングの違いは許容範囲内です
- ウェブレンダリングの制約は許容範囲内です (絶対的な PDF 配置はありません)
出力形式:
この正確な JSON 形式で分析を提供してください:
```json
{
"overall_score": 92.5,
"threshold": 85.0,
"recommendation": "PASS",
"criteria_analysis": {
"layout_match": {
"score": 94,
"feedback": "ページ全体の構造はよく一致しています。セクションの順序は正しく、間隔は適切です。"
},
"visual_hierarchy": {
"score": 90,
"feedback": "見出しは明確に区別されています。視覚的な関係は保持されています。わずかなフォントサイズの差異は許容範囲内です。"
},
"content_positioning": {
"score": 91,
"feedback": "要素の配置は正しいです。リストは適切にインデントされています。表は正しく配置されています。"
},
"typography_styling": {
"score": 88,
"feedback": "テキストのスタイリングは保持されています。太字と斜体の区別は明確です。読みやすさは優れています。"
}
},
"differences_noted": [
"段落の行の高さは PDF で 1.5 に対して 1.6 です (許容範囲内、読みやすさが向上します)",
"箇条書きリストのインデントは PDF で 15px に対して 20px です (許容範囲内、明確で読みやすい)"
],
"visual_fidelity_assessment": "EXCELLENT",
"confidence_level": 0.95,
"explanation": "HTML は PDF ページのレイアウトと視覚的な階層を正確に再現しています。すべての主要な要素が正しく配置されています。わずかな間隔とフォントの違いは、ウェブレンダリングの許容範囲内であり、実際には読みやすさを向上させています。",
"pass_fail_verdict": "PASS"
}
検証:
- 全体的なスコアは数値である必要があります (0-100)
- すべての基準にスコアが必要です
- 推奨は PASS または FAIL である必要があります
- 説明は明確で実行可能である必要があります
プロセスフロー
┌─ HTML と PNG をロード ──────────────────┐
│ • chapter_XX.html │
│ • 02_page_XX.png │
└────────┬────────────────────────────┘
│
▼
┌─ HTML を PNG にレンダリング ───────────────┐
│ • ヘッドレスブラウザ │
│ • フルページスクリーンショット │
│ • 一時的な場所に保存 │
└────────┬────────────────────────────┘
│
▼
┌─ Claude API を呼び出す ────────────────┐
│ • 元の PDF PNG を送信 │
│ • レンダリングされた HTML PNG
(原文がここで切り詰められています) 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
AI Visual Accuracy Check Skill
Purpose
This is a BLOCKING quality gate that uses AI to validate visual accuracy of generated HTML against the original PDF page. Unlike pixel-perfect comparison, AI understands:
- Visual hierarchy and layout intent
- Contextual differences (web rendering vs PDF)
- Whether readers would have similar experience
- Trade-offs between CSS limitations and HTML accuracy
The AI provides:
- Objective similarity score (0-100%)
- Breakdown by evaluation criteria
- Specific differences noted
- Clear pass/fail recommendation
- Explanation for decisions
This combines AI's contextual understanding with deterministic gating (must pass 85+ to continue).
What to Do
-
Load input files
- Read
chapter_XX.html(generated consolidated HTML) - Read
02_page_XX.png(original PDF page image)
- Read
-
Render HTML to image
- Use headless browser (Playwright/Selenium) to render HTML as PNG
- Capture full page screenshot
- Save rendered image for comparison
-
Invoke Claude with visual comparison
- Attach original PDF PNG as image 1
- Attach rendered HTML screenshot as image 2
- Request detailed visual comparison
- Ask AI to score on multiple criteria
-
Parse AI response
- Extract overall similarity score
- Extract criterion-specific scores
- Parse differences noted
- Get recommendation (PASS/FAIL)
-
Save comparison report
- Save to:
output/chapter_XX/chapter_artifacts/ai_visual_accuracy.json - Include timestamp, inputs used, AI model
- Save to:
-
Make gate decision
- If score ≥ 85: PASS (exit code 0, continue)
- If score < 85: FAIL (exit code 1, trigger hook)
Input Parameters
html_file: <str> - Path to chapter_XX.html
pdf_page_png: <str> - Path to original PDF page PNG (or multiple for multi-page)
output_dir: <str> - Directory for report
chapter: <int> - Chapter number (for reporting)
book_pages: <str> - Page range (for reporting)
threshold: <float> - Minimum score to pass (default: 85.0)
AI Prompt Template
You are validating the visual accuracy of a generated HTML page against the original PDF.
ORIGINAL PDF PAGE:
[PNG Image of original PDF page attached]
GENERATED HTML (Rendered):
[PNG Image of rendered HTML page attached]
TASK:
Compare these two images and determine if the HTML accurately recreates the visual appearance and layout of the PDF page.
EVALUATION CRITERIA:
1. Layout Match (40% weight)
- Overall page structure matches original
- Sections in correct order and position
- Spacing between elements appropriate
- Page dimensions/aspect ratio similar
2. Visual Hierarchy (30% weight)
- Headings stand out with appropriate prominence
- Section breaks clearly visible
- Emphasis (bold, italic) preserved or equivalent
- Visual relationships between elements clear
3. Content Positioning (20% weight)
- Elements aligned correctly (left, center, right)
- Lists indented with proper spacing
- Tables/exhibits positioned and aligned correctly
- Paragraph flow matches original
4. Typography & Styling (10% weight)
- Font sizes relative to each other correct
- Text styling appropriate (bold, italic, caps)
- Color scheme preserved (if applicable)
- Overall readability equivalent or better
SCORING GUIDELINES:
For each criterion:
- 90-100%: Excellent, no issues
- 80-89%: Good, minor cosmetic differences
- 70-79%: Acceptable, noticeable but not critical
- Below 70%: Poor, significant differences
IMPORTANT CONTEXT:
- HTML rendering in browser may differ slightly from PDF (spacing, fonts)
- Focus on INTENT and READABILITY, not pixel-perfect match
- Small spacing/margin differences (2-5px) are acceptable
- Font rendering differences are acceptable if hierarchy preserved
- Web rendering constraints are acceptable (no absolute PDF positioning)
OUTPUT FORMAT:
Provide your analysis in this exact JSON format:
```json
{
"overall_score": 92.5,
"threshold": 85.0,
"recommendation": "PASS",
"criteria_analysis": {
"layout_match": {
"score": 94,
"feedback": "Overall page structure matches well. Section order correct, spacing appropriate."
},
"visual_hierarchy": {
"score": 90,
"feedback": "Headings clearly distinguished. Visual relationships preserved. Minor font size variance acceptable."
},
"content_positioning": {
"score": 91,
"feedback": "Element alignment correct. Lists properly indented. Tables positioned correctly."
},
"typography_styling": {
"score": 88,
"feedback": "Text styling preserved. Bold and italic distinctions clear. Readability excellent."
}
},
"differences_noted": [
"Paragraph line-height 1.6 vs 1.5 in PDF (acceptable, improves readability)",
"Bullet list indentation 20px vs 15px in PDF (acceptable, clear and readable)"
],
"visual_fidelity_assessment": "EXCELLENT",
"confidence_level": 0.95,
"explanation": "The HTML accurately recreates the PDF page layout and visual hierarchy. All major elements are positioned correctly. Minor spacing and font differences are within acceptable tolerances for web rendering and actually improve readability.",
"pass_fail_verdict": "PASS"
}
VALIDATION:
- Overall score must be numeric (0-100)
- All criteria must have scores
- Recommendation must be PASS or FAIL
- Explanation must be clear and actionable
Process Flow
┌─ Load HTML & PNG ──────────────────┐
│ • chapter_XX.html │
│ • 02_page_XX.png │
└────────┬────────────────────────────┘
│
▼
┌─ Render HTML to PNG ───────────────┐
│ • Headless browser │
│ • Full page screenshot │
│ • Save to temp location │
└────────┬────────────────────────────┘
│
▼
┌─ Invoke Claude API ────────────────┐
│ • Send original PDF PNG │
│ • Send rendered HTML PNG │
│ • Multi-modal comparison prompt │
│ • Request JSON response │
└────────┬────────────────────────────┘
│
▼
┌─ Parse & Save Report ──────────────┐
│ • Extract JSON from response │
│ • Validate score 0-100 │
│ • Save to JSON file │
└────────┬────────────────────────────┘
│
▼
┌─ Gate Decision ────────────────────┐
│ • If score ≥ 85: PASS │
│ • If score < 85: FAIL │
└────────┬────────────────────────────┘
│
▼
Exit with code 0 or 1
Output File Format
Path: output/chapter_XX/chapter_artifacts/ai_visual_accuracy.json
{
"chapter": 2,
"book_pages": "16-29",
"validation_type": "ai_visual_accuracy",
"validation_timestamp": "2025-11-08T14:45:00Z",
"overall_score": 92.5,
"threshold": 85.0,
"status": "PASS",
"ai_model": "claude-3-5-sonnet-20241022",
"inputs": {
"html_file": "chapter_02.html",
"original_pdf_png": "02_page_16.png",
"rendered_html_png": "rendered_chapter_02.png"
},
"criteria_scores": {
"layout_match": 94,
"visual_hierarchy": 90,
"content_positioning": 91,
"typography_styling": 88
},
"differences": [
"Paragraph line-height 1.6 vs 1.5 in PDF (acceptable)",
"Bullet list indentation 20px vs 15px in PDF (acceptable)"
],
"visual_fidelity": "EXCELLENT",
"confidence": 0.95,
"explanation": "The HTML accurately recreates the PDF page layout and visual hierarchy...",
"recommendation": "PASS",
"notes": "All criteria well within acceptable ranges. Minor web rendering differences do not impact readability or intent."
}
Multi-Page Chapters
For chapters spanning multiple pages:
-
Option A: Compare key pages
- Compare opening page (establishes style)
- Compare middle pages (continuation pages)
- Compare final pages (consistency check)
- Average scores across pages
-
Option B: Compare consolidated view
- Render full consolidated chapter
- Compare overall structure
- Spot-check specific pages visually
Approach: Use Option A for thorough validation
- Score each page separately (0-100)
- Average to get overall score
- Report per-page breakdown
Gate Decision Threshold
Score ≥ 85: PASS → Continue to deployment
Score < 85: FAIL → Trigger hook, block pipeline
Interpretation:
90-100: Excellent, no concerns
85-89: Good, minor cosmetic differences acceptable
< 85: Requires review and likely fixes
Error Handling
If HTML rendering fails:
- Log error with details
- Try alternative rendering method
- Escalate if both fail
If AI response is invalid JSON:
- Request retry
- Fall back to text parsing if needed
- Escalate if repeated failures
If score seems wrong (too high/low):
- AI's judgment takes precedence
- Trust AI's contextual understanding
- Log for future analysis
If original PNG is missing:
- Use reference page from PDF directly
- Or extract from PDF again
- Proceed with best available image
Quality Checks
Before saving report:
-
Score validity
- [ ] Overall score 0-100
- [ ] All criteria scores 0-100
- [ ] Scores reasonable and justified
-
Report completeness
- [ ] All criteria included
- [ ] Differences documented
- [ ] Explanation provided
- [ ] Recommendation clear
-
AI reasoning
- [ ] Explanation matches score
- [ ] Differences explain score deductions
- [ ] Confidence level appropriate
Success Criteria
✓ Visual accuracy report generated successfully ✓ Overall score calculated and justified ✓ All criteria scored and explained ✓ Differences clearly documented ✓ Pass/fail decision clear ✓ Exit code 0 if PASS, 1 if FAIL ✓ Report saved in JSON format
Next Steps After PASS
If validation passes (score ≥ 85):
- Gate decision: PASS
- Continue to deployment approval
- Chapter ready for production
Next Steps After FAIL
If validation fails (score < 85):
- PIPELINE STOPS
- Hook
calypso-visual-accuracy.shtriggered - User receives report with visual comparison details
- Options:
- Review differences and re-generate
- Adjust CSS styling
- Lower threshold if differences acceptable
- Manual override if justified
Design Notes
- This skill is AI-powered (probabilistic)
- Uses visual reasoning (not pixel-diff)
- Makes contextual judgments (understands intent)
- Provides explainable decisions (clear reasoning)
- Acts as BLOCKING gate (score must pass threshold)
- Part of quality assurance (ensures visual accuracy)
Testing
To test AI visual accuracy:
# Generate chapter HTML (previous steps)
# Render to PNG
# Compare with original PDF
# Expected behavior:
# - AI compares images
# - Scores layout, hierarchy, positioning, typography
# - Generates report with score and explanation
# - Returns PASS (score ≥ 85) or FAIL (score < 85)
Key Advantage Over Python Pixel-Diff
| Aspect | Python Pixel-Diff | AI Visual Comparison |
|---|---|---|
| Understanding | Detects changes | Understands intent |
| Flexibility | Exact match required | Accepts valid variations |
| Explanation | Pixel coordinates | Semantic feedback |
| Tolerance | Binary (match/no match) | Graduated (85%+ acceptable) |
| Context | No context | Full visual context |
| Human-like | No | Yes, like QA reviewer |
AI visual accuracy validation is smarter and more human-like than pixel-perfect comparison.