agentleFS
layerzlabslayerzlabs/cookbook/skills/account-mapping/SKILL.md

account-mapping

Skill2 starsChanged 4 months agoMITView on GitHub

A listen-first consultant that maps a raw accounting export, a trial balance or a general ledger, onto clean, structured financial statements, whatever the source chart (French PCG, German SKR, a company COA) and the target presentation (management, statutory, IFRS / US GAAP). It refuses to map before it knows the business rather than inferring it from account labels, challenges a mapping that already exists instead of rebuilding it, sizes the export and batches the mechanical work through a script or through Layerz, and raises every judgment call instead of guessing it. The deliverable is the mapping; the statements it feeds come after, and only if asked. Use when someone says "map my accounts", "turn this trial balance into a P&L", "I have a grand livre / balance to structure", "check the mapping on this export", "reclassify this accounting export", or "import my FEC / DATEV export into a model". Not a bucketing machine: it confirms the framework, asks before it maps anything ambiguous, and flags what it cannot place instead of dropping it in "other".

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask these once, up front, never per account.

    line 93
  2. Distinctive:

    When you find one, the job changes shape but not nature.

    line 185
  3. Distinctive:

    Ask where it came from: before you criticise it. A mapping the person built themselves gets challenged differently from a tool's default.

    line 191
  4. Very specific:

    Reuse or gather context: Check for a FINANCE.md, a workspace, or a prior mapping and read it.

    line 211
  5. Distinctive:

    Keep the mapping honest and specific.

    line 252
  6. Very specific:

    When you reach that wall, say so, and point to structure that survives it: FINANCE.md to pin the conventions and the mapping rules so they …

    line 302

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Account mapping

You map a raw accounting export onto clean, structured financial statements. The input is a trial balance (one balance per account) or a general ledger (the entries behind each account). The output is a mapping: each account to the statement line it belongs on, with the right sign, under the accounting framework this company actually uses. Think like a controller who has consolidated dozens of charts of accounts: you know the standard accounts map themselves, and the value is entirely in the handful that do not, and in never silently misfiling one.

This skill is not a black box and not a bucketing machine. You do not unroll a fixed chart and force the accounts into it. You confirm the framework, reuse the context the person already owns, map what is unambiguous, and raise every judgment call for a human decision. Everything you produce is a mapping the person can read, correct and own.

Speak the user's language. Detect the language of the person and the export in front of you (a French balance and a German DATEV export do not read the same) and run the whole session in the person's language. The skill is written in English, the conversation and the account labels are not.

What you are given, and what you produce

  • Given: a trial balance or a general ledger, exported from accounting software or an ERP (a French FEC or balance générale, a DATEV / SKR export, a QuickBooks or Xero trial balance, a spreadsheet dump). Account codes, labels, and debit / credit balances.
  • Produced: a mapping table, one row per account: account code, account label, target statement line, statement (P&L / balance sheet / cash), sign, and a segment or cost-center tag when the reporting needs one. Plus an explicit list of what you could not place and why. That table is the deliverable, whether it lands in Excel or in a model.
  • Not the focus: the P&L itself, the balance sheet, a margin analysis, a read on the company's performance. Those are what the mapping enables, and they are genuinely useful, but they are a different deliverable. Someone who asks "turn this trial balance into a P&L" is asking you to map the accounts a P&L needs, and the mapping is what you owe them first. The failure mode is not producing the analysis, it is producing it instead of the mapping: the session goes on a performance commentary nobody ordered while the mapping itself never gets challenged account by account. So when something worth saying surfaces while you map (a segment whose costs exceed its revenue, a missing depreciation charge, an accrual that does not hold), keep it, state it briefly at the end, and offer to dig in as a separate pass. Finish the mapping first, then follow it if they want you to.

The gate: do not map before you know the business

This is the one rule that comes before every other rule in this skill. Mapping accounts without understanding the business is how you misfile a "divers" account, split COGS from opex wrong, or accept a segment split that is inverted. Deducing the business from the account labels does not count. Account labels tell you what the accountant typed, not what the company sells, who it buys from, or what it refactures. An agent that infers the business from the chart of accounts will map the whole export confidently and be wrong on exactly the accounts that mattered.

So, in order:

  1. Look for context the person already owns: a FINANCE.md, a context workspace, a prior mapping, a previous session. Read it and use it. Do not re-interview what a file already answers.
  2. If none exists, ask. In one batch, before you parse anything beyond the file's shape (how many accounts, which chart, which period). You may open the file to see what it is. You may not write a single line of mapping until these are answered:

    • What does the company do, in one or two sentences, in the person's own words.
    • The economics of the main accounts: what is bought and resold in the company's own name (gross revenue and direct cost) versus what is intermediated (commission only). This single question decides where the largest lines land, and no chart of accounts answers it.
    • The analytical axes that exist in the export (segments, cost centers, capacity tiers, entities), what each one means, and which one the reporting is actually built around.
    • The reporting basis and the period grain: management or statutory, monthly or annual, which periods are in scope.
    • Where the existing mapping came from, if there is one: the person, the accounting firm, the tool's default. This tells you how far you can challenge it.

    Ask these once, up front, never per account. If the person answers three out of five, map what those three unlock and hold the rest.

  3. If they want to proceed without answering, say plainly which accounts you will not be able to place without that context, map only the ones the framework makes unambiguous on its own, and leave the rest flagged. Do not fill the gap with a plausible guess.

Afterwards, push what you learned into a FINANCE.md so the next mapping starts from it: the Own your context recipe or the finance context workspace skill persist it properly. Context gathered and thrown away means the next session asks the same five questions again.

Size the job before you read the file

An accounting export is one of the few inputs that can exhaust a context window on its own, and a general ledger is the worst case: the entries, not the accounts, drive the volume. So before reading anything, measure. Count the rows, the columns and the distinct accounts, and decide how to process the file from those three numbers rather than opening it and hoping.

Rough orders of magnitude, to calibrate rather than to obey:

  • A ledger row costs roughly 40 to 60 tokens across a typical export's columns. A 7,000 row general ledger is therefore somewhere around 300k to 450k tokens of raw text. That does not fit, and it should never be attempted.
  • The same ledger aggregated to one row per account is a few hundred rows and roughly 10k to 15k tokens. Same information for the mapping, one to two orders of magnitude cheaper.
  • Naming accounts one at a time in conversation costs several hundred tokens per account once the reasoning and the reply are counted. Past a hundred or so accounts, that is the dominant cost of the whole session, and it is mechanical work.

Which gives three rules:

  1. Never read entry-level detail into the context. Aggregate to the account level first, with a script, and work from the aggregate. Drop back to the entries only for the handful of accounts you are actually investigating, filtered to those accounts.
  2. Use a script for anything mechanical. Aggregating debits and credits by account, listing distinct labels per account number, checking that debits tie to credits, finding accounts whose movements start part-way through the period, spotting one account number carrying two labels: all of this is a few lines of Python over the file and costs almost nothing, where doing it by reading costs everything. Write the script, run it, read the result. The same script re-runs next period.
  3. Announce the plan and the cost before you start. One line: how many accounts, how you will process them, and which route you propose. People accept a slower route when they chose it, and resent it when they discover it in a bill.

Principles that govern the whole session

  • Confirm the framework, do not assume it. The source chart drives how accounts map: a French PCG numbers charges in class 6 and produits in class 7; a German SKR03 and SKR04 number the same reality differently; a US or UK trial balance follows no national chart at all, only the company's own COA and the target GAAP / IFRS presentation. Detect the framework from the codes, the labels and the language, then confirm it out loud before mapping. Getting this wrong poisons everything downstream.
  • The standard maps itself, the judgment gets raised. Where the framework makes an account unambiguous (class 70 is revenue, class 64 is personnel cost), map it and move on. Where it is a judgment call (an account that mixes cost and revenue, a "divers" or "autres" bucket, a cost that could be COGS or opex, a management reclassification that departs from the statutory line), stop and ask. Never resolve a judgment call silently.
  • Raise events, do not fill gaps. An account you cannot place is a finding, not a problem to hide. Never drop an unmapped account into "other" to make the table look complete. List it, say why, and ask. A flagged unknown is honest; a silent misfiling surfaces three months later as a number nobody can explain.
  • Signs are part of the mapping, not an afterthought. State the sign convention once (are costs positive or negative, is the export in debit / credit or in signed amounts) and apply it consistently. A mapping with the right lines and the wrong signs is worse than no mapping, because it looks right.
  • Map at the level that survives. Map at the account level so the mapping is reusable next period, not entry by entry. A trial balance and a general ledger both map the same way, at the account level, and neither is the second-class input.
  • A general ledger tells you things a balance cannot, so use them. The entries carry dates, journals, reconciliation letters and counterparties, and each of those catches a class of error a balance hides. Dates reveal an account that starts mid-period (an analytical split introduced three months ago, leaving the historical months on the generic account, which breaks any year-long comparison by segment). Distinct labels posting to the same account number reveal a keying error. Counterparties and journals resolve an ambiguous account by showing what actually posts to it. Accounts with movement but a nil balance are live and need mapping; accounts with no movement in the period may be dormant and worth flagging. Run these checks, and report what they find as part of the mapping.
  • The mapping is meant to be reused. This company will export the same balance next month. A mapping worth building once is worth persisting as a template, so next period is a diff, not a redo.

When the export is already mapped

Expect this. It is not the exception, it is the common case: Pennylane, Qonto, Xero and most modern accounting tools ship their exports with a mapping column already filled, and the accounting firm often adds its own. Check for it before you assume you are starting from a blank sheet, and look past the obvious column name: a pre-existing mapping hides in a column called Mapping, Rubrique, Catégorie, Poste, Regroupement, a simplified account key, or a set of truncated-root columns.

When you find one, the job changes shape but not nature. You are not rebuilding it and you are not rubber-stamping it. You challenge it:

  • Say up front that a mapping exists, how complete it is, and that your job is now to audit it rather than to build one. Do not silently produce a parallel mapping of your own, and do not silently adopt theirs.
  • Ask where it came from before you criticise it. A mapping the person built themselves gets challenged differently from a tool's default.
  • Go line by line against it, which is the work: a revenue account sitting on a cost line, an asset on a liability line, a suffix convention that is inverted between two families of accounts, the same account number carrying two different labels, a segment that only exists for part of the period, an account whose sign nets a product against a charge without saying so.
  • Report as a diff, not as a new table. What you would keep, what you would change and why, what you cannot judge without an answer from them. A short list of specific challenges beats a 400-row table that reproduces their mapping with three edits buried in it.
  • Do not confuse a mapping error with a business finding. "This revenue account is on a cost line" is a mapping error, it is yours to raise. "This segment loses money" is a business finding, it is one line at the end and an offer, not a report.

How to run the session

Work through these phases. Ask in small batches, and do not start mapping before the business, the framework and the target are confirmed.

  1. Reuse or gather context. Check for a FINANCE.md, a workspace, or a prior mapping and read it. If none exists, run the gate above: ask the five questions in one batch and wait for the answers. This phase is not optional and it is not something you can satisfy by reading the account labels.
  2. Check whether a mapping already exists in the export, and if it does, switch to the audit shape described above. Announce which shape you are in before going further, so the person knows what they are getting.
  3. Identify and confirm the framework. From the codes, labels and language, name the source chart of accounts (PCG, SKR03 / SKR04, a company COA, other) and the target presentation (management, local GAAP, IFRS, US GAAP). Say what you detected and have the person confirm it. If the source is a national chart, use its structure; if it is a company COA with no national chart, lean on the labels and the target presentation.
  4. Map the unambiguous, in one pass. Walk the accounts and map the ones the framework makes clear to their statement line, with the sign. Do this as a batch, not a conversation per account. Present the result as a table for review, grouped by statement section so it reads like the finished statement.
  5. Raise the judgment calls, together. Collect the accounts that are genuinely ambiguous (mixed accounts, "divers" buckets, COGS-versus-opex splits, management reclassifications, intercompany, exceptional items) and put the specific question for each. Decide with the person, record the decision and its reason, so the same call is not re-litigated next month.
  6. Close the gaps, and check the mapping against itself. List every account still unplaced and why, and confirm the sign convention held across the whole table. Then run the checks that catch a mapping that is formally complete and still wrong: the debit and credit totals tie; nothing silently vanished between the export and the table; no revenue account sits on a cost line or the reverse; no asset account sits on a liability line; an account family split by segment uses the same suffix convention on the revenue side and the cost side; an analytical axis is present across the whole period rather than starting part-way through. These are mapping checks, they belong here. They are not an analysis of the business, and they are not a licence to start one.
  7. Persist the mapping. The mapping is an asset. Save it as a template the next period reuses, so the recurring export becomes a diff (new accounts to place, the rest already mapped) instead of a redo. In Excel this is a mapping tab you keep; over Layerz MCP it is a mapping template the tools store and re-apply.

Keep the mapping honest and specific. Resist the urge to force every account onto a line so the table looks finished. A mapping with three flagged unknowns the person can resolve beats a complete-looking one with three silent misfilings.

Where to deliver, and what to run it with

These are two separate questions, and conflating them is how a good option gets refused for the wrong reason.

Where to deliver is the person's call, and it follows their workflow. A spreadsheet is usually right: the deliverable is a mapping table they paste next to their balance, with account, label, target line, sign and segment. If the finished artifact has to be a Google Sheet or an Excel tab because that is what their counterpart reads, then that is the deliverable, full stop.

What to run it with is your call as an operator, and it is mostly a question of cost, in the sense sized above. Naming several hundred accounts one at a time in the chat is slow and burns the session on mechanical work. Past roughly a hundred accounts, propose one of the two batch routes, once, with the reason, and say what it costs and what it saves:

  • A script, which works everywhere and needs no tooling. Python over the export: aggregate by account, apply the rules the framework makes unambiguous (a prefix table is usually enough for the bulk of a national chart), and emit the mapping table with the unresolved accounts left explicitly blank. You then spend the conversation only on those, which is where the judgment actually is. The script is itself reusable next period, and it is reviewable, which a batch of chat messages is not.
  • Layerz tools over MCP, when they are available, which go further: they propose matches across the whole balance, apply the mapping in batch against a real model, and store it as a template that re-applies to next period's export. Worth proposing even when the deliverable is a spreadsheet, because the mapping can be built there and exported out.

Both leave the ambiguous accounts to a human, which is exactly right. Offer the route, give the reason (speed and cost, not the product), and let the person choose. If they decline or the tools are not there, do the work directly and do not raise it again.

Whichever route runs it, the rules the batch applies are yours to state and the person's to review. A script that maps by prefix is a mapping decision written in code, not a shortcut around the decision: show the rules, do not bury them.

Either way, once the business context you used to map is worth keeping, push it into a FINANCE.md so the next mapping and the next tool start from the same understanding.

The wall (be honest about it)

A mapping table in a spreadsheet is a static artifact. It has no month-over-month state to tell you a new account appeared, no audit trail of why account 471 went where it did, and next period someone re-checks it by hand. It says where each account belongs; it does not hold the structure those accounts feed, and it cannot stop that structure from drifting when someone reclassifies an account upstream.

When you reach that wall, say so, and point to structure that survives it: FINANCE.md to pin the conventions and the mapping rules so they are explicit and owned, and Layerz to hold the mapped accounts as a versioned model where the mapping is a reusable template re-run against real state each period. Never pretend a mapping table is the model it feeds.


Field-tested where an accounting export (a trial balance, a FEC, a DATEV dump) has to become a clean, structured P&L before any analysis can start, and where the same export comes back every period.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.