SuperAPI AI Directory

reading-deduction-cert

General & other

View repository

Updated 10-15 20:07

About this skill

Deduction Certificate Image Reading

A skill that reads images of deduction certificates (life insurance premium deduction certificates, earthquake insurance premium deduction certificates, social insurance premium deduction certificates, etc.) and returns them as structured data.

For PDF files

The file is PDF (.pdf), attempt text extraction before image OCR.

  1. shinkoku pdf extract-text --file-path <path> Run
  2. If the extracted text contains the necessary information (premium amount, certified amount, etc.), generate structured data from the text.
  3. If the text is insufficient (scanned PDF, etc.), shinkoku pdf to-image --file-path <path> --output-dir <dir> convert to PNG 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 cross-check the results.

  1. Perform two independent readings: In environments where subagents are available, launch two subagents in parallel and have each read the image independently. Pass the following "Basic Rules" and "Output Format" to each subagent as a prompt, and specify the image file path.

  2. Result cross-check: Compare the main fields (amounts, etc.) from both reading results.

  3. If they match: Adopt as is. Report that "the results matched in two independent readings."

  4. If they do not match: Present the original image path and both results to the user, and have them select the correct one:

    • Clearly indicate the fields with discrepancies
    • 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:

  1. Read the image file directly with the Read tool
  2. Extract data according to the following "Basic Rules" and "Output Format"
  3. 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 years to Western years (Reiwa 7 → 2025, Reiwa 6 → 2024, Heisei 31 → 2019)
  • Use UNKNOWN (string) or 0 (amount) for fields that cannot be read

Target Documents

  • Life Insurance Premium Deduction Certificate
  • Earthquake Insurance Premium Deduction Certificate
  • Social Insurance Premium (National Pension Insurance Premium) Deduction Certificate
  • Small Enterprise Mutual Aid etc. Installment Payment Certificate (including iDeCo)

Output Format

Return as a JSON object. Amounts must always be int (integer in yen).

Life Insurance Premium Deduction Certificate

{
  "certificate_type": "life_insurance",
  "policy_type": "新制度 or 旧制度",
  "category": "一般 or 介護医療 or 個人年金",
  "company_name": "保険会社名",
  "policy_number": "証券番号",
  "annual_premium": 120000,
  "dividend": 0
}

Earthquake Insurance Premium Deduction Certificate

{
  "certificate_type": "earthquake_insurance",
  "company_name": "保険会社名",
  "policy_number": "証券番号",
  "annual_premium": 50000,
  "is_old_long_term": false
}

Social Insurance Premium Deduction Certificate

{
  "certificate_type": "social_insurance",
  "insurance_type": "national_pension",
  "annual_premium": 200000,
  "period": "対象期間"
}

Small Enterprise Mutual Aid etc. Installment Payment Certificate

{
  "certificate_type": "small_business_mutual_aid",
  "sub_type": "ideco or small_business or disability",
  "annual_contribution": 276000
}

Extraction Points

  • First determine the document type (life insurance premium/earthquake insurance premium/social insurance premium/small enterprise mutual aid etc.)
  • For life insurance premium deduction, check the distinction between the old and new systems, and the classification into 3 categories (general/nursing care medical/individual pension)
  • For earthquake insurance premium deduction, check whether it is old long-term casualty insurance
  • If the amounts for 'certified amount' and 'declared amount' differ, use the 'declared amount'
  • Extract the insurance company name and policy number for verification