cfo-validate

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/cfo-validate — Quality Control

/cfo-validate — 质量控制

CLEAR Step

CLEAR步骤

L — Log: Ensure every entry in the ledger is valid and correct.
L — 日志: 确保账本中的每一条目都有效且准确。

Role

角色

You are the quality gate. Nothing gets committed without passing your checks.
你是质量关口,所有提交内容都必须通过你的检查。

Workflow

工作流

Step 1: Run validation helper

步骤1:运行校验工具

bash
undefined
bash
undefined

Prefer explicit path when you know it

已知路径时优先使用显式路径

./bin/cfo-check ./ledger/main.beancount
./bin/cfo-check ./ledger/main.beancount

Or rely on auto-discovery

或者依赖自动查找

./bin/cfo-check

Discovery order:
1. The explicit path passed to `./bin/cfo-check`
2. `./main.beancount`
3. `./ledger/main.beancount`
4. The first `main.beancount` found under the current working tree

Report any errors with file, line number, and description.
./bin/cfo-check

查找顺序:
1. 传递给`./bin/cfo-check`的显式路径
2. `./main.beancount`
3. `./ledger/main.beancount`
4. 当前工作目录树中找到的第一个`main.beancount`

请上报所有错误,包含文件路径、行号及错误描述。

Step 2: Custom validation rules

步骤2:自定义校验规则

Beyond bean-check, verify:
  1. Balance assertions exist for every bank/credit card account at month-end
  2. No orphaned accounts — every open account has at least one transaction
  3. No future-dated transactions (unless explicitly flagged)
  4. Consistent payee naming — flag variations (e.g., "Amazon" vs "AMZN" vs "Amazon.ca")
  5. Receipt linkage — transactions over $75 should have a receipt reference
  6. Tax treatment — all business expenses have tax metadata
  7. Flagged transactions — report any
    !
    (flagged) entries that need resolution
  8. Duplicate-risk findings — surface unresolved items from the capture duplicate-risk report or manifest conflicts
除bean-check之外,还需校验:
  1. 每个银行/信用卡账户月末都存在余额断言
  2. 无孤立账户 — 每个已开立的账户至少有一笔交易
  3. 无未来日期的交易(除非明确标记)
  4. 收款人命名一致 — 标记命名差异项(例如"Amazon"与"AMZN"、"Amazon.ca")
  5. 收据关联 — 金额超过75美元的交易应关联收据引用
  6. 税务处理 — 所有业务支出都需包含税务元数据
  7. 标记交易 — 上报所有需要解决的
    !
    (已标记)条目
  8. 重复风险发现 — 展示重复风险捕获报告中未解决的项目或明显冲突

Step 3: Report

步骤3:报告

VALIDATION REPORT
═══════════════════
bean-check:     PASS (0 errors)
Balance checks: PASS (12 assertions, all hold)
Orphan accounts: WARN (1 account with no transactions)
Future dates:   PASS
Payee names:    WARN (3 inconsistent names)
Receipts:       WARN (2 transactions >$75 missing receipts)
Tax treatment:  PASS
Flagged:        INFO (1 flagged transaction remaining)
Duplicate risk: WARN (1 corrected reimport waiting for approval)

Overall: PASS with warnings
校验报告
═══════════════════
bean-check:     通过(0个错误)
余额校验:        通过(12条断言,全部有效)
孤立账户:        警告(1个账户无交易记录)
未来日期:        通过
收款人命名:      警告(3个命名不一致)
收据关联:        警告(2笔金额超过75美元的交易缺失收据)
税务处理:        通过
标记交易:        信息(剩余1笔已标记交易待处理)
重复风险:        警告(1笔已修正的重新导入记录待审批)

总体结果:通过,存在警告

Constraints

约束

  • Run automatically before every
    /cfo-snapshot
    commit
  • Report all issues — never silently ignore
  • Distinguish ERROR (must fix) from WARNING (should fix) from INFO (awareness)
  • 每次
    /cfo-snapshot
    提交前自动运行
  • 上报所有问题 — 禁止静默忽略
  • 明确区分错误(必须修复)、警告(建议修复)和信息(仅需知晓)

Related Skills

相关技能

  • /cfo-capture-dedupe
    — emits duplicate-risk findings and import manifests
  • /cfo-snapshot
    — blocked until validation results are acceptable
  • /cfo-capture-dedupe
    — 输出重复风险发现和导入清单
  • /cfo-snapshot
    — 在校验结果合格前会被阻塞