Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .claude/skills/open-phase-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ Stop and report if any check fails. Never open a PR on a red local build.

If `scripts/` changed, also run `python -m unittest discover -s scripts`.

- **Documentation.** Invoke the `update-docs` skill on the branch, every time, before pushing. It maps the diff to `docs/architecture/*` and `docs/business/*`, updates them, renders every Mermaid diagram and checks the links. It then commits the documentation changes on the branch. Keep its report for the PR body. A phase is not ready if a diagram fails to render or a document still describes the old behaviour.

## 3. Push and write the body

- `git push -u origin <branch>`.
- Write the body to a file in the scratchpad, following `.github/pull_request_template.md` section by section:
- **Roadmap phase:** `Phase: <number> <title>`, `Planning package: specs/<folder>/`, then `Closes #<issue>`.
- **Summary:** what changed and why, in business language, grouped by type or concern. Name the commands vs queries (CQRS) and any ADR written or amended.
- **Definition of done:** copy every item from the template. Tick what is met, write `N/A: <reason>` for items that do not apply, and leave **CI green** unticked (CI has not run yet).
- **Validation:** the commands from step 2 with their results (test counts), and the manual or break-on-purpose checks from `validation.md` that were run.
- **Validation:** the commands from step 2 with their results (test counts), and the manual or break-on-purpose checks from `validation.md` that were run. Add a **Documentation** line from the `update-docs` report: the documents updated and the diagram render count, or "No documentation impact" with the reason.
- **Review focus:** the decisions a reviewer should challenge, and the open questions from `requirements.md`.
- End with the attribution line from the session's system reminder, if there is one.
- Title: imperative, describes the change, ends with `(roadmap <phase>)`. Look at `gh pr list --state merged --limit 5` for the house style.
Expand Down
5 changes: 4 additions & 1 deletion .claude/skills/plan-feature/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,12 @@ How we know the implementation succeeded and can be merged. Start from the phase
- [ ] All checks above pass in CI
- [ ] Roadmap checkbox ticked in the same PR
- [ ] ADRs written for significant decisions
- [ ] ... (no secrets or PII in logs, docs updated, etc.)
- [ ] Documentation updated with the `update-docs` skill: every affected `docs/architecture/` and `docs/business/` document, all Mermaid diagrams render
- [ ] ... (no secrets or PII in logs, etc.)
```

**Documentation tasks.** Before writing `plan.md`, use the `update-docs` skill's mapping table (`.claude/skills/update-docs/SKILL.md`, step 2) on the phase's scope. List the documents the phase will change as the last task group of `plan.md`, "Documentation". Name each document and what it gains, for example "Biz 02: glossary section for ProductDirectoryEntry" or "Arch 05: decision tree for Launch". If the phase has no documentation impact, say so there with the reason.

## 6. Wrap up

Summarise for the user: the phase, the branch name, the folder path, and one line per file on what it contains. Do not commit unless the user asks; offer to commit the three files on the planning branch.
97 changes: 97 additions & 0 deletions .claude/skills/update-docs/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
name: update-docs
description: Keep RimBank's architecture and business documentation (docs/README.md, docs/architecture/*, docs/business/*) in step with the code. Works out which documents and Mermaid diagrams a change affects (a new service domain, BIAN operation, Behavior Qualifier, field, enum value, event, error code, table, dependency, policy, MCP tool, deployment or security change), updates or adds them, renders every diagram to prove it parses, and checks every link. Use this before any pull request is opened (open-phase-pr calls it), when a phase is planned (plan-feature lists its doc tasks), and whenever the user asks to add, update, refresh, check or review the documentation, the diagrams, the C4, ERD, sequence, flow, glossary or value streams, even if they don't say "update-docs".
---

# Update the architecture and business documentation

`docs/` describes `main`. A pull request that changes behaviour shown in a document updates that document in the same pull request (`docs/README.md` "Conventions"). Code and ADRs win when they disagree with a document, so fix the document, never the other way round.

## 1. Find what changed

- Base: `git merge-base HEAD origin/main`. Read `git diff --stat <base>...HEAD` and `git log <base>..HEAD --oneline`.
- When planning (called from `plan-feature`), use the phase's `requirements.md` scope instead of a diff.
- Read the changed core, adapter and host files, and any new or changed ADR. Use the ADRs and code as the source of facts. Never use memory of earlier versions.

## 2. Map the change to documents

Use this table. A change usually touches several rows. "Arch" means `docs/architecture/`, "Biz" means `docs/business/`.

| Change in the diff | Update |
|---|---|
| **New service domain** (new folder in `RimBank.Core`, new `.Postgresql` / `.PublishedLanguage`, new module) | Arch 02 (containers, a new component diagram for the context, the code-level class diagram), Arch 03 (logical ERD, event model, schema, role), Arch 06 (cross-context data flow: move it from *(target)* to today), Arch 07 (project graph, context map), Arch 08 (Aspire topology, role connection string), Arch 09 (readiness, timeline). Biz 01 (capability status), Biz 02 (**new glossary section** for its Control Record and BQs), Biz 03 (relationships to Party and others), Biz 04 (value stream stage status, matrix), Biz 05 (use cases it enables). `docs/README.md` if a new document is added |
| **New BIAN operation** (endpoint + command or query + MCP tool) | Arch 04 (sequence if it adds a new pattern, otherwise the operation table), Arch 05 (decision tree), Arch 08 (policy/scope table if new scopes). Biz 02 (operations, errors), Biz 05 (the use cases that use it) |
| **New or changed field, value object, enum value** | Arch 03 logical ERD attributes. Biz 02 member table or enum table (definition, ISO/BIAN format, rules, business use, PII class). Biz 03 if it links parties |
| **New domain event or event type name** | Arch 03 event model (with its Marten type name from `…Postgresql.Configure`) |
| **New or changed integration event / channel** | Arch 03 published language section, Arch 06 data flows, Arch 07 context map. Biz 02 events section, Biz 05 consumer guide |
| **New decision rule or error code** | Arch 05 decision tree, in the code's real order, with the exact error code. Biz 02 error table |
| **New lifecycle or status** | Arch 05 state machine. Biz 02 enum meaning |
| **New read model / projection** (inline or async) | Arch 03 read models table (and physical table), Arch 06 CQRS paths, Arch 05 rebuild if the procedure changes |
| **Project reference, package, dependency rule, architecture test** | Arch 07 graph, matrix, rules table, packages. Arch 01 decisions if an ADR changed |
| **Request pipeline** (headers, filters, idempotency, concurrency, auth order) | Arch 05 §1 pipeline, Arch 04 sequences 1–4 and 9 |
| **Security** (scopes, policies, MCP auth, PII handling, secrets) | Arch 08 controls and STRIDE, Arch 06 data classification |
| **Deployment / observability / CI** | Arch 08 |
| **New ADR** | Arch 01 key decisions table if it is architecturally significant. Any document that cites a superseded ADR |
| **Roadmap phase completed** | Status lines and *(target)* markers in every document that mentions it. Arch 09 readiness and risks. Biz 04 stage status. Root `README.md` status line |
| **Pure refactor, tests only, internal rename with no behaviour change** | Usually nothing. Still grep `docs/` for renamed type, file or route names |

Then grep for stale names. Every type, route, tool, error code or table the diff renamed or removed must not survive in `docs/`:

```bash
grep -rn "<old name>" docs/ README.md
```

## 3. Edit

- Keep each document's structure and voice: tables, short sentences, and BIAN and banking vocabulary. The business documents are for bank analysts and architects, so explain business meaning there, not C# detail.
- Mark anything not yet on `main` as *(target)*, and remove the marker when it ships.
- Business definitions: quote BIAN verbatim from `doc-0/release14.0.0/apis-iso20022_ext-ddd/`. Cite the exact standard (ISO 20022 `MaxNText`, ISO 17442, ISO 3166-1 alpha-2, ISO 4217, ISO 8601, ITU-T E.164, RFC 9457). Say clearly when a meaning is RimBank's interpretation.
- Every new field gets a PII class in Biz 02 and, if personal, a row in the Arch 06 classification.
- Link ADRs and specs with relative paths, as the existing documents do.
- Add a new document only when no existing one fits, and then add it to `docs/README.md` and to the folder's own README.

### Mermaid rules (GitHub renders these)

- Never put `;` in sequence diagram messages or notes: it ends the statement. Use a comma.
- In flowcharts, quote a label that contains `(`, `)`, `[`, `]`, `{`, `}`, `:` or `#`: `A["text (detail)"]`.
- In `erDiagram`, entity names and attribute types are single tokens (letters, digits, `_`). Put explanations in the quoted comment.
- Use `<br/>` for line breaks in labels.

## 4. Verify (mandatory)

Render every Mermaid block in `docs/`. A diagram that does not parse shows as an error on GitHub.

```bash
S=<scratchpad>
mkdir -p "$S/mmd" "$S/out"
for f in docs/architecture/*.md docs/business/*.md; do
awk -v base="$S/mmd/$(basename $f .md)" '/^```mermaid/{n++; out=base"__"n".mmd"; inb=1; next} /^```/{if(inb){inb=0; close(out)}; next} inb{print > out}' "$f"
done
# one-off install in the scratchpad: npm install @mermaid-js/mermaid-cli@11.4.2
# no bundled Chrome: point puppeteer at Edge or Chrome, e.g.
# {"executablePath":"C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe","headless":"new"} > "$S/pptr.json"
for f in "$S"/mmd/*.mmd; do
"$S/tool/node_modules/.bin/mmdc" -q -p "$S/pptr.json" -i "$f" -o "$S/out/$(basename $f .mmd).svg" || echo "FAIL $f"
done
```

Check that every relative link resolves:

```bash
for f in docs/README.md docs/architecture/*.md docs/business/*.md README.md; do d=$(dirname $f)
grep -oE '\]\([^)#]+(#[^)]*)?\)' "$f" | sed -E 's/^\]\(//; s/\)$//; s/#.*//' | grep -v -E '^(https?:|mailto:)' | sort -u |
while read l; do [ -n "$l" ] && [ ! -e "$d/$l" ] && echo "BROKEN in $f: $l"; done; done
```

For a large diagram change, render it to PNG (`-o x.png -w 1800 -b white`) and look at it.

## 5. Report

Tell the caller, briefly:

- the documents updated or added, with one line each on what changed;
- the rows of the table that applied but needed no change, and why;
- diagram render count (`n/n`) and link check result;
- any fact you could not confirm from code or ADRs (leave it out of the document, or mark it as an assumption).

When called from `open-phase-pr`, commit the documentation changes on the phase branch before the push (message: what the docs now cover, ending with the session's attribution line), and add a **Documentation** line to the PR body's Validation section: the documents updated, or "No documentation impact" with the reason.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Planning package: `specs/YYYY-MM-DD-<slug>/`
- [ ] Every new BIAN operation exposed over HTTP is also exposed as an MCP tool, with a parity test
- [ ] GitHub Actions CI green (build, test, format, CodeQL)
- [ ] An ADR in `docs/adr/` for any significant or BIAN-interpretation decision
- [ ] Architecture and business documentation (`docs/architecture/`, `docs/business/`) updated for the change, with every Mermaid diagram rendering (the `update-docs` skill)
- [ ] The roadmap checkbox ticked in the same PR

## Validation
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

The code is meant to read like the business it serves. Every BIAN service domain becomes a bounded context, and its names, flows and capabilities come from BIAN and banking, not from frameworks. Every capability is available both as a BIAN HTTP API and as an [MCP](https://modelcontextprotocol.io) tool for AI agents, over the same core and with the same business rules.

> **Status:** early development, Stage 0 (Foundations). See the [roadmap](specs/roadmap.md).
> **Status:** early development. Stage 0 (Foundations) and Stage 1 (Party Reference Data Directory) are done; Stage 2 (Product Directory) is next. See the [roadmap](specs/roadmap.md).
> RimBank is not a licensed bank and provides no regulatory certification.

## How BIAN maps to the code
Expand Down Expand Up @@ -54,6 +54,7 @@ To run RimBank (Docker required): `dotnet run --project src/RimBank.AppHost`, th
- [Mission](specs/mission.md): why RimBank exists, guiding principles, quality bar, non-goals
- [Tech stack and architecture rules](specs/tech-stack.md)
- [Roadmap](specs/roadmap.md) and its Definition of done
- [Architecture and business documentation](docs/README.md): C4, data model, sequences, flows, dependencies, security; BIAN positioning, party glossary, relationships, value streams, use cases
- [Architecture decision records](docs/adr/)
- [BIAN v14 specifications](doc-0/release14.0.0/)

Expand Down
42 changes: 42 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# RimBank documentation

Two views of the same platform. Start with the one that matches your question; each links to the other.

| If you want to know… | Read |
|---|---|
| What RimBank does for a bank, where it fits in BIAN, what each party field means, which value streams it serves | [Business documentation](business/README.md) |
| How it is built: C4, data model, sequences, logic flows, data flow, dependencies, security, operations, risks | [Architecture documentation](#architecture-documentation) |
| Why a specific decision was made | [Architecture decision records](adr/) |
| The rules every change must follow | [Mission](../specs/mission.md), [tech stack](../specs/tech-stack.md), [roadmap](../specs/roadmap.md) |

## Business documentation

| # | Document | For |
|---|---|---|
| 1 | [Business architecture](business/01-business-architecture.md) | BIAN positioning, capability map, adoption patterns |
| 2 | [Party domain glossary](business/02-party-domain-glossary.md) | Every entity member, enumeration, event and error, with ISO / BIAN definitions |
| 3 | [Entity relationships](business/03-entity-relationships.md) | Business ERD, cardinalities, worked examples |
| 4 | [Value streams](business/04-value-streams.md) | End-to-end value delivery and which service domain serves each stage |
| 5 | [Banking use cases and integration guide](business/05-banking-use-cases.md) | KYC, PEP, beneficial ownership, FATCA/CRS, servicing, AI agents; consuming Party events |

## Architecture documentation

| # | Document | For |
|---|---|---|
| 1 | [Architecture overview](architecture/01-architecture-overview.md) | Drivers, quality priorities, styles, key decisions, BIAN → architecture mapping |
| 2 | [C4 model](architecture/02-c4-model.md) | System context, containers, components, code |
| 3 | [Data model and ERD](architecture/03-data-model-erd.md) | Logical ERD, event model, physical PostgreSQL model, published language, read models |
| 4 | [Sequence diagrams](architecture/04-sequence-diagrams.md) | Register, idempotent replay, Retrieve/ETag, Update/concurrency, cross-aggregate checks, associations, verification, MCP, errors, cross-context (target) |
| 5 | [Logic flows and state machines](architecture/05-logic-flows.md) | Request pipeline, every decision tree, lifecycles |
| 6 | [Data flow](architecture/06-data-flow.md) | DFD levels 0–1, CQRS paths, cross-context data, classification, lineage |
| 7 | [Dependencies](architecture/07-dependencies.md) | Project graph, dependency matrix, hexagon, packages, runtime, context map |
| 8 | [Deployment, security and operations](architecture/08-deployment-security-operations.md) | Aspire topology, reference production deployment, trust boundaries, STRIDE, observability, CI/CD |
| 9 | [Quality attributes, risks and roadmap](architecture/09-quality-risks-roadmap.md) | Quality scenarios with evidence, risks, deferrals, readiness for Stage 2 |

## Conventions

- Diagrams are [Mermaid](https://mermaid.js.org) in the Markdown, so they render on GitHub and change in the same pull request as the code.
- Every document states whether it describes `main` today or a *(target)* from the roadmap.
- When a document and the code or an ADR disagree, the code and the ADR win: fix the document in the same pull request.
- A phase that changes a diagrammed behaviour (a new context, operation, event, table or rule) updates the affected document as part of its definition of done.
- The `update-docs` Claude Code skill ([`.claude/skills/update-docs/SKILL.md`](../.claude/skills/update-docs/SKILL.md)) maps a change to the documents it affects, updates them and renders every diagram. `plan-feature` uses it to plan the documentation tasks, and `open-phase-pr` runs it before every pull request.
Loading
Loading