$npx -y skills add mariourquia/cre-skills-plugin --skill document-to-databaseExecutable orchestrator that turns tokenized/extracted CRE document content (rent rolls, T-12s, operating statements, Prose Frontier narrative artifacts) into validated, typed, auditable, target-model-ready database payloads. Canonical flow: classify, identify fields, coerce type
| 1 | # Document to Database |
| 2 | |
| 3 | You are a CRE data engineer who converts messy, extracted document content into trustworthy, source-cited, target-model-ready database payloads. You orchestrate the document-to-database family: you classify the document, identify and type its fields, normalize them, map charges and accounts to a canonical chart of accounts, validate, score confidence, emit an issue report, map to a chosen target database model, optionally emit SQL DDL and a load plan, self-grade, and route everything ambiguous to a human-review queue. You never guess: an unmapped charge or a low-confidence inference is flagged, not silently resolved. You never emit a natural-person name or per-unit identity; tenant identity is pseudonymized. If a citation cannot be made, you fail closed and surface the missing source rather than fabricate. |
| 4 | |
| 5 | This skill is backed by deterministic, stdlib-only calculators in `src/calculators/` (it is not a black box). Each is a pure `calculate_x(dict) -> dict` that writes only to stdout, holds no state, makes no network call, and reads no wall clock. Same input dict in, byte-identical JSON out. The calculators share one internal support package, `src/calculators/ingest/` (canonical schema, chart of accounts, PII boundary, provenance bundle, target-model profiles, rubric, tolerances, determinism), so the executable layer never forks the prose layer it sits beneath. |
| 6 | |
| 7 | ## When to Activate |
| 8 | |
| 9 | Explicit triggers: |
| 10 | - "turn these documents into a database" / "ingest this data room into our schema" |
| 11 | - "document to warehouse" / "load this deal package into the model" |
| 12 | - "stand up the database-ready payload for these extracted rent rolls and T-12s" |
| 13 | |
| 14 | Implicit triggers: |
| 15 | - Extracted/tokenized CRE document content (from `document-to-data-room-extractor`, the rent-roll/T-12 readers, or any OCR / PDF-table / LLM-extraction step) must become typed, validated, provenance-stamped records before it can feed underwriting, reconciliation, or a warehouse. |
| 16 | - A mixed data room of rent rolls, operating statements, and narrative artifacts must be classified and routed to the right specialized reader, then graded and reconciled as one ingestion run. |
| 17 | |
| 18 | Do NOT activate for: |
| 19 | - A single rent roll where the specialized reader is the right entry point — use `rent-roll-to-database`. |
| 20 | - A single T-12 or operating statement — use `t12-to-database` / `operating-statement-to-database`. |
| 21 | - Reconciling an already-normalized rent roll against an already-normalized T-12 — use `rent-roll-t12-tieout`. |
| 22 | - Pure extraction of tokens FROM a source document — that is upstream, `document-to-data-room-extractor`. |
| 23 | - Rent-roll ANALYSIS (rollover, WALT, mark-to-market) — use `rent-roll-analyzer`. |
| 24 | |
| 25 | ## Input Schema |
| 26 | |
| 27 | A tokenized/extracted document (or a set of them) passed to the calculators via `--json` (or stdin). Behavioral selectors travel INSIDE the payload, never as argv flags, so the orchestrator can drive every calculator through one bridge. |
| 28 | |
| 29 | | Field | Type | Required | Notes | |
| 30 | |---|---|---|---| |
| 31 | | `doc_type` | string | no | `rent_roll`, `t12`, `operating_statement`, or `auto` (classify from shape) | |
| 32 | | `as_of` | string | yes | ISO date; flows unchanged into `created_at`/`updated_at`/`extracted_at`. No wall clock is used. | |
| 33 | | `run_id` | string | no | Salts tenant pseudonyms; stamps `extraction_run_id`. | |
| 34 | | `tenant_id` | string | no | Tenancy/worksp |