/fs-engagement:fs-engagementfrom fs-engagement
Prepares financial statements from raw records (bank statements, payment-processor exports, expense logs) using gainstrack as the accounting engine. Use when starting a bookkeeping engagement, rebuilding books from source evidence, or restating figures.
Ships in fs-engagement. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Turn a shoebox of raw records into a full set of financial statements — income statement, balance sheet, changes in equity, cash flow, trial balance — plus notes, tax computation and working papers, with every figure traceable to evidence and reproducible by script.
The pipeline: evidence → machine-readable masters → a deterministic builder script → a
.gainstrack ledger → engine-computed figures (JSON) → a renderer. Humans (and you) make
accounting judgments; scripts apply them; the engine does the arithmetic. No figure is ever
hand-keyed downstream of the ledger.
The engine is gainstrack — a plain-text double-entry DSL with a
web app for interactive viewing and a headless CLI (npx gainstrack) for scripted figures.
Source: https://github.com/glorat/gainstrack.
Everything else in this playbook serves these. Do not trade them away for convenience.
figures.json of expected key figures, enforced by
gainstrack check, so any regeneration that silently moves a number fails loudly.One directory per engagement (kept out of version control), with a README as its index:
<engagement>/
README.md # the index: state, basis, where everything is, how to regenerate
handover/ # raw evidence, as received: bank PDFs, processor exports,
# expense logs, incorporation docs, the client facts Q&A
reference/ # machine-readable masters transcribed from handover/,
# plus the extractor script that (re)produces them
gen_<engagement>.py # the deterministic ledger builder
<engagement>.gainstrack # its output — never hand-edited
<engagement>_statements.json # CLI output: report all
<engagement>_figures.json # golden pins for gainstrack check
build_<renderer>.py # renders statements.json → docx/markdown FS
<notes / tax computation / review checklist>.md # working papers
Establish before touching numbers, and record in the engagement README:
Collect raw records into handover/ unmodified — and issue the full information request up
front (the professional's "prepared-by-client" list) rather than discovering documents one
iteration at a time: every bank statement for the period including the final one with the
confirmed closing balance, payment-processor exports, expense logs, payroll records and
employment contracts, incorporation and share-capital records (current versions — registers
change), leases and letters of intent, any prior draft accounts.
Then write a client facts Q&A document: structured questions with the client's dated answers. Ask about everything material that records alone cannot settle — who is entitled to what remuneration and from when, employment vs contractor status (and any mid-period change), what year-end amounts were unpaid, who personally funded company costs, whether the closing bank balance is confirmed, related-party arrangements, refunds and how they were actually paid. Ask the revenue-cycle questions on day one, not when the notes are drafted:
This document is evidence; treat answers as facts with a date, and cite it from the builder script's judgment comments. Expect corrections: when the client revises source evidence, save the revision as a new version beside the original (never overwrite), point the builder at it, and regenerate — downstream artifacts are never patched by hand.
Turn non-machine-readable evidence (PDF bank statements, spreadsheets) into clean CSVs in
reference/, via an extractor script where possible so the step is reproducible. The bank
transaction master is the backbone — every statement line, transcribed faithfully, no
classification yet. Verify completeness: opening + movements = closing for every statement period.
One script reads the masters and emits the .gainstrack ledger. Its job is classification and
policy, applied mechanically:
UNCLASSIFIED bucket — never silently dropped. Drive the
bucket to zero, or consciously accept what remains.The .gainstrack file is generated output. Fix problems in the builder, never in the ledger.
The engine enforces double-entry by construction, so validation is about tying to reality:
bal assertions against every confirmed external balance (the closing bank balance above
all). Route the plug to a visible adjustment account — a material plug means missing
transactions, so investigate rather than accept.close so retained earnings is computed, not hand-derived.gainstrack check (Phase 5) — the portable tie-out.
Inside the gainstrack repo you can additionally pin them in a test spec (see the last section).The engine ships as the gainstrack npm package — a single bundled CLI, no install required:
npx gainstrack report all <ledger> --from <D> --to <D> --as-of <D> -o <engagement>_statements.json
npx gainstrack check <ledger> --expect <engagement>_figures.json --from <D> --to <D> --as-of <D>
report all emits every statement in one JSON bundle, figures in base currency, keyed by account
id — this is the only interface the renderer sees. check compares flat dotted keys
(incomeStatement.totalRevenue, balanceSheet.liabilities.Liabilities:DeferredRevenue, …,
tolerance 0.005) and exits 1 on mismatch. Pin at minimum: total revenue, total expenses,
profit/loss, total equity, closing cash, each materially judged balance, and
trialBalance.imbalance: 0.
The full CLI contract — stdin/- input, exit codes, the --expect key format, sign
normalisation (a line carrying the opposite of its natural balance emits negative: the signal to
reclassify), always-base-currency valuation and what a non-zero trial-balance imbalance means —
is the package README: https://www.npmjs.com/package/gainstrack. The emitted JSON's shape of
record is the statement-builder types in the gainstrack source:
https://github.com/glorat/gainstrack/blob/master/client/src/lib/statements/index.ts.
A renderer script reads <engagement>_statements.json and produces the FS document (docx,
markdown). It owns captions, current/non-current grouping, statement ordering, note anchors, and
presentation reclassifications (e.g. a debit-balance director account presented as a receivable) —
computed from the JSON's leaf figures, never typed. Note prose will still embed some figures
(going concern, tax, judgments): keep them few, and treat them as a named sweep-list for
restatements. After building, extract the document's figures and diff against the JSON.
Draft the notes from the framework's illustrative FS / disclosure checklist rather than inventing prose, and hold two disciplines the checklist won't enforce:
review-checklist.md; read it before spawning reviewers. In brief: completeness
against the framework's required statements and notes; every figure traced (lens A1);
recognition and measurement per framework (A2); faithfulness — strip boilerplate describing
what the entity didn't do (A3); internal consistency (statements foot and cross-tie);
disclosure adequacy.When a figure changes after documents exist (new evidence, corrected computation):
12,345 and 12345) until the sweep returns nothing.archive/) untouched.Full reference: https://www.gainstrack.com/md/reference.md. The cash-flow tagging semantics —
cashEquivalent, cashflowClass, how tags inherit down an account tree, excluding one child
from a cash tree — are documented in full at https://www.gainstrack.com/md/cashflow.md. The
subset an FS engagement uses:
option "operating_currency" "SGD"
2025-01-01 open Assets:Bank:SG SGD ; open before first use; options indented below
cashEquivalent: true ; this account is cash for the cash-flow statement
2025-01-01 open Liabilities:Director:Loan SGD
cashflowClass: financing ; classifies the OTHER side of flows vs this account
; (operating|investing|financing|adjustment; inherited)
2025-01-01 open Income:Revenue SGD
2025-01-01 open Assets:Clearing SGD
2025-01-01 open Expenses:Salaries SGD
2025-01-01 open Liabilities:Accrued SGD
2025-01-01 open Expenses:General SGD
2025-01-01 open Expenses:Tax:Withholding SGD
2025-01-01 open Income:Salary SGD
2025-01-01 open Equity:RetainedEarnings SGD
2025-06-30 earn Income:Revenue Assets:Clearing 1000.00 SGD ; income credited, funding acct debited
2025-06-30 spend Expenses:Salaries Liabilities:Accrued 500.00 SGD ; expense debited, source acct credited
2025-06-30 tfr Assets:Clearing Assets:Bank:SG 950.00 SGD ; value flows FROM first TO second
2025-12-31 bal Assets:Bank:SG 12345.67 SGD Expenses:General ; end-of-day assertion; plug to the
; named adjustment account
2025-12-31 tx "paycheck with withholding" ; explicit multi-leg; postings sum to zero, no inference
Assets:Bank:SG 4500 SGD
Expenses:Tax:Withholding 1500 SGD
Income:Salary -6000 SGD
2025-12-31 close ; books P&L to Equity:RetainedEarnings; income
; statement reports still show the period's activity
Notes that bite: earn/spend name the Income/Expenses account without needing the funding
account if the account declares a fundingAccount option; posting lines under tx are
single-space separated (column-padding does not parse); bal's adjustment account is required;
account roots are Assets/Liabilities/Equity/Income/Expenses.
tools/gainstrack-cli/ (own pnpm install); run it as
pnpm run gainstrack -- <args> from that directory instead of npx gainstrack.client/local/ (gitignored, auto-collected by vitest, guard with
existsSync + skip); run with pnpm run test:unit from client/. The full convention and the
guard idiom to copy: client/local/README.md.data/ (gitignored) — mirror its layout.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
bookkeeping, financial-statements, accounting, gainstrack, audit-trail
npx claudepluginhub glorat/gainstrack --plugin fs-engagementOther plugins' skills for the same job