SuperAPI AI Directory

personal-finance

Office & productivity

View repository

Updated 10-16 00:04

About this skill

Personal Accounting

Help users record income and expenses, generate spending reports, and manage budgets. All data is stored locally to protect financial privacy.

Use Cases

  • The user says "Record an entry: lunch 35 yuan" or "Spent 500 on clothes today"
  • The user says "How much did I spend this month" or "Show me my spending report"
  • The user says "Set a monthly dining budget of 3000" or "How much budget is left"

Execution Method

Store accounting data in local JSON files, and the LLM parses natural language accounting instructions.

Data Storage

Accounting file:~/Documents/xiaodazi_finance/records.json

{
  "records": [
    {
      "date": "2026-02-09",
      "type": "expense",
      "amount": 35.00,
      "category": "dining",
      "description": "lunch",
      "currency": "CNY"
    }
  ],
  "budgets": {
    "dining": { "monthly_limit": 3000, "currency": "CNY" }
  }
}

Record Entry

# 读取现有记录
cat ~/Documents/xiaodazi_finance/records.json 2>/dev/null || echo '{"records":[],"budgets":{}}'

# 追加记录(通过 Python)
python3 -c "
import json, os
path = os.path.expanduser('~/Documents/xiaodazi_finance/records.json')
os.makedirs(os.path.dirname(path), exist_ok=True)
try:
    data = json.load(open(path))
except:
    data = {'records': [], 'budgets': {}}
data['records'].append({
    'date': '2026-02-09',
    'type': 'expense',
    'amount': 35.00,
    'category': 'dining',
    'description': 'lunch',
    'currency': 'CNY'
})
json.dump(data, open(path, 'w'), ensure_ascii=False, indent=2)
print('recorded')
"

Generate Report

import json
from collections import defaultdict

data = json.load(open("~/Documents/xiaodazi_finance/records.json"))

# 按类别汇总
by_category = defaultdict(float)
for r in data["records"]:
    if r["type"] == "expense":
        by_category[r["category"]] += r["amount"]

for cat, total in sorted(by_category.items(), key=lambda x: -x[1]):
    print(f"{cat}: {total:.2f}")

Expense Categories

Category Keyword Examples
dining Lunch, dinner, takeout, coffee
transport Taxi, subway, fuel, parking
shopping Clothes, electronics, daily necessities
housing Rent, utilities, property management
entertainment Movies, games, travel
education Courses, books, training
health Medical care, health checkups, fitness

Security Rules

  • Local data storage: Financial data is stored only locally and is not uploaded
  • No automatic sharing: Do not write financial information into other files or send it

Output Specifications

  • After recording an entry, confirm: category, amount, date
  • Display reports in tables, sorted by amount in descending order
  • Proactively remind when the budget is overspent
  • Support multiple currencies (automatically selected based on user habits)