con un clic
edit-journals
// Edit hledger journal files following best practices and conventions. Includes prelude includes, balance assertions, tagging, formatting, and validation procedures with anti-patterns to avoid.
// Edit hledger journal files following best practices and conventions. Includes prelude includes, balance assertions, tagging, formatting, and validation procedures with anti-patterns to avoid.
Transcribe transactions from source documents into the hledger ledger. Handles raw data (receipts, invoices, bank statements, OCR text) with proper status markers, tagging, and account registration. For multiple entries, uses a separate subagent for each transaction to enable parallelization and focused scope.
Strict, step-by-step workflow for upserting Octopus card transactions to the ledger. Requires explicit user clarification for any ambiguity. Enforces contextual matching, mapping, and privacy rules. No guessing or inference allowed.
Add a new payee (merchant, person, organization, or UUID) to the correct preludes journal file, maintaining strict lexicographical order.
Match Octopus Wallet statement rows to journal transactions and update transaction datetimes. Runs only when explicitly requested.
Perform monthly journal migration using hledger close --migrate to close the previous month and open the new month with proper balance assertions and account initialization.
Validate hledger journal files using check/format scripts. Includes validation procedures and local hook (Husky + lint-staged) verification.
| name | edit-journals |
| description | Edit hledger journal files following best practices and conventions. Includes prelude includes, balance assertions, tagging, formatting, and validation procedures with anti-patterns to avoid. |
Note: Use full path ledger/[year]/[year]-[month]/[name].journal (e.g., ledger/2024/2024-01/self.journal).
This skill provides comprehensive guidance for editing hledger journal files while maintaining consistency, validity, and adherence to project conventions.
include ../../../preludes/self.journal or self.alternatives.journal).= balance CURRENCY) for bank reconciliations, transfers, and loans where applicable.timezone: UTC+08:00, activity, time); use duration, food_or_drink, item, location when relevant.bun run format then bun run check (see .agents/instructions/developer-workflows.instructions.md). Fix all errors before committing.include paths resolve.For detailed examples and edge cases, see .agents/instructions/transaction-format.instructions.md and .agents/instructions/editing-guidelines.instructions.md.
For non-obvious transactions, add explanatory comments:
2025-01-19 Insurance Adjustment ; reason: coverage review
liabilities:accrued expenses:insurances:life:<uuid> -100.00 HKD
equity:unaccounted 100.00 HKD
Helps future understanding of why transactions were recorded.
For a comprehensive list of anti-patterns across all skills, see .agents/instructions/continuous-learning.instructions.md (consolidated guide to pitfalls discovered through repeated use).
Below are the most critical patterns specific to journal editing:
The year-level ledger/YYYY/self.journal files should only contain include directives:
include 2025-01/self.journal
include 2025-02/self.journal
include 2025-03/self.journal
...
Never add transactions here. Transactions belong in monthly journals.
Why? Year-level files are for organization only. Adding transactions here breaks the hierarchical structure.
Always run bun run format then bun run check before committing. Invalid journals cause downstream problems.
Maintain consistent decimal and spacing:
# ❌ Inconsistent
2025-01-19 Payment
expenses:food 50 HKD # Missing decimal
assets:cash -50.0 HKD # Only 1 decimal place
# ✅ Consistent (after python -m format)
2025-01-19 Payment
expenses:food 50.00 HKD
assets:cash -50.00 HKD
Always run python -m format to normalize.
Every transaction must include timezone information:
# ❌ Missing timezone
2025-01-19 Cafe ; activity: eating, time: 12:30
# ✅ Includes timezone
2025-01-19 Cafe ; activity: eating, time: 12:30, timezone: UTC+08:00
Timezone tags are essential for proper time tracking.
Changes to preludes/self.journal affect all monthly journals:
# Changes here impact all journals!
account assets:cash
commodity HKD
payee Example Payee
tag activity
Before modifying prelude definitions:
Never commit unencrypted private.yaml. See security.instructions.md.
Once an account or payee is used, removing it breaks historical references:
# ❌ Bad: Removes existing definition
# (delete from preludes/self.journal)
account assets:cash
# ✅ Good: Keep definitions even if unused
# Let check script find any unused definitions separately
Payees and accounts are part of ledger history.
Account paths must use colons, not spaces:
# ❌ Invalid
account assets:cash on hand:HKD
# ✅ Valid
account assets:cash:HKD
Spaces break account parsing.
# 1. Make edits to journal files
# 2. Format
bun run format
# 3. Validate
bun run check
# 4. If edited private.yaml: bun run encrypt
# 5. Review and commit
git status && git diff
git add . && git commit -S -m "ledger(self.journal): add N transaction(s)"
python -m formatpython -m checkpreludes/self.journal in alphabetical orderprivate.yaml and encryptpython -m format and python -m checkpython -m format and python -m checkSee ./lessons.md for active learnings and integration pointers. For consolidated insights across all skills (replaces scattered lessons.md), see .agents/instructions/continuous-learning.instructions.md:
bun run format before bun run check to reduce noiseWhen adding entries to ./lessons.md, keep them brief and integrate into SKILL.md main sections, theme files, or examples.md after resolving the issue.