finance-reconcile
npx skills add https://github.com/insight68/skills --skill finance-reconcile
Agent 安装分布
Skill 文档
Finance Audit
Overview
Comprehensive financial audit tool that validates balance sheets and income statements. Performs four core audits: balance sheet equilibrium, income statement verification, account change tracking, and cross-statement relationship validation.
Quick Start
Basic Balance Sheet Audit
Verify balance sheet with account changes:
scripts/reconcile.py \
--balance-sheet balance_sheet.xlsx \
--account-changes account_changes.xlsx \
--output audit_report.xlsx
Complete Financial Audit (Balance Sheet + Income Statement)
Full audit including profit statement:
scripts/reconcile.py \
--balance-sheet balance_sheet.xlsx \
--account-changes account_changes.xlsx \
--income-statement income_statement.xlsx \
--income-details income_details.xlsx \
--transactions transactions.xlsx \
--output complete_audit.xlsx \
--period "2024å¹´1æ"
Using Custom Column Names
Use JSON config file for custom column names:
scripts/reconcile.py \
--balance-sheet bs.xlsx \
--account-changes ac.xlsx \
--config my_config.json
Command Parameters
| Parameter | Short | Required | Description |
|---|---|---|---|
--balance-sheet |
-b |
Yes | Balance sheet file path |
--account-changes |
-a |
Yes | Account change details file path |
--income-statement |
-i |
No | Income statement file path |
--income-details |
-d |
No | Income statement details file path |
--transactions |
-t |
No | Transaction details file path |
--output |
-o |
No | Output Excel audit report path |
--period |
-p |
No | Audit period (default: æ¬æ) |
--tolerance |
– | No | Tolerance for acceptable difference (default: 0.01) |
--config |
-c |
No | JSON config file for column names |
--bs-sheet |
– | No | Balance sheet sheet name or index |
--ac-sheet |
– | No | Account changes sheet name or index |
--is-sheet |
– | No | Income statement sheet name or index |
--id-sheet |
– | No | Income details sheet name or index |
--trans-sheet |
– | No | Transaction details sheet name or index |
Required File Formats
1. Balance Sheet (èµäº§è´åºè¡¨) – Required
| Column | Description |
|---|---|
| ç§ç® | Account name |
| æåä½é¢ | Opening balance |
| ææ«ä½é¢ | Closing balance |
| ç±»å | Account type (èµäº§/è´åº/ææè æç) |
| éé¢ | Amount for totals |
2. Account Changes (ç§ç®å卿ç»è¡¨) – Required
| Column | Description |
|---|---|
| ç§ç® | Account name |
| åæ¹ | Debit amount |
| è´·æ¹ | Credit amount |
3. Income Statement (婿¶¦è¡¨) – Optional
| Column | Description |
|---|---|
| é¡¹ç® | Income statement item |
| éé¢ | Amount |
4. Income Details (婿¶¦æç»è¡¨) – Optional
| Column | Description |
|---|---|
| é¡¹ç® | Item name (must match income statement) |
| éé¢ | Detail amount |
5. Transactions (交ææç»è¡¨) – Optional
| Column | Description |
|---|---|
| ç§ç® | Affected account |
| åæ¹ | Debit amount |
| è´·æ¹ | Credit amount |
| æ¥æ (optional) | Transaction date |
| åè¯å· (optional) | Voucher number |
See references/file_formats.md for detailed format specifications and custom column configuration.
Audit Objectives
The script performs four core audit objectives:
1. Balance Sheet Equilibrium Verification
Formula: èµäº§æ»è®¡ = è´åºæ»è®¡ + ææè æçæ»è®¡
Verifies that the balance sheet is balanced overall.
2. Income Statement Verification
Logic: Income statement items = Corresponding detail summary
Validates each income statement item (revenue, expenses, etc.) against detail records.
3. Account Change Tracking
Logic: Opening Balance + Changes = Closing Balance
For each account:
- Asset accounts: Closing = Opening + Debit – Credit
- Liability/Equity accounts: Closing = Opening + Credit – Debit
4. Cross-Statement Relationship Validation
Logic: Retained earnings change â Net profit
Validates relationships between balance sheet and income statement.
See references/verification_rules.md for detailed audit logic and troubleshooting.
Audit Outputs
Console Report
================================================================================
è´¢å¡å®¡è®¡æ¥å - æ¬æ
================================================================================
ä¸ã审计æ¦è¿°
--------------------------------------------------------------------------------
å®¡è®¡ç»æ: éè¿ â
äºãèµäº§è´åºè¡¨å®¡è®¡
--------------------------------------------------------------------------------
èµäº§æ»è®¡: Â¥1,000,000.00
è´åºæ»è®¡: Â¥600,000.00
ææè
æçæ»è®¡: Â¥400,000.00
èµäº§è´åºå¹³è¡¡: æ¯ â
ä¸ã婿¶¦è¡¨å®¡è®¡
--------------------------------------------------------------------------------
婿¶¦é¡¹ç®å¹é
: 5/5
åãæ¥è¡¨å¾ç¨½å
³ç³»
--------------------------------------------------------------------------------
å婿¶¦: Â¥100,000.00
æªåé
婿¶¦åå¨: Â¥100,000.00
å¾ç¨½å
³ç³»éªè¯: éè¿ â
äºãä¸å¹³è¡¡é¡¹ç®æ¸
å
--------------------------------------------------------------------------------
æ ä¸å¹³è¡¡é¡¹ç®
Excel Audit Report
When --output is specified, generates an Excel file with these sheets:
| Sheet | Content |
|---|---|
| 审计æ¥å | Full audit report text |
| ç§ç®åå¨åæ | Account analysis with opening/closing balances |
| 交æå½±å追踪 | Transaction impact tracking |
| 婿¶¦è¡¨æ ¸å¯¹ | Income statement verification results |
| ä¸å¹³è¡¡é¡¹ | List of unbalanced items |
Account Change Analysis Table
| ç§ç® | ç§ç®ç±»å | æåä½é¢ | åæ¹åå¨ | è´·æ¹åå¨ | ååå¨ | ææ«ä½é¢ | æ¯å¦å¹³è¡¡ | å·®å¼ |
|---|---|---|---|---|---|---|---|---|
| è´§å¸èµé | èµäº§ | 100000 | 20000 | 0 | 20000 | 120000 | æ¯ | 0 |
Using the Script as a Module
from scripts.reconcile import (
audit_financial_statements,
generate_audit_report,
export_audit_report
)
result, accounts = audit_financial_statements(
balance_sheet_file='balance_sheet.xlsx',
account_changes_file='account_changes.xlsx',
income_statement_file='income_statement.xlsx',
income_details_file='income_details.xlsx',
transactions_file='transactions.xlsx',
tolerance=0.01,
period='2024å¹´1æ'
)
# Print console report
print(generate_audit_report(result, period='2024å¹´1æ'))
# Export Excel report
export_audit_report(result, 'audit_report.xlsx', accounts, period='2024å¹´1æ')
# Check audit result
if result.is_passed:
print("Audit passed!")
else:
print(f"Found {len(result.unbalanced_items)} unbalanced items")
Tolerance Setting
Default tolerance is ±0.01 yuan. Adjust with --tolerance:
scripts/reconcile.py \
--balance-sheet bs.xlsx \
--account-changes ac.xlsx \
--tolerance 1.0
Consider these factors when setting tolerance:
- Exchange rate fluctuations (for foreign currency)
- System precision differences
- Rounding errors
Troubleshooting
Balance Sheet Not Balanced
Possible causes:
- Incorrect balance entries
- Incorrect totals calculation
- Opening/closing mismatch
Solutions:
- Check balance sheet total rows
- Verify account balances
- Check account type classification
Account Changes Unbalanced
Possible causes:
- Missing change records
- Incorrect debit/credit direction
- Account name mismatch
Solutions:
- Ensure account names match exactly
- Verify debit/credit records
- Check for missing change records
Income Statement Not Matching
Possible causes:
- Missing detail items
- Inconsistent item names
- Incorrect summary calculation
Solutions:
- Ensure detail table includes all items
- Check item name consistency
- Verify summary calculations
Cross-Statement Relationship Failed
Possible causes:
- Profit distribution (dividends, retained earnings)
- Mismatched accounting periods
- Incorrect net profit calculation
Solutions:
- Consider profit distribution events
- Verify income statement net profit
- Confirm period consistency
Resources
scripts/reconcile.py
Core audit script supporting:
- Balance sheet equilibrium verification
- Income statement validation
- Account change tracking
- Cross-statement relationship validation
- Transaction impact tracing
- Comprehensive audit report generation
references/file_formats.md
Detailed file format specifications, column name mapping, and configuration options.
references/verification_rules.md
Comprehensive audit rules, validation logic, output examples, and troubleshooting guide.