Skip to content
Open
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
62 changes: 62 additions & 0 deletions .agents/skills/mavula-cloud-banking/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: mavula-cloud-banking
description: Design, implement, operate, and assess MAVULA as regulated cloud-native banking infrastructure. Use for real institutional workflows, module boundaries, financial operations, identity, payments, compliance, configurable and no-code products, composable APIs and events, production security, Kubernetes and AWS operations, resilience, observability, capacity, and high-scale readiness across all MAVULA repositories.
---

# MAVULA Cloud Banking

Use this skill for engineering work that can affect institutional access,
financial state, payment state, regulatory evidence, runtime reliability, or
platform configuration. Ground every decision in repository contracts and
observable failure behavior.

## Workflow

1. Read the context map, invariants, touched contracts, migrations, runtime code,
tests, and deployment configuration. Distinguish implemented behavior from
roadmap intent.
2. Name the owner, caller, data classification, tenant boundary, financial
effect, consistency requirement, idempotency identity, audit evidence, and
recovery path.
3. Trace the full operation across synchronous APIs, owner transaction,
Outbox/Inbox, Workbench jobs, projections, monitoring, and operator action.
4. Define compatibility and failure behavior before implementation: timeout,
duplicate, reordering, partial failure, retry exhaustion, replay, rollback,
and reconciliation.
5. Quantify production assumptions per service: SLO, workload, peak concurrency,
data growth, RTO/RPO, failure domains, and capacity-test evidence.
6. Implement within the owner boundary using the repository's established
language, database, contract, migration, and guardian patterns.
7. Verify invariant tests, contract tests, security boundaries, failure paths,
observability, operational recovery, and CI-equivalent checks.

## Hard Rules

- Identity context is signed and authoritative. Payload identity never grants
tenant, institution, branch, role, or permission.
- `ledger-core` alone owns financial invariants and journal posting. Posted
records are immutable; correction uses controlled reversal or adjustment.
- `settlements` owns external payment state. A settlement event does not mutate
ledger or lending directly; an authorized ledger command is required.
- `workbench` owns operational jobs, not business truth. Retry is bounded and
every side effect is idempotent and auditable.
- PostgreSQL and owner aggregates are authoritative. Redis is transport and
temporary operational state.
- Public APIs and events are versioned contracts. Consumers never depend on
producer tables, private DTOs, or deployment internals.
- Configuration is declarative, tenant-scoped, versioned, validated, bounded,
approved where required, and immutable after publication.
- Production claims require measured evidence. Regulatory and certification
claims require explicit scope and accountable approval.

## References

- Module authority and allowed integration: `references/module-ownership.md`.
- Real institutional workflows and failure paths: `references/banking-operations.md`.
- Security, data protection, and regulatory baseline: `references/security-regulation.md`.
- Kubernetes, AWS, resilience, observability, and capacity: `references/cloud-native-scale.md`.
- API composability and governed no-code configuration: `references/composability-no-code.md`.
- Language, PostgreSQL, Redis, and COBOL rules: `references/engineering-data.md`.

Load only the references relevant to the task. For reviews, use the companion
`mavula-review` skill so findings retain MAVULA severity and evidence format.
4 changes: 4 additions & 0 deletions .agents/skills/mavula-cloud-banking/agents/openai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface:
display_name: "MAVULA Cloud Banking"
short_description: "Engineer regulated, composable cloud-banking systems"
default_prompt: "Use $mavula-cloud-banking to design or implement this MAVULA change with explicit ownership, financial invariants, security, recovery, operability, and scale evidence."
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Banking Operations

## Institutional Access

1. `identity-access` authenticates the operator or workload and derives effective
institution, branch, tenant, roles, and permissions from persisted state.
2. Resource servers validate issuer, audience, signature, expiry, token purpose,
tenant binding, and operation permission before reading request data.
3. Sensitive actions record actor, effective role, source, correlation, result,
and maker-checker evidence without placing credentials or unnecessary PII in events.

## Product And Workflow Configuration

1. An authorized configuration operator submits a schema-valid tenant-scoped draft.
2. The owner validates references, deterministic rules, limits, effective dates,
and approval policy before activation.
3. Publication creates an immutable version and audit record. Runtime operations
retain the exact product, rule, schema, and workflow versions used.
4. Rollback activates a known compatible version; it never mutates history.

## Accounts, Ledger, And Lending

1. Every write requires authenticated tenant context, correlation, and durable
idempotency when it can create a financial or external side effect.
2. The owner validates account/product state, currency, precision, limits,
maker-checker, and later-effect constraints inside one transaction.
3. Journal lines balance by currency. Subledger, audit, receipt, and Outbox are
committed atomically with the owner state.
4. Freeze, unfreeze, close, reversal, and correction preserve immutable history;
self-approval and duplicate approval are rejected.

## Payments And Reconciliation

1. Workbench starts an authorized payment job with tenant, correlation, amount,
rail, parties, and idempotency identity.
2. Settlements persists the process before external interaction and authenticates
callbacks before durable dedupe and explicit state transition.
3. Reconciliation compares provider, process, and expected ledger references.
Mismatch remains actionable and cannot be hidden by job success.
4. Settlement completion is recorded in Outbox and published by Workbench.
Ledger Core records Inbox idempotently and performs no direct financial
mutation from the event.

## Regulatory And Legacy Processing

1. An authorized compliance operator requests an export with period, legal basis,
retention, tenant, and idempotency context.
2. Ledger Core provides the approved source contract; Legacy Connectors generates
deterministic fixed-width content, totals, checksum, receipt, and artifact.
3. Workbench controls leases, bounded retries, DLQ, and delivery recording.
Imports remain staging and validation only unless a future owner command is approved.

## Incident And Recovery

- Diagnose owner state separately from queue state. A completed job does not prove
a completed business operation.
- Replay requires authorization, reason, original correlation, dedupe, and audit.
- Recovery verifies database consistency, Outbox/Inbox backlog, queue lag, DLQ,
settlement reconciliation, projection freshness, and regulatory artifact integrity.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Cloud-Native Scale

## Service Readiness Budget

Every production service or material change must document:

- availability and latency SLOs with measured indicators and error-budget owner;
- normal, peak, burst, and degraded workload plus concurrency and tenant skew;
- data volume, growth, retention, hot-key or hot-tenant risk, and capacity horizon;
- RTO, RPO, backup frequency, restore procedure, and last recovery-test evidence;
- regional and zonal failure domains, dependency assumptions, and degradation mode;
- load, soak, fault, retry-storm, and recovery evidence at the claimed envelope.

Do not invent one platform-wide number. Missing budgets invalidate production-ready
and scalable claims.

## Kubernetes-Neutral Baseline

- Keep domain services stateless between requests. Persist authority in owner
PostgreSQL and durable queues or stores designed for the required semantics.
- Define requests and limits, startup/readiness/liveness probes, graceful shutdown,
termination budgets, PodDisruptionBudget, topology spread, anti-affinity, and
horizontal scaling from measured saturation or backlog signals.
- Apply restricted workload security, non-root execution, read-only filesystems
where possible, explicit service accounts, NetworkPolicy, controlled egress,
signed immutable images, SBOM/provenance, and admission policy.
- Separate migrations from runtime rollout. Use expand/contract migrations,
bounded locks, compatibility windows, and tested rollback or forward-fix paths.
- Autoscaling must account for database connections, queue visibility/leases,
partition ordering, idempotency contention, and provider rate limits.

## Data And Messaging Scale

- Size PostgreSQL pools across all replicas; inspect plans, indexes, lock duration,
vacuum pressure, transaction age, replication lag, and backup/restore throughput.
- Partition only with a documented key, pruning evidence, migration path, and
tenant-skew analysis. Sharding never weakens owner invariants or auditability.
- Redis is non-authoritative. Namespace keys, define TTL and eviction behavior,
cap retries, monitor memory and queue lag, and design poison-message isolation.
- Outbox/Inbox publishers use leases, bounded batches, retry backoff, dedupe, and
backlog metrics. Backpressure must fail predictably instead of dropping work.

## AWS Adapter

- Keep AWS-specific resources in `operations`. Map the neutral baseline to EKS,
managed PostgreSQL, managed Redis, KMS, workload identity, Secrets Manager or
External Secrets, object storage, load balancing, and native audit telemetry.
- Verify multi-AZ behavior, encryption keys, IAM least privilege, private network
paths, egress controls, database failover, backup retention, restore testing,
quota limits, cost alarms, and regional recovery assumptions.

## Observability And Operations

Correlate tenant-safe metrics, logs, and traces with request, job, event,
idempotency, causation, and provider references. Alert on SLO burn, error rate,
latency, saturation, connection exhaustion, queue lag, DLQ, Outbox backlog,
projection lag, failed or expired payment processes, reconciliation mismatch,
migration failure, backup failure, and certificate or key expiry.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Composability And Governed No-Code

## Composable Boundaries

- Expose capabilities through owner-controlled, versioned APIs, commands, events,
and file contracts with explicit schemas, permissions, errors, and idempotency.
- Prefer additive evolution. Breaking changes require a new version, migration
window, consumer inventory, compatibility tests, and deprecation evidence.
- Keep provider, cloud, channel, and legacy specifics behind adapters. Domain
modules depend on stable ports and business contracts, not vendor SDK objects.
- Use correlation and causation across boundaries. Do not leak database models,
internal enums, queue payloads, secrets, or unnecessary PII into public contracts.
- SDKs and Developer Docs are generated or verified against owner contracts and
provenance locks. Documentation cannot redefine owner behavior.

## Configuration Lifecycle

1. Create a tenant-scoped draft from an approved schema.
2. Validate syntax, types, references, permissions, limits, effective dates,
compatibility, and deterministic evaluation before persistence.
3. Preview or dry-run with synthetic or authorized data and no external side effects.
4. Require maker-checker for configurations that can change financial behavior,
access, settlement routing, compliance output, or external communication.
5. Publish an immutable version with actor, reason, correlation, content digest,
approval, and effective window.
6. Activate atomically. Running operations retain the exact version they used.
7. Roll back by activating a compatible prior version; never rewrite history.

## Runtime Safety

- Prohibit `eval`, `new Function`, arbitrary scripts, unrestricted templates,
dynamic SQL, filesystem/network access, and reflection-based class loading.
- Use an allowlisted expression or decision runtime with typed inputs/outputs,
deterministic time and rounding, complexity limits, execution timeout, memory
budget, recursion limit, and side-effect isolation.
- Validate money precision, currency, timezone, calendars, rate boundaries,
fee ordering, rule conflicts, workflow cycles, and unreachable states.
- Enforce authorization and tenant context during authoring, approval, activation,
execution, export, and rollback. A UI is not a security boundary.

## No-Code Meaning

For MAVULA, no-code means governed declarative products, rules, schemas, and
workflows. It does not mean arbitrary user code, direct database editing, or
unreviewed production activation. A future visual builder must emit the same
versioned contracts and pass the same validation and approval pipeline.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Engineering And Data Standards

## TypeScript And Node.js

- Preserve strict public types, validated DTOs, async error propagation, bounded
concurrency, graceful shutdown, ESM/CJS compatibility, and workspace build order.
- NestJS scopes and guards must not leak request identity. Prisma client/schema/
migration changes move together. BullMQ handlers are idempotent and lease-aware.

## Go

- Propagate `context.Context`, cancellation, deadlines, trace context, and tenant
authority through every boundary. Bound goroutines and channels; prove race safety.
- Wrap errors without losing classification. Use explicit interfaces, SQL
transactions, pool limits, deterministic clocks, and table-driven tests.

## Java

- Define Spring transaction boundaries, isolation, propagation, exception mapping,
bean scope, thread safety, pool limits, timeouts, and serialization compatibility.
- Avoid hidden lazy-loading, broad transactions, reflection-based configuration,
and retries around non-idempotent effects. Use contract and concurrency tests.

## COBOL

- Treat copybooks and fixed-width layouts as versioned wire contracts. Verify
encoding, exact offsets, `PIC` precision/scale, signs, packed decimal, overflow,
rounding, header/detail/trailer totals, checksums, and golden files.
- Batch execution is restartable from durable checkpoints. Duplicate input,
partial output, invalid trailer, and resume never duplicate financial effects.

## Python

- Require typed boundaries, reproducible packaging, parameterized SQL, deterministic
timezone and decimal handling, explicit resource cleanup, isolated tests, and
bounded memory for reporting or batch workloads.

## PostgreSQL

- Apply tenant RLS inside the same transaction and pooled connection as every
protected query. Runtime roles do not bypass RLS or own schemas.
- Keep financial effects, durable idempotency receipt, audit, and Outbox atomic.
Use constraints as invariants, indexes from measured queries, and online-safe
migrations with lock analysis, compatibility order, and recovery procedure.
- Test concurrent duplicate requests, deadlocks, serialization conflicts, pooled
connection reuse, cross-tenant access, rollback, and migration from real baselines.

## Redis And Queues

- Redis never becomes financial or identity truth. Namespace by environment and
tenant where applicable; define TTL, eviction, memory, and failover behavior.
- Jobs carry minimal authorized context, stable idempotency identity, correlation,
bounded retry/backoff, lease timeout, DLQ reason, replay policy, and metrics.

Go and Java standards are ready for RFC-0003 modules but do not assign ownership
or justify migration by language preference alone. Choose language from workload,
correctness, interoperability, operational maturity, and team support evidence.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Module Ownership

## Authority

| Boundary | Owns | Must not own |
| --- | --- | --- |
| `finance-platform` | Cross-module contracts, policy, submodule revisions, master guardian | Runtime financial or identity state |
| `identity-access` | Institutions, branches, operators, credentials, sessions, memberships, roles, OAuth/OIDC policy | Ledger accounts, payment state, job state |
| `ledger-core` | Tenant financial binding, products, accounts, journals, lending, financial workflows, audit, projections | Credentials, provider settlement state, queue truth |
| `settlements` | Payment processes, provider callbacks, dedupe, reconciliation, settlement Outbox | Journal posting, lending balances, operator identity |
| `workbench` | Jobs, schedules, attempts, leases, DLQ, publisher execution, platform status | Financial aggregates, provider state, identity policy |
| `legacy-connectors` | Copybooks, fixed-width layouts, batch receipts, artifacts, deterministic translation | Direct Identity or Ledger stores, financial mutation |
| `operations` | Kubernetes, AWS adapters, secrets wiring, migrations, backups, monitoring | Business aggregates or domain policy |
| `developer-docs` | Approved public contracts, integration guides, examples, provenance locks | Owner contract invention or private endpoint publication |

## Integration Rules

- Integrate through an owner API, authorized command, active event, or approved
versioned file contract. Never share or write another owner's tables.
- Commands carry authenticated tenant, actor, correlation, and idempotency
context. Events carry immutable facts and jobs carry operational work.
- Events use at-least-once delivery. Consumers dedupe persistently before effects.
- Read projections are rebuildable and eventually consistent. They are forbidden
for posting, balance mutation, lending approval, allocation, or settlement
decisions requiring current owner state.
- Cross-owner changes require producer and consumer compatibility tests,
explicit migration order, observability, and a rollback or forward-fix path.
- Ownership changes require an ADR, data migration, compatibility window, and
accountable approval. A folder move does not transfer authority.
Loading