A skill that reads invoice images and returns them as structured data.
For PDF files
The file is PDF (.pdf), attempt text extraction before image OCR.
shinkoku pdf extract-text --file-path <path>Run- If the extracted text contains the necessary information (amount, date, billing source, etc.), generate structured data from the text.
- If the text is insufficient (scanned PDF, etc.), convert to PNG with
shinkoku pdf to-image --file-path <path> --output-dir <dir>and proceed to the image reading flow below.
Image Reading Method
Recommended: Dual verification (2 parallel contexts)
To improve accuracy, read the same image in two independent contexts in parallel and compare the results.
-
Run two independent readings: In an environment where subagents are available, launch two subagents in parallel, each reading the image independently. Pass the following "Basic Rules" and "Output Format" to each subagent as a prompt, and specify the image file path.
-
Result comparison: Compare the key fields (amount, etc.) from both reading results.
-
If they match: Adopt them as is. Report that "the results matched in two independent readings."
-
If they do not match: Present the original image path and both results to the user, and ask them to choose the correct one:
- Clearly indicate the fields with discrepancies
- Present three choices: Adopt A / Adopt B / Manual input
Fallback (when subagents are not supported)
In an environment where subagents are unavailable, read using the following procedure:
- Read the image file directly with the Read tool
- Extract data according to the following "Basic Rules" and "Output Format"
- Present the extraction results to the user andalways ask them to visually verify
⚠ Because dual verification is unavailable, always ask the user to visually verify.
Basic Rules
- Read image files with the Read tool (Claude Vision automatically recognizes images)
- Always return amounts as int (integer in yen). Remove commas and "円"
- Return dates in YYYY-MM-DD format
- Convert Japanese era names to Gregorian years (Reiwa 7 → 2025, Reiwa 6 → 2024, Heisei 31 → 2019)
- For fields that cannot be read, use UNKNOWN (string) or 0 (amount)
- If multiple files are passed, process all of them in order and return them together
Output Format
Read the image and return it in the following 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---
Extraction points
- Extract the total invoice amount (tax included) with the highest priority
- Check the consumption tax amount (distinguish between the 10% and 8% reduced tax rate categories if present)
- Check for the presence of an invoice number (T + 13-digit qualified invoice issuer registration number)
- If there is an invoice number, extract it
- Extract the name of the vendor (billing source)
- Use the billing date for the date (if the issue date and billing date differ, prioritize the billing date)
- Extract line items to the extent they can be read (if unknown, leave items empty)
Processing multiple files
When multiple file paths are specified:
- Get the file list with the Glob tool (if a pattern is specified)
- Read each file in order with the Read tool
- Return the results of all files together (write the file name before each result)
## file1.jpg
---INVOICE_DATA---
...
---END---
## file2.jpg
---INVOICE_DATA---
...
---END---