dms-external-database
Connects a DMS project to a client's existing database, runs the Builder's analysis of it, settles what the analysis could not decide from the catalog and aggregates, generates TableViews through the Builder, names them and gives each the table features its data supports, and always builds an analytics dashboard first in the menu. Use when the user wants pages over a database the project does not own, PostgreSQL, MongoDB or RethinkDB ("plug in our client's Postgres", "map their Mongo database", "generate the admin for this database", "finish the mapping the Builder proposed").
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- icon
- i-ph-database
- name
- dms-external-database
- tags
- [ "Database", "Builder", "Pages", "DMS" ]
- category
- Builder
- description
- Connects a DMS project to a client's existing database, runs the Builder's analysis of it, settles what the analysis could not decide from the catalog and aggregates, generates TableViews through the Builder, names them and gives each the table features its data supports, and always builds an analytics dashboard first in the menu. Use when the user wants pages over a database the project does not own, PostgreSQL, MongoDB or RethinkDB ("plug in our client's Postgres", "map their Mongo database", "generate the admin for this database", "finish the mapping the Builder proposed").
02 资源文件 2
- 参考文档cases.json1.6 KB
- 参考文档REFERENCE.md8.4 KB
03 SKILL.md 正文
Pages over a client's existing database
The Builder analyses the database by itself: from the catalog and the profiles, fixed rules propose a mapping and name every choice's rule. Your work is what those rules cannot do: answer the questions they left open, revisit the defaults the names and comments contradict, and plan the analytics pages from the data. You never start from scratch.
You work through the database_* and builder_* tools only. You never read rows of the client's
database: the catalog and aggregates are what you have, and they are enough. The database's URL
lives in the project's .env. The sidecar refuses your file tools on .env files and keeps their
variables out of your environment. Under Claude Code a shell in Code mode can still read them; under
Codex the sandbox refuses that too. Never read .env or print the environment, and never write a
credential yourself.
The flow is connect → analyse → settle → validate → apply → check. Analysing and settling read only, so they run in plan mode. Nothing is written before the integrator presses Run on your plan.
In a Claude Code session started outside the dashboard chat, the tools are named
mcp__dms-ai__database_connections, mcp__dms-ai__builder_analyse_database and so on. There is no
Run button and no sidecar guarding .env: present the plan, and write nothing until the
integrator approves it in the session. The rules above on .env still hold. A mapping that removes
pages, a deletion or a project configuration change is refused once with what it would do: show
that to the integrator, and repeat the identical call only after they confirm it.
1. Connect
Call database_connections.
- A connection is listed with an
engine: use its id and go to 2. - An entry answers
error: say what it says (an owned instance, the catalog not enabled, a role that cannot read) and stop. - Nothing is listed: the project is not connected yet. Ask the integrator which engine the
database runs: PostgreSQL, MongoDB or RethinkDB. Propose one
builder_configure_projectcall with that engine's steps in REFERENCE.md Connecting. Pick the names with the integrator, for example connectionerp, provider modulepostgres-erp(mongodb-erp,rethinkdb-erp), generated moduleerp-tables, variableERP_DATABASE_URL, and for MongoDBERP_DATABASE_NAME. Ask the integrator for the version of the engine's module to install (@antelopejs/postgres,@antelopejs/mongodb,@antelopejs/rethinkdb): you cannot look it up. The user approves the diff.- Then tell the integrator to put the URL in
.env(ERP_DATABASE_URL=postgres://…,mongodb://…, orrethinkdb://…/<database>; for MongoDB alsoERP_DATABASE_NAME), or in the Builder's Database workspace, which writes it there, and to restart the project. Every deployed environment needs the same variables, set where that environment keeps its secrets, never in git. - Recommend an account that can only read for the analysis: a PostgreSQL role with SELECT, a
MongoDB user with the built-in
readrole, a RethinkDB user withreadpermission. - Stop here: the connection exists only after the restart.
- Then tell the integrator to put the URL in
The Builder and you each have a connection to the database, under the same id: the Builder for its analysis and mapping, you for your probing.
2. Analyse
builder_analyse_database with the connection and the generated module.
- It answers the proposal, or, when profiling takes longer, the job's progress and
id: call it again withjobuntil the proposal is in. - A
schemasopen item means the database is large: ask the integrator which schemas matter and analyse again withschemas. - Relations the module mapped or excluded before are not proposed again. On a module mapped already, the proposal is what is left.
Read the proposal as REFERENCE.md The proposal explains: every choice has a rule and a kind.
A fact follows from the catalog; leave it. A default is a judgement; check it.
3. Settle
In plan mode, through the read-only tools. Probe lightly: a targeted database_profile of a few
columns, a CheckReference in references, a database_describe of one relation. Never a
profile of the whole database again: the Builder did it.
- Open items, one by one:
purpose: what a relation holds. Decide from its name, comment, columns and profile: entities to list (a TableView), facts to count (stats only), or nothing to show (excluded). The item carries the relation as it would be mapped, and in its ownopenthe questions that mapping leaves. Answer those only when you map the relation.label: which column names a row. Prefer a name or title, then a code or number people recognise.reference: a column found almost whole in another relation's key. Check it withCheckReferenceon the column; make it a relation column only at containment 1.field-type: a field of a document database whose sampled values have several types, none covering enough of them (int 60% | string 40%). Pick the declaration that reads what the field means, from its name and its shares, or leave it out. Unanswered, it stays out.- Where nothing tells you, say so and leave the item open: the integrator answers it in the Builder. Do not guess.
- Defaults worth revisiting. For example a table rule R8 calls a log whose name and comment say it holds entities, a label rule L1 chose that a comment contradicts, or a title taken from a cryptic name.
- Document databases (MongoDB, RethinkDB) declare no field types and no references: the
catalog reads types from a sample, and every reference comes from a name and a
CheckReference, never from the database. An embedded document is one field: its subfields are not mappable, and neither is an array of ids as a relation. - Editable. Every TableView is proposed read-only. Make one editable only where the integrator
wants it; show
writesbeside it, so a read-only role in this environment is visible. - Pages people can work with. Load the
dms-page-designskill. For every TableView, plan from its columns, profiles and categories, as Name every page and Tables there say: a title, an icon and a description; the tabs, saved views, display modes, footer totals and KPI cards its data supports. Decide each from the data, and leave out what the data does not support. - The analytics dashboard, which the analysis does not make. Every run ends with one,
first in the menu, even when the integrator only asked for the tables. Plan it from the data:
- Inspect. For each relation, read from the proposal its rows, its
time-axiscolumns with theirrange, itsmeasurecolumns, and itsenum-likecolumns with theircategories. Profile a column the proposal leaves without them, such as the main date column's range. Write each range down: the period rule needs the last date. - Ask. Write the 4 to 8 questions the owner of this data asks every week: how revenue
or volume trends, what sells, who buys, where, and how it compares with last year. Each
question names the relation, the measure (a sum of a
measurecolumn or a row count) and the grouping (the time axis or a column of the same relation). - Plan pages. The relation with a time axis, a measure and the most rows is the main fact relation. It gets the dashboard, named for its area ("Sales", or "Overview" when it also carries the other relations' headline figures), holding every question about it. Another relation gets its own analytics page only when it has its own time axis and at least 100 rows. When no relation has a time axis, the dashboard still exists: KPI cards of counts and sums, and breakdowns by the category columns, with no period selector.
- Choose blocks for each question with
dms-page-design, and its default period from the main time axis's real range.
- Inspect. For each relation, read from the proposal its rows, its
- The minimum. Your plan, and the pages you write, meet all of these:
- one analytics dashboard, first in the connection's menu (
order: 0), opened by a toolbar with a period selector when the data has dates; - every page with a title in the owner's words, an icon and a description, never the raw relation name;
- every table given the tabs, views, display modes, footer totals and KPI cards its data
supports, as
dms-page-designTables decides; - at least 3 different chart kinds on it when the data has the shapes for them;
- a default period computed from the data's real dates, never assumed;
- every page built with one
builder_compose_pagecall, previewed first, and every block whose preview is empty, zero or failed dropped or changed; - every page opened with
navigate_to_pageand its block report read before you report.
- one analytics dashboard, first in the connection's menu (
- Not possible yet: breakdowns by a related entity's name, such as revenue per customer. Templates read one relation, so they would show ids. List them under Not possible yet, never as pages.
Write your plan (ExitPlanMode) in the format of REFERENCE.md Plan: what you change in the
proposal and why, the questions and the analytics pages that answer them, the open items you
leave, and what is not possible yet.
4. Validate
The integrator answers in chat or with "suggest a change". Revise the plan and present it again. Write nothing before Run.
5. Apply
Work in this order, so the most visible result lands first: map the tables, build the dashboard and check it, then add KPI rows above tables, then any second analytics page.
builder_map_resourcesin batches of 3 or 4 relations per call, TableViews and stats-only relations alike; the relations decided against go inexcludedon the first call (REFERENCE.md Mapping). One call with every relation of a large database can abort.- Send the proposal's choices as they stand where you changed nothing, plus per resource
the
title,icon,descriptionandtableOptionsyou planned. - On
invalid_config, fix the choice it names and call again: a refused call writes nothing. When the same choice is refused twice, drop it (send the relation without that display or option) and say so in your report, rather than trying more variants. - It answers each relation's
ref, which queries name it by,category, the connection's category ref (pages.<connection>), andleftOut: carry those into your report.
- Send the proposal's choices as they stand where you changed nothing, plus per resource
the
- Per analytics page, one
builder_compose_pagecall withcreate(name,displayName,moduleset to the generated module,categoryset to thecategoryMapResources answered, an icon, a description, andorder: 0for the dashboard, 1, 2… for the next ones) and every block in the orderdms-page-designlays out, each data block with its query inline. Preview first, then write, asdms-page-designBuild a page in one call says.- Queries read the mapped resources by their refs (
<connection>/<schema>/<relation>).
- Queries read the mapped resources by their refs (
- Per table page that gets KPI cards above its table, one
builder_compose_pagecall withplacement: { "before": "table" }, previewed first. A table option MapResources refused comes back as a warning: fix it withbuilder_configure_table_view.
To change a relation later, read its current choices with builder_mapping, then call
builder_map_resources with that relation alone, its included columns as they are and only your
change made: a mapped relation is rewritten from the choices sent, and its page follows.
6. Check
- Navigate only once every page is written. Pages register when the host reloads the generated
module: under
ajs project devits watcher rebuilds the module after your writes. navigate_to_pageto each page. If it answersunknown_route, the reload has not happened.- Read
query_logsonce, for a reload error. - Then tell the integrator the pages appear once the module reloads. Do not wait, retry or investigate further.
- Read
query_logsfor registration warnings (lossy fields, unserved indexes) and for the errors of the routes the pages called.- On each analytics page, fix or remove every block
navigate_to_pagereports as empty or failed, and navigate again, as indms-page-designCheck every block.
Then report:
- what the Builder mapped by its rules, and what you changed;
- the pages made, with each analytics page's default period and the date range it came from, and per table the features you gave it and why;
- every block that still shows no data, and why;
- what was left out and why;
- the open items left, which the integrator finds in the Builder's Database workspace;
- the variable every deployment must set.
Guardrails
- Never write a URL, password or token into a tool call, the config or a page.
- Never map into the project's own module: only into the module bound to the connection.
CreateResource,AddFieldand table-sideConfigureFieldare refused in that module: its tables are the database's.DeleteResourcethere never deletes the client's rows.
04 同仓库更多 Skills
dms-page-design
Designs DMS pages that show data, through the Builder tools. Use when building or changing an analytics, stats or dashboard page or a table page, choosing a chart or a KPI for some data, picking a page's period, naming a page and its icon, or deciding how a table displays (badges, prices, relation labels, status tabs, saved views, kanban, cards, footer totals, KPI cards above the table).
dms-builder-safe
Builds or modifies AntelopeJS DMS admin pages through the Builder MCP tools instead of raw code edits. Use when the generation mode is "safe", or when the user wants predictable, typechecked page edits (add/configure/move/remove blocks, create pages and categories).
dms-ai
Sets up and troubleshoots @antelopejs/dms-ai, the AI development assistant of the AntelopeJS DMS (chat panel, sidecar running Claude Code or Codex, change sets with undo, audit log and skills pages under /modules/ai). Use when installing or configuring dms-ai (backendUrl, DMS_AI, providers, Codex), when the assistant is offline, or when a module must ship skills to it through antelopeJs.skills.
dms-ai-code-mode
Runs the dms-ai Code-mode loop for changing a DMS page in code while the user watches it in the dashboard overlay, with the list_pages, navigate_to_page, find_pages_using, typecheck and query_logs host tools. Use when the dms-ai generation mode is Code and a change touches a rendered page, or when the user allows Code mode after a Builder tool answered opaque_target or unsupported.
page-builder
Create and modify DMS pages. Use when the user wants to add or edit a page.
verify-dms-ai
Drive the AntelopeJS dms-ai module (the AI assistant: its sidecar, Overview, Changes, Activity, Skills and Settings pages, the Codex sign-in banner and the owner-only routes) the way the platform owner does, inside a DMS with free ports and its own MongoDB database, and report a verdict with evidence. Use to prove a change to AntelopeJS/dms-ai works before merge, or to verify a PR. A turn with Claude Code or Codex needs credentials a run never holds: that part is NOT VERIFIED, so a verdict is never a plain PASS.