Draft a journal entry

From gethouston/houston · View interactive version

Draft a journal entry is an AI agent skill from the GitHub repository gethouston/houston. Use when the user says 'book the accrual journal entry' / 'draft the depreciation journal entry for Q1' / 'post the prepaid amortization' / 'revenue recognition this period' / 'stock-comp journal entry' / 'reclass this expense' - I draft a balanced double-entry journal entry that branches on `type

How to use this skill

Skill file

Prep Journal Entry

One balanced journal entry from type-specific template. Invariants enforced every write: debits equal credits within 1 cent, every glCode exists in locked chart of accounts, status: "draft" (never posted without explicit user confirm), reversing: true requires reversesEntryId + opposite sign convention.

Draft-only: write markdown + index row; user/accountant post to QuickBooks Online / Xero.

When to use

Connections I need

I run external work through Composio. Before this skill runs I check that the categories below are linked. Missing → I name the category, ask you to connect it from the Integrations tab, stop.

If type=payroll and no payroll connection exists I stop and ask you to connect Gusto / Rippling / Justworks, or paste the pay-period summary.

Information I need

I read your bookkeeping context first. For every required field that's missing I ask ONE plain-language question (best modality: connected app > file drop > URL > paste) and wait.

Steps

<!-- houston-workflow:v1 -->

  1. Parse inputs. Required: type (one of accrual | prepaid | payroll | revrec | depreciation | stock-comp | adjustment | reclass) and period (YYYY-MM). Optional: mode (only meaningful when type=accrual - reversing), short slug for filename.
  1. Read context. Load context/bookkeeping-context.md (stop if missing), config/context-ledger.json, config/chart-of-accounts.json (locked for run - stop if absent), accruals.json (empty array if absent). For payroll / depreciation / stock-comp, also read type-specific config (below).
  1. Branch on type. Each branch builds lines[] array; Step 4 validates before writing.

### accrual

Period-end accrual (unbilled revenue, accrued payroll, accrued interest). Debit expense / revenue line, credit Accrued Liabilities (or debit Accrued Revenue + credit revenue). reversing: true by default. Append to accruals.json: {id, type, active: true, reversing: true, period, amount, glCode, counterGlCode, memo, createdAt, updatedAt}.

mode=reversing sub-mode. Read accruals.json, find every entry with active=true AND reversing=true AND period < current. For each, produce reversing journal entry with reversesEntryId pointing at original and sign convention flipped. Mark original active: false and set reversedOn. Write each reversal as separate journal entry.

### prepaid

Amortize prepaid (rent, SaaS, insurance). Debit expense account, credit prepaid-asset account. reversing: false. Memo: "Amortize {asset} - {period}".

### payroll

Pay-period summary. Source order: connected app (composio search payroll → Gusto / Rippling / Justworks / Deel / ADP, schema via --get-schema) > pasted summary {gross, taxes, benefits, netPay, byDepartment: {rd, sm, ga}}. Lines: debit Wages - R&D / Sales & Marketing / General & Admin per chart of accounts, debit Payroll Taxes, debit Employee Benefits; credit Wages Payable (or Cash if paid in-period - ask once), Payroll Tax Liabilities, Benefits Payable. Memo: "Payroll - {period} - {provider}".

### revrec

Read every revrec/**/*.json, pick rows with period = current. Debit Deferred Revenue, credit revenue account. Multi-currency → aggregate in home currency (already on schedule). Memo: "Revenue recognition - {period} - {N} contracts".

### depreciation

Read config/fixed-assets.json (shape: [{id, description, class, cost, salvage, usefulLifeMonths, inServiceOn, method: "straight-line"}]). If absent, ask ONCE for schedule (file > paste) - NEVER invent. Compute (cost - salvage) / usefulLifeMonths per asset, group by class. Debit Depreciation Expense - {class}, credit Accumulated Depreciation - {class}. Memo: "Depreciation - {period} - {N} assets".

### stock-comp

Read config/stock-comp.json (shape: {valuation: {fmv, asOf}, grants: [{employeeId?, grantDate, shares, strike, vestingMonths, cliff}]}). If absent, ask ONCE for 409A + vesting schedule. Linear expense after cliff per ASC 718. Debit Stock-Based Compensation Expense (split by R&D / Sales & Marketing / General & Admin if chart of accounts supports), credit Additional Paid-in Capital. Memo: "Stock-based compensation - {period} - {N} grants". If context/bookkeeping-context.md flags stock-based compensation as hard-no without sign-off, stop and surface draft for approval.

### adjustment

General manual adjustment. User dictates {glCode, debit, credit, memo} per line (2+ lines). Common sources: unrecorded fees from reconciliations, forex rounding, prior coding corrections.

### reclass

Inputs {fromGlCode, toGlCode, amount, memo}. Debit toGlCode, credit fromGlCode. Both should be expense-or-asset lines; cross-section (expense → liability) requires type=adjustment instead.

  1. Validate before write. Hard guards - failure stops write, surfaces error:
  1. Write journal entry markdown to journal-entries/{YYYY-MM}/{type}-{slug}.md. Structure:
  1. Append to journal-entries.json at agent root. Atomic read-merge-write. Full schema from data-schema.md: {id, createdAt, updatedAt, date, type, memo, reversing, reversesEntryId?, period, lines[], status: "draft", supportingDocs?}.
  1. Type-specific side effects.
  1. Append one outputs.json row: {type: "journal-entry", title: "{type} journal entry - {period} - {slug}", summary, path, status: "draft", domain: "close"}. Read-merge-write; never overwrite.
  1. Summarize to user. One compact block: journal entry id, total amount, type, path, reminder it's draft until user posts to QuickBooks Online / Xero and confirms. Offer to flip status: "posted" on explicit confirm only.

Outputs

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.