Ledger Transaction Entry
Use this skill to append new transactions into projects/data.
Required output target
- - Data root: INLINECODE1
- File rule: INLINECODE2
- New record must be appended to the end of the month file.
Parse rules
From user text, extract:
- -
direction: 支出 or INLINECODE5 - INLINECODE6 : number
- INLINECODE7 : default
CNY if omitted - INLINECODE9 : default today (Asia/Taipei) if omitted
- INLINECODE10 : short clean text
- INLINECODE11 : 单个分类标签(只能选一个)
Optional fields (only if provided clearly):
- - INLINECODE12
- INLINECODE13
- INLINECODE14
If amount or direction is ambiguous, ask one short clarification question before writing.
Write command
IMPORTANT: Get today's date (YYYY-MM-DD) for determining which month file to write to.
CODEBLOCK0
The script will automatically add created_at field with current timestamp (YYYY-MM-DD HH:MM:SS) to each record.
Then run:
CODEBLOCK1
Add optional args only when available:
- - INLINECODE16
- INLINECODE17
- INLINECODE18
- INLINECODE19
- INLINECODE20
Category catalog (must check before writing)
Before each write, check:
Selection policy:
- - Prefer existing values from catalog (
tag/major_category/type/currency). - If user gives a new tag not in catalog and meaning is clear, write it; otherwise ask one short confirmation.
- 只能选一个分类,不要给多个。
Existing common tags (只选一个)
当用户没有指定分类时,根据意图选择最合适的一个:
- - 吃喝:
外卖 / 下馆子 / 饮料零食 / INLINECODE29 - 出行:
打车 / 交通卡 / 火车 / 飞机 / INLINECODE34 - 居家:
生活好物 / 居家杂物 / INLINECODE37 - 订阅与网络:
通讯网络 / 服务器 / INLINECODE40 - 投资与收入:
A股 / 美股 / 港股 / 项目营收 / INLINECODE45
When uncertain, leave tags empty instead of guessing aggressively.
Response after write
Confirm with:
- - month file path
- appended summary (date, direction, amount, description)
Monthly summary + chart workflow
Use this when user asks things like:
- - INLINECODE46
- INLINECODE47
- INLINECODE48
Required behavior:
- 1. Read all month files under
projects/data/YYYY/YYYY-MM.jsonl. - Aggregate by month:
- total amount (absolute sum)
- expense sum (
direction=支出)
- income sum (
direction=收入)
- net (
income-expense)
- 3. Generate chart into
projects/reports/ (PNG preferred). - Ensure generated charts are git-ignored (keep/report patterns in
.gitignore). - Send chart to user.
- If user asks to delete after sending, delete local generated chart files.
Important note in reply:
- - If source data includes multiple currencies, state that monthly totals are mixed-currency trend values unless converted to one base currency.
账本交易录入
使用此技能将新交易追加到 projects/data 中。
必需输出目标
- - 数据根目录:projects/data
- 文件规则:YYYY/YYYY-MM.jsonl
- 新记录必须追加到月份文件的末尾。
解析规则
从用户文本中提取:
- - direction:支出 或 收入
- amount:数字
- currency:如果省略,默认为 CNY
- date:如果省略,默认为今天(亚洲/台北时区)
- description:简短清晰的文本
- tag:单个分类标签(只能选一个)
可选字段(仅在明确提供时):
如果金额或方向不明确,在写入前先提出一个简短的问题进行确认。
写入命令
重要提示:获取今天的日期(YYYY-MM-DD)以确定写入哪个月份的文件。
bash
获取亚洲/台北时区的今天日期
CURRENT_DATE=$(TZ=Asia/Taipei date +%Y-%m-%d)
脚本会自动为每条记录添加 created_at 字段,包含当前时间戳(YYYY-MM-DD HH:MM:SS)。
然后运行:
bash
python3 projects/scripts/addledgerentry.py \
--data-root projects/data \
--date $CURRENT_DATE \
--direction <支出|收入> \
--amount <数字> \
--currency \
--description <文本> \
--tag <标签>
仅在可用时添加可选参数:
- - --id
- --major-category
- --type
- --source manual
- --batch manual
分类目录(写入前必须检查)
每次写入前,检查:
- - projects/docs/CATEGORY_CATALOG.md
选择策略:
- - 优先使用目录中的现有值(tag/major_category/type/currency)。
- 如果用户提供了目录中没有的新标签且含义明确,则写入;否则提出一个简短的问题进行确认。
- 只能选一个分类,不要给多个。
现有常用标签(只选一个)
当用户没有指定分类时,根据意图选择最合适的一个:
- - 吃喝:外卖 / 下馆子 / 饮料零食 / 买菜做饭
- 出行:打车 / 交通卡 / 火车 / 飞机 / 大巴
- 居家:生活好物 / 居家杂物 / 房租住宿
- 订阅与网络:通讯网络 / 服务器 / 域名
- 投资与收入:A股 / 美股 / 港股 / 项目营收 / 二手
如果不确定,则留空标签,不要过度猜测。
写入后的响应
确认以下内容:
- - 月份文件路径
- 追加的摘要(日期、方向、金额、描述)
月度汇总 + 图表工作流
当用户提出以下要求时使用:
- - 统计已知月份的总金额
- 生成图表发我
- 图表都 ignore,发完可以删
必需操作:
- 1. 读取 projects/data/YYYY/YYYY-MM.jsonl 下的所有月份文件。
- 按月份汇总:
- 总金额(绝对值之和)
- 支出总额(direction=支出)
- 收入总额(direction=收入)
- 净额(收入-支出)
- 3. 生成图表到 projects/reports/(首选 PNG 格式)。
- 确保生成的图表被 git 忽略(在 .gitignore 中保留/报告模式)。
- 将图表发送给用户。
- 如果用户要求在发送后删除,则删除本地生成的图表文件。
回复中的重要说明:
- - 如果源数据包含多种货币,则说明月度总额是混合货币的趋势值,除非转换为一种基础货币。