receipt-ocr-sorter

Automatically OCR, rename, and sort receipt images/PDFs/videos by date, amount, and project, with summary reports and D365 expense mapping. Use when sorting receipts, organizing expense files, OCR renaming, receipt sorting, レシート仕分け, or D365経費カテゴリマッピング.

11 stars

Best use case

receipt-ocr-sorter is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Automatically OCR, rename, and sort receipt images/PDFs/videos by date, amount, and project, with summary reports and D365 expense mapping. Use when sorting receipts, organizing expense files, OCR renaming, receipt sorting, レシート仕分け, or D365経費カテゴリマッピング.

Teams using receipt-ocr-sorter should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/receipt-ocr-sorter/SKILL.md --create-dirs "https://raw.githubusercontent.com/aktsmm/Agent-Skills/main/receipt-ocr-sorter/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/receipt-ocr-sorter/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How receipt-ocr-sorter Compares

Feature / Agentreceipt-ocr-sorterStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Automatically OCR, rename, and sort receipt images/PDFs/videos by date, amount, and project, with summary reports and D365 expense mapping. Use when sorting receipts, organizing expense files, OCR renaming, receipt sorting, レシート仕分け, or D365経費カテゴリマッピング.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Receipt OCR Sorter

OCR(Surya)を使った領収書の自動仕分け・リネーム・集計ツール。

## When to Use

- **領収書を仕分けて**, **レシートを整理して**, **receipt sorting**
- フォルダ内の領収書画像をプロジェクト単位で自動整理したい
- 大量のレシート写真に日付・金額・用途でファイル名を付けたい
- 出張経費の領収書を一括でリネーム&集計したい

## Core Workflow

1. 入力フォルダの画像 / PDF / ZIP / 動画を受け取る
2. OCR で日付・金額・国・カード・用途を抽出する
3. 品質補正をかけて標準ファイル名へ正規化する
4. プロジェクト単位で仕分ける
5. Markdown サマリーを出す

## Architecture

```
入力フォルダ(incoming/unassigned 等)
  │
  ├─ JPEG/PNG/PDF/ZIP → OCR → 抽出 → リネーム → PJフォルダへ移動
  ├─ MP4/MOV → ffmpeg → JPG → OCR → ...
  │
  ├─ カード不明 or テキスト不可 → 未分類フォルダ → 再仕分け可能
  │
  └─ 個人経費(D365対象外) → PJフォルダ/private/
```

> **`private/` フォルダ**: D365 に申請しない個人経費レシートを格納する。OCR後にユーザーが「個人経費」と判断した場合に移動する。

## Naming Convention

```
YYYY-MM-DD-国コード-金額[-カード]-分類.ext

例:
  2026-02-09-jpn-14320-amex-shinkansen.jpeg
  2026-02-11-us-272-amex-hotel.jpeg
  2026-02-12-us-190.38-meal.jpeg        ← カードなし
  2026-02-09-us-6.80-amex-meal-starbucks.jpeg
```

国コード一覧、分類一覧、D365 カテゴリ対応、添付手順は [references/d365-expense-guide.md](references/d365-expense-guide.md) を参照。

## CLI Usage

```powershell
# Dry-run(確認のみ、ファイル移動なし)
python receipt_sorter.py --project "202602_Domestic_Trip" --dry-run

# 本実行
python receipt_sorter.py --project "202602_Domestic_Trip" --input "incoming\unassigned"

# ログ指定
python receipt_sorter.py --project "202602_Domestic_Trip" --input "incoming\unassigned" --log "result.csv"
```

### Options

| オプション  | 説明                         | デフォルト                                            |
| ----------- | ---------------------------- | ----------------------------------------------------- |
| `--project` | 出力PJフォルダ名(必須)     | -                                                     |
| `--input`   | 入力フォルダ                 | `incoming/unassigned/`                                |
| `--dry-run` | ファイル移動せず結果のみ表示 | false                                                 |
| `--log`     | 結果CSVパス                  | `<PJフォルダ>/csv/<PJ名>_dryrun.csv` or `_result.csv` |

## Markdown Summary Output

本実行後、PJフォルダに `<PJ名>_summary.md` が自動生成される。

含む内容:

- プロジェクト合計(通貨混在・参考値)
- 国コード別合計テーブル
- 日付×国コード別合計テーブル
- 全明細テーブル(日付・国・金額・カード・分類・日本語概要・ファイル名)

## Intake Pattern

- 未分類の生ファイルは、workspace root ではなく専用の intake folder に集約する
- 例: `incoming/unassigned/`
- 案件が確定しているファイルは、intake folder を経由せず project folder へ直接入れてよい
- dry-run 用のコピーや検証入力は一時フォルダで扱い、完了後に削除する

## Setup

→ **[references/setup-guide.md](references/setup-guide.md)**

## Script Reference

→ **[references/receipt_sorter.py](references/receipt_sorter.py)**

## D365 Expense Integration

OCR 後のファイルを D365 Expense に添付する運用はこの skill の重要ユースケースだが、カテゴリ表と添付手順は本体から分離する。

- カテゴリ対応表
- 添付 / 差し替え手順
- 添付時の照合ルール
- ブラウザ操作の注意

詳細は [references/d365-expense-guide.md](references/d365-expense-guide.md) を参照。

## Known Limitations

- OCRの精度はSuryaモデルに依存(手書きや歪みが大きい領収書は誤読あり)
- 金額は最大候補を採用するが、複数明細のあるレシートでは個別明細は取れない
- **金額連結誤読**: OCRが改行をまたいで数字を結合し巨大整数を返すことがある(例: `14520` + `300` → `14520300`)。上限チェック(500万超は除外)で防御しているが、完全ではない
- 動画は中間フレーム1枚のみ抽出(最適フレーム選択は未実装)
- 日本語の漢字店名はスラッグ化時にASCII変換で落ちる(カタカナはローマ字化される)
- **Windows PIL ファイルロック**: `Image.open()` がハンドルを保持し `shutil.move()` が `WinError 32` で失敗する。`with` + `img.copy()` + リトライで対応済み

## Done Criteria

- OCR 抽出からリネームまで一貫して処理できる
- 標準ファイル名でプロジェクト単位に仕分けできる
- 未分類と private の扱いを説明できる
- Markdown サマリーが出力される
- D365 へ載せる場合は reference の照合ルールに従って添付できる

Related Skills

x-hashtag-research

11
from aktsmm/Agent-Skills

Collect and analyze public X posts from hashtags to discover primary sources, official docs, related GitHub repos, and reusable images. Use when researching launch-day announcements, event hashtags like #MSBuild or #MicrosoftBuild, keynote reactions, or when you want to turn noisy X posts into a structured research note under research/. X専用のハッシュタグ調査 workflow。

web-accessibility

11
from aktsmm/Agent-Skills

Build and review accessible web products using WCAG 2.2 AA. Use when implementing or reviewing forms, dialogs, navigation, keyboard flows, focus management, ARIA, color contrast, responsive UI, or framework-specific accessibility in React/Next.js, Angular, and Vue.

vscode-extension-guide

11
from aktsmm/Agent-Skills

Guide for creating VS Code extensions and plugins from scratch through Marketplace publication. Use when developing a VS Code extension/plugin, adding commands or keybindings, building TreeView or Webview UI, publishing to Marketplace, or troubleshooting activation and packaging issues.

skill-finder

11
from aktsmm/Agent-Skills

Search, install, and manage Agent Skills locally and from GitHub, then help decide whether the task really needs a skill or another customization primitive. Use when looking for skills, installing skills, managing a skill collection, or choosing between a skill, prompt, instruction, or agent.

skill-creator-plus

11
from aktsmm/Agent-Skills

Create or review a reusable skill (SKILL.md) that packages a workflow, and decide whether the request should be a skill instead of a prompt, instruction, agent, or hook. Use when creating a new skill, extracting a workflow from a conversation, updating an existing skill, reviewing SKILL.md quality, or fixing weak skill triggering. Triggers on "create skill", "/create-skill", "new skill", "review skill", "fix skill trigger", "SKILL.md", "スキル作成".

review-security-structure

11
from aktsmm/Agent-Skills

Review owned or authorized code for security using structure-first evidence: AST/structure maps, call graphs, complexity, Source/Sink flow, and defensive findings. Use when asked for security review, vulnerability review, AST structure map review, SAST triage, Source/Sink, taint flow, parser/scanner hardening, CI/CD security, LLM/agent tool boundary review, 脆弱性レビュー, 構造マップ, セキュリティレビュー.

retro-copilot

11
from aktsmm/Agent-Skills

Run a retro for ~/.copilot assets and turn incident learnings into updates for copilot-instructions, instructions, skills, agents, and hooks. Triggers on retro, retrospective, incident learning, error analysis, copilot setup, instructions update, インシデント, and 知見反映.

powerpoint-automation

11
from aktsmm/Agent-Skills

Create and edit professional PowerPoint presentations from web articles, blog posts, existing PPTX files, or templates. Use when creating PPTX, converting articles to slides, translating presentations, editing open PowerPoint files, or doing COM Automation / RefURL / overflow review work.

peer-feedback

11
from aktsmm/Agent-Skills

同僚への半期ピアフィードバック下書きを自動生成する。workIQ で 1:1 チャット・グループチャット・メンション・共通会議・メール・SPO の履歴を収集し、6項目テンプレートに沿ってポジティブかつプロモーション志向で起票する。Use when: ピアフィードバック, フィードバック下書き, 同僚評価, 半期フィードバック, 360度フィードバック。

packet-capture-analysis

11
from aktsmm/Agent-Skills

Use when analyzing pcap or pcapng files, triaging network captures, labeling IPs with evidence, generating PNG charts, or writing packet analysis reports. Keywords: pcap, pcapng, tshark, Wireshark, scapy, DNS, TLS SNI, RDAP, graph, matplotlib, gnuplot, packet capture.

ocr-super-surya

11
from aktsmm/Agent-Skills

GPU-optimized OCR using Surya. Use when: (1) Extracting text from images/screenshots, (2) Processing PDFs with embedded images, (3) Multi-language document OCR, (4) Layout analysis and table detection. Supports 90+ languages with 2x accuracy over Tesseract.

microsoft-graph-gateway

11
from aktsmm/Agent-Skills

Route Microsoft Graph work in this workspace. Use when users want to read or write Outlook mail, calendar events, contacts, OneDrive or SharePoint files, Teams, Planner, To Do, users, groups, directory data, or arbitrary Microsoft Graph endpoints from VS Code. Prefer WorkIQ for common read scenarios. Use Microsoft Graph for write actions and gap-read scenarios that need exact Graph properties, filters, permissions, or endpoints.