Invoice organizer

From malue-ai/dazee-small · View interactive version

Invoice organizer is an AI agent skill from the GitHub repository malue-ai/dazee-small. Automatically organize invoices and receipts by reading files, extracting key information, renaming consistently, and sorting into categorized folders.

How to use this skill

Skill file

发票整理助手

自动整理发票和收据:读取文件、提取关键信息、统一命名、分类归档。

使用场景

依赖安装

首次使用时自动安装:

pip install pypdf Pillow

执行方式

通过 Python 脚本扫描文件夹,识别发票文件,提取信息并归档。

1. 扫描目标文件夹

import os
from pathlib import Path

def scan_invoices(folder: str) -> list:
    """Scan folder for invoice files (PDF/image)."""
    extensions = {'.pdf', '.png', '.jpg', '.jpeg'}
    invoices = []
    for f in Path(folder).rglob('*'):
        if f.suffix.lower() in extensions:
            invoices.append(f)
    return invoices

2. 提取发票信息

对于 PDF 发票:

from pypdf import PdfReader

def extract_pdf_text(path: str) -> str:
    """Extract text from PDF invoice."""
    reader = PdfReader(path)
    text = ""
    for page in reader.pages:
        text += page.extract_text() or ""
    return text

对于图片发票,使用 LLM 视觉能力识别内容。

3. 信息结构化

从提取的文本中识别:

4. 统一命名和归档

# 命名规则:日期_商家_金额_类型.ext
# 示例:20250115_星巴克_35.00_餐饮.pdf

# 目录结构
# 发票整理/
# ├── 2025-01/
# │   ├── 餐饮/
# │   ├── 交通/
# │   └── 办公用品/
# └── 2025-02/

输出规范

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.