reading-invoice

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

請求書 画像読み取り

Invoice Image Reading

請求書の画像を読み取り、構造化データとして返すスキル。
A skill that reads invoice images and returns them as structured data.

画像読み取り方法

Image Reading Methods

推奨: デュアル検証(並列2コンテキスト)

Recommended: Dual Verification (Parallel Two Contexts)

精度を高めるため、同じ画像を2つの独立したコンテキストで並列に読み取り、結果を照合する。
  1. 2つの独立した読み取りを実行する: サブエージェントが使える環境では、2つのサブエージェントを並列で起動し、それぞれ独立に画像を読み取る。 各サブエージェントには以下の「基本ルール」と「出力フォーマット」をプロンプトとして渡し、画像ファイルパスを指定する。
  2. 結果照合: 両方の読み取り結果から主要フィールド(金額等)を比較する。
  3. 一致の場合: そのまま採用。「2つの独立した読み取りで結果が一致しました」と報告する。
  4. 不一致の場合: ユーザーに元画像パスと両方の結果を提示し、正しい方を選択してもらう:
    • 差異のあるフィールドを明示する
    • A を採用 / B を採用 / 手動入力 の3択を提示する
To improve accuracy, read the same image in two independent contexts in parallel and collate the results.
  1. Execute two independent readings: In environments where sub-agents are available, launch two sub-agents in parallel and have each read the image independently. Pass the following "Basic Rules" and "Output Format" as prompts to each sub-agent, and specify the image file path.
  2. Result collation: Compare key fields (such as amounts) from both reading results.
  3. If results match: Adopt the results as-is. Report "Results matched in two independent readings."
  4. If results do not match: Present the original image path and both results to the user, and ask them to select the correct one:
    • Clearly indicate fields with discrepancies
    • Offer three options: Adopt A / Adopt B / Manual input

フォールバック(サブエージェント非対応の場合)

Fallback (When Sub-Agents Are Not Supported)

サブエージェントが利用できない環境では、以下の手順で読み取る:
  1. 画像ファイルを直接 Read ツールで読み取る
  2. 以下の「基本ルール」と「出力フォーマット」に従ってデータを抽出する
  3. 抽出結果をユーザーに提示し、必ず目視確認を依頼する
⚠ デュアル検証が利用できないため、必ずユーザーに目視確認を依頼してください。
In environments where sub-agents are not available, follow these steps to read the image:
  1. Read the image file directly using the Read tool
  2. Extract data according to the "Basic Rules" and "Output Format" below
  3. Present the extraction results to the user and always request visual confirmation
⚠ Since dual verification is not available, always request visual confirmation from the user.

基本ルール

Basic Rules

  • 画像ファイルは Read ツールで読み取る(Claude Vision が自動的に画像を認識する)
  • 金額は必ず int(円単位の整数)で返す。カンマや「円」は除去する
  • 日付は YYYY-MM-DD 形式で返す
  • 和暦は西暦に変換する(令和7年 → 2025、令和6年 → 2024、平成31年 → 2019)
  • 読み取れないフィールドは UNKNOWN(文字列)または 0(金額)とする
  • 複数ファイルを渡された場合は全て順に処理してまとめて返す
  • Read image files using the Read tool (Claude Vision automatically recognizes images)
  • Amounts must always be returned as int (integer in yen). Remove commas and the word "yen"
  • Dates must be returned in YYYY-MM-DD format
  • Convert Japanese calendar years to Western calendar (Reiwa 7 → 2025, Reiwa 6 → 2024, Heisei 31 → 2019)
  • For unreadable fields, use UNKNOWN (string) or 0 (amount)
  • If multiple files are provided, process all of them in sequence and return the combined results

出力フォーマット

Output Format

画像を読み取り、以下の形式で返す:
---INVOICE_DATA---
vendor: 請求元名
invoice_number: 請求書番号
invoice_registration_number: 適格請求書発行事業者番号(T+13桁)
date: YYYY-MM-DD
total_amount: 請求金額合計(int)
tax_amount: 消費税額(int)
items:
  - description: 品目・サービス名
    amount: 金額(int)
    quantity: 数量(int)
    tax_rate: 税率(10 or 8)
---END---
Read the image and return it in the following format:
---INVOICE_DATA---
vendor: Vendor name
invoice_number: Invoice number
invoice_registration_number: Qualified invoice issuer number (T+13 digits)
date: YYYY-MM-DD
total_amount: Total invoice amount (int)
tax_amount: Consumption tax amount (int)
items:
  - description: Item/service name
    amount: Amount (int)
    quantity: Quantity (int)
    tax_rate: Tax rate (10 or 8)
---END---

抽出のポイント

Extraction Points

  • 請求金額の合計(税込)を最優先で抽出する
  • 消費税額を確認する(10% と 8% 軽減税率の区分があれば区別する)
  • インボイス番号(T+13桁の適格請求書発行事業者登録番号)の有無を確認する
  • 請求書番号がある場合は抽出する
  • 請求元(vendor)の名称を抽出する
  • 日付は請求日を使用する(発行日と請求日が異なる場合は請求日を優先)
  • 明細行は読み取れる範囲で抽出する(不明な場合は items を空にする)
  • Prioritize extracting the total invoice amount (tax-inclusive)
  • Confirm the consumption tax amount (distinguish between 10% and 8% reduced tax rates if applicable)
  • Check for the presence of an invoice registration number (T+13 digits for qualified invoice issuers)
  • Extract the invoice number if available
  • Extract the vendor name
  • Use the invoice date for the date field (prioritize the invoice date if the issue date and invoice date differ)
  • Extract line items to the extent readable (leave items empty if unknown)

複数ファイルの処理

Processing Multiple Files

複数のファイルパスが指示された場合:
  1. Glob ツールでファイル一覧を取得する(パターンが指示された場合)
  2. 各ファイルを Read ツールで順に読み取る
  3. 全ファイルの結果をまとめて返す(各結果の前にファイル名を記載する)
undefined
When multiple file paths are specified:
  1. Use the Glob tool to retrieve the file list (if a pattern is specified)
  2. Read each file sequentially using the Read tool
  3. Return the combined results of all files (include the file name before each result)
undefined

file1.jpg

file1.jpg

---INVOICE_DATA--- ... ---END---
---INVOICE_DATA--- ... ---END---

file2.jpg

file2.jpg

---INVOICE_DATA--- ... ---END---
undefined
---INVOICE_DATA--- ... ---END---
undefined