Przejdź do treści
Biblioteka skilli
Finanse i księgowość · Budowanie i kod

accounting-engine

/accounting-engine

Pomaga projektować i wdrażać politykę księgowości podwójnego zapisu i wbudowany silnik księgi głównej: faktury, płatności, zapasy, zbalansowane księgowania, idempotencję i blokady okresów.

Licencja
MIT
Ostatnia zmiana repozytorium
24.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
6
Skrypty
1
Komentarze HTML
2
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 24.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • 1 skrypt w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.
  • SKILL.md zawiera komentarze HTML (2). Nie widać ich w podglądzie Markdown, a model je czyta.

Skrypty: references/chwezi-finance-engine-skeletons/php-mysql/posting-service-skeleton.php

Co robi i kiedy

Pomaga projektować i wdrażać politykę księgowości podwójnego zapisu i wbudowany silnik księgi głównej: faktury, płatności, zapasy, zbalansowane księgowania, idempotencję i blokady okresów.

Oryginalny opis (EN)

Use when designing or implementing double-entry accounting policy and an embedded ledger engine for invoices, payments, stock, balanced postings, mapped accounts, idempotency, reversals, period locks, audit trails, and financial statements.

Jak działa

  1. Evidence Produced
  2. Inputs
  3. Outputs
  4. Capability contract
  5. Degraded mode
  6. Decision rules
  7. Domain anti-patterns
  8. Use When
  9. Do Not Use When
  10. Hard Rules
Sekcje z nagłówków SKILL.md, w oryginale · 174 linii, 1 021 słów
Podgląd SKILL.md
---
name: accounting-engine
description: Use when designing or implementing double-entry accounting policy and an embedded ledger engine for invoices, payments, stock, balanced postings, mapped accounts, idempotency, reversals, period locks, audit trails, and financial statements.
metadata:
  portable: true
  required_inputs: Provide the transaction event, tenant, accounting policy, chart mapping, and existing ledger contract.
  workflow: Follow the posting invariants, mapping, idempotency, reversal, lock, and verification workflow in this file.
  quality_standards: Preserve double-entry balance, tenant isolation, immutability, traceability, and tested failure handling.
  anti_patterns: Do not post directly from feature code, mutate journals, bypass locks, or infer accounts without mappings.
  outputs: Produce posting contracts, journal evidence, mapping decisions, controls, and integrity tests.
  default_standard: IFRS for SMEs
  compatible_with:
  - claude-code
  - codex
---

# Accounting Engine

<!-- dual-compat-start -->
## Evidence Produced

| Category | Artifact | Format | Example |
| --- | --- | --- | --- |
| Correctness | Ledger invariant test pack | Markdown plus transaction fixtures | balanced posting, idempotency, reversal, period lock, subledger tie-out, and audit trail |
<!-- dual-compat-end -->

## Inputs

| Artefact | Required? | Purpose |
|---|---|---|
| Transaction event and tenant context | yes | Define the event and isolation boundary |
| Account mapping and doctrine policy | yes | Resolve balanced ledger accounts |
| Existing ledger and lock state | yes | Prevent duplicate or closed-period posting |

## Outputs

| Artefact | Consumer | Acceptance condition |
|---|---|---|
| Posting contract and journal evidence | Feature services and finance review | Balanced, idempotent, traceable, tenant-scoped |

## Capability contract

Read and search are required. Database writes, migrations, backfills, reversals, and period operations require explicit authority and a verified compensating path.

## Degraded mode

Fallback without doctrine, mappings, or database access: return a posting design and unresolved control list; do not invent accounts or claim ledger correctness.

## Decision rules

| Condition | Posting action | Failure avoided |
|---|---|---|
| New valid economic event | Append balanced journal | Missing financial record |
| Duplicate idempotency key | Return prior result | Double posting |
| Error in posted journal | Post linked reversal/correction | Destruction of audit history |
| Closed period | Reject or use authorised later-period adjustment | Period integrity breach |

## Domain anti-patterns

- Posting directly from controllers. Fix: use one posting service and contract.
- Updating or deleting journals. Fix: reverse and repost with links.
- Guessing accounts from feature names. Fix: require mapping-layer resolution.
- Retrying without idempotency. Fix: persist and enforce the event key.
- Mixing tenants in one posting context. Fix: require tenant scope on every ledger operation.

## Use When

- The product handles money, inventory value, payroll, tax, customer balances, supplier balances, assets, grants, donations, loans, refunds, wallet balances, or financial reporting.
- A SaaS must replace routine bookkeeping in external products such as QuickBooks, Xero, Sage, Pastel, Tally, Zoho Books, or Wave.
- You need architecture, schema, posting rules, tests, documentation, or review findings for ledger-backed business software.

## Do Not Use When

- The task is only financial analysis or projections without software architecture; use `accounting-finance-controller` or the business-plan finance skills.
- The system only displays imported accounting reports and does not create business events or postings.
- A jurisdiction requires a licensed accountant, auditor, or tax practitioner to exercise professional judgement; design the system support, but do not claim the software replaces that judgement.

## Hard Rules

- NEVER let a business module write directly to `gl_entries`, `journal_lines`, `journal_entries`, or any ledger table.
- ALWAYS write ledger records through one service: `LedgerPostingService::post(JournalEntry $entry)` or the project-equivalent single posting service.
- NEVER update, delete, or soft-delete posted journal lines. Corrections are reversing journals linked to the original entry.
- NEVER store authoritative balances that cannot be rebuilt from journal lines. Materialized balances are caches with a documented rebuild command.
- NEVER hardcode account codes in business logic. Use account mappings resolved at posting time.
- NEVER use LIFO for IFRS or IFRS for SMEs tenants.
- MUST reject posting when required account mappings are missing, inactive, cross-tenant, or not valid for the source document.

## Canonical Architecture

Business modules emit events. A mapper turns events into balanced `JournalEntry` value objects. The posting service validates and writes the entry atomically. Reports, subledgers, balances, tax schedules, and dashboards are deterministic projections of the ledger.

```text
Sales / Stock / Payroll / Assets / Payments / Grants
        -> business event
        -> account resolver and posting-rule mapper
        -> JournalEntry value object
        -> LedgerPostingService::post()
        -> append-only journal_entries + journal_lines
        -> reports, subledgers, tax schedules, dashboards
```

## Required Model

Core tables:

- `chart_of_accounts`
- `account_mappings`
- `journal_entries`
- `journal_lines`
- `accounting_periods`
- `posting_rule_versions`
- `accounting_integrity_runs`
- `accounting_audit_log`

Every accounting table MUST carry `tenant_id`, unless the product is explicitly single-tenant. If legacy files use `franchise_id`, treat it as a project-specific tenant alias and document the mapping.

## Posting Service Contract

```php
<?php
declare(strict_types=1);

final readonly class JournalEntry
{
    public function __construct(
        public int $tenantId,
        public string $idempotencyKey,
        public DateTimeImmutable $entryDate,
        public string $sourceType,
        public string $sourceId,
        public string $description,
        /** @var list<JournalLine> */
        public array $lines,
        public ?int $reversesJournalId = null,
    ) {}
}

final readonly class JournalLine
{
    public function __construct(
        public int $accountId,
        public string $currency,
        public string $debitMinor,
        public string $creditMinor,
        public array $dimensions = [],
    ) {}
}

interface LedgerPostingService
{
    public function post(JournalEntry $entry): PostedJournal;
}
```

The service validates tenant scope, account status, open period, debit-credit equality, currency policy, idempotency, source document state, and mapping completeness before insert.

## Integrity Checks

Run these per tenant and per accounting period from day one:

- Debits equal credits per `journal_entry_id`.
- Trial balance total debits equal total credits.
- AR control account equals customer-tagged journal line balance.
- AP control account equals supplier-tagged journal line balance.
- Inventory control account equals stock-on-hand value by item/location/cost layer.
- Fixed asset control account equals asset-register cost less disposals.
- Payroll liability accounts equal unpaid statutory and employee deductions.
- No journal exists in a locked period unless it is a permitted reopening workflow with approval evidence.
- No ledger table has rows written outside the posting service.
- Materialized balances rebuild to the same values as stored cache rows.

## User Experience Principle

Non-accountants record business actions: `Record Sale`, `Receive Payment`, `Buy Stock`, `Run Payroll`, `Record Asset Purchase`, `Receive Grant`, `Close Month`. The system posts accounting behind the scenes. Accountant-facing roles get journals, CoA, mappings, period close, manual journal, and report exports.

## Companion Skills

- `ledger-posting-engine-core` (chwezi-accounting-doctrine) for IFRS-aligned industry templates.
- `inventory-costing-and-stock-accounting` (chwezi-accounting-doctrine) for IAS 2 stock valuation and COGS flows.
- `payroll-and-statutory-postings-east-africa` (chwezi-accounting-doctrine) for PAYE/NSSF/LST payroll journal shapes.
- `fixed-assets-and-depreciation` for IAS 16 asset lifecycle.
- `multicurrency-and-fx` for IAS 21 currency handling.
- `multi-tenant-saas-architecture`, `api-design-first`, and `advanced-testing-strategy` for platform integration.

## References

- `references/posting-engine-contract.md`
- `references/integrity-invariants.md`
Pliki w paczce (6)
  • SKILL.md 9 KB
  • references/integrity-invariants.md 1 KB
  • references/posting-engine-contract.md 2 KB
  • references/chwezi-finance-engine-skeletons/reviewer-checklist.md 3 KB
  • references/chwezi-finance-engine-skeletons/php-mysql/posting-service-skeleton.php 9 KB
  • references/chwezi-finance-engine-skeletons/php-mysql/schema.sql 7 KB

Wersje

W bazie nie ma innych skilli o nazwie accounting-engine.

Migawka bazy z 28.10.2026 · wersja paczki 99a99ed387d5 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100saas-accounting-system
    Projektuje księgowość podwójną w produkcie SaaS: automatyczne księgowania, księgi, kontrole, uzgodnienia i raporty finansowe.
  • 10016-accounting-engine-design
    Projektuje wbudowany silnik księgowy (SDS, HLD, LLD) z dziennikami append-only, usługą księgowania, okresami, storno, idempotencją, subksięgami, przebudowami i śladem audytu.
  • 10008-accounting-engine-test-plan
    Tworzy lub aktualizuje plan testów silnika księgowego: niezmienniki księgi, księgowanie, storno, kontrola okresów, uzgodnienia, migracja i dowody audytowe.
  • 90domain-fintech:ledger-design
    Projektuje księgę podwójnego zapisu: wpisy dziennikowe, plan kont, rozliczenia należności i zobowiązań, uzgadnianie oraz ślady audytu.
  • 100exact-online-nl
    Integruje się z Exact Online NL przez ujednolicone API Accounting Apideck, odczytując, zapisując i uzgadniając faktury, rachunki, płatności, konta księgowe i księgowania.
  • 100exact-online
    Integruje się z Exact Online przez ujednolicone API Accounting Apideck, odczytując, zapisując i uzgadniając faktury, rachunki, płatności, konta księgowe i księgowania.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.