A skill that reads an image of a withholding tax slip and returns it 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 (payment amount, withholding tax amount, etc.), generate structured data from the text
- If the text is insufficient (scanned PDF, etc.), use
shinkoku pdf to-image --file-path <path> --output-dir <dir>to convert to PNG and proceed to the following image reading flow
Image Reading Method
Recommended: Dual verification (two parallel contexts)
To improve accuracy, read the same image in two independent contexts in parallel and cross-check the results.
-
Perform two independent reads: In environments 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 cross-check: Compare the major fields (amounts, etc.) from both reading results.
-
If they match: Adopt as is. Report that "the results matched across two independent reads."
-
If they do not match: Present the original image path and both results to the user, and have them choose the correct one:
- Explicitly indicate the fields that differ
- Present three options: Adopt A / Adopt B / Manual input
Fallback (when subagents are not supported)
In environments 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 request visual confirmation
⚠ Since dual verification is unavailable, always request visual confirmation from the user.
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 provided, process them all in order and return them together
Output Format
Read the image and return it in the following format:
---WITHHOLDING_DATA---
payer_name: 支払者名
payment_amount: 支払金額(int)
withheld_tax: 源泉徴収税額(int)
social_insurance: 社会保険料等の金額(int)
life_insurance_deduction: 生命保険料の控除額(int)
earthquake_insurance_deduction: 地震保険料の控除額(int)
housing_loan_deduction: 住宅借入金等特別控除の額(int)
life_insurance_detail:
general_new: 一般の新保険料(int)
general_old: 一般の旧保険料(int)
medical_care: 介護医療保険料(int)
annuity_new: 個人年金の新保険料(int)
annuity_old: 個人年金の旧保険料(int)
---END---
Extraction points
- Extract the "Payment Amount" field (total salary income) with the highest priority
- Accurately read the "Withholding Tax Amount" field
- Read the "Social Insurance Premiums, etc. Amount" field
- For life insurance premium deductions, check the breakdown of the old and new systems and the 3 categories (general/nursing care medical/individual annuity)
- Extract earthquake insurance premium deductions and housing loan deductions only if they are stated
- Extract the payer's name (company name)
- Items that are not stated shall be 0
Processing multiple files
When multiple file paths are specified:
- Obtain the file list with the Glob tool (when a pattern is specified)
- Read each file in order with the Read tool
- Return the results of all files together (state the file name before each result)
## file1.jpg
---WITHHOLDING_DATA---
...
---END---
## file2.jpg
---WITHHOLDING_DATA---
...
---END---