use-database
Skill61 starsChanged 55 days agoMITView on GitHub
Tables, and the two doors that lead to them. Load it before adding a table, before writing a query anywhere, when rows exist on your laptop but not on the server (or the other way round), and before reaching for raw SQL. The two facts nobody guesses: a table is declared in ONE constant in this repository and appears on both machines by itself, and the same data has a second door that runs arbitrary SQL — which is deliberately harder to open than the first, because it bypasses the protection the first one gives you for free.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Fractera/Agentic-Engineering-Infrastructureword for word, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 1
- Fractera/Agentic-Engineering-Infrastructure★ 61100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository88 other files it gives its agents.
- app/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adopt-suggested-skillSkill
- ai-elementsSkill
- ai-sdkSkill
- answer-elementSkill
- ask-elementSkill
- audit-broken-charactersSkill
- blocks-of-the-nodeSkill
- build-product-with-ownerSkill
- content-factorySkill
- core-build-returnSkill
- core-scheduleSkill
- create-elementSkill
- create-multilingual-content-entrySkill
- design-and-settings-of-elementsSkill
- element-powerSkill
- expand-site-languageSkill
- explain-this-projectSkill
- extract-design-systemSkill
- find-skillsSkill
- handle-block-requestSkill
- handle-needSkill
- help-in-browserSkill
- humanizerSkill
- integratorSkill
- know-the-architectSkill
- manage-app-settingsSkill
- node-typeSkill
- own-agentsSkill
- persist-env-var-with-rebuildSkill
- place-page-in-menuSkill
- provider-rulesSkill
- release-templateSkill
- review-pageSkill
- route-to-elementSkill
- self-reviewSkill
- shadcnSkill
- shape-the-needSkill
- skill-creatorSkill
- study-for-elementSkill
- supervise-elementSkill
- translate-pendingSkill
- ultracode-sessionSkill
- use-agentic-ragSkill
- use-ai-generationSkill
- use-aioSkill
- use-app-configSkill
- use-auth-providersSkill
- use-authSkill
- use-browserSkill
- use-channelsSkill
- use-chatSkill
- use-code-shapeSkill
- use-dataSkill
- use-deep-memorySkill
- use-deploySkill
- use-designSkill
- use-development-stepsSkill
- use-domainSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 104
Nothing secret that you invented: If a new secret column feels necessary, it belongs to the auth layer, not to the application's tables — …
- Very specific: line 114
If you used /db/migrate, the step says so, and says why the row API could not do it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
use-database
Informational, not binding. Know a better way for the case in front of you — do it your way and say so. You are trusted with the creative work on this project.
The door itself, the credential and the permission classes are in use-data. This is about tables.
1. 🔒 A table is declared in SCHEMA, not created by a query
lib/db/index.ts holds one constant, SCHEMA. Both paths execute it — makeLocalDb() on a laptop
and initRemoteSchema() against the data service — so a table added there exists on both machines
after the next start. There are no migration files and no button.
Add to SCHEMA → deploy → the table is there. Creating it with a query instead gives you a table
that exists on the server and not in the repository: the next clone, the next developer and the next
deployment know nothing about it.
🔒 A COLUMN IS NOT A TABLE, AND SCHEMA WILL NOT DELIVER IT (2026-08-24). CREATE TABLE IF NOT
EXISTS does nothing at all where the table already exists — which is every machine except a brand-new
one. ✗ paid live on 2026-08-17: kind was declared in SCHEMA, deployed, and the column never
appeared; the data layer then answered no such column to every catalogue query, taking the storefront,
the sitemap and the products page down together.
A column added AFTER its table goes into LATE_COLUMNS in the same file, and nowhere else. It is a
plain ALTER TABLE … ADD COLUMN, applied blind, swallowing exactly one error — "column already
exists", the normal outcome on every server past the first run.
🔒 One ladder, two walkers. LATE_COLUMNS is executed by BOTH makeLocalDb() and
initRemoteSchema(). ✗ it once lived inside the local path only: while the app wrote to a file nobody
noticed, and the day it moved to the data layer the ladder stopped running entirely. Pairs like that
diverge silently — each branch is healthy on its own.
2. 🔒 Which database you are actually talking to
REMOTE_DATA_URL set AND a key present → the data service (the real, shared data)
otherwise → a local SQLite file with sample rowsBoth branches are healthy; only the destination differs — which is why the wrong one is quiet. A missing key does not shout, it silently gives you your own empty copy. If rows appear on your machine and never on the site, this is the first thing to check.
🔒 With the key, a local npm run dev writes to the CUSTOMER's data. Deleting rows in an
experiment deletes them for real. There is no staging copy in between.
3. Two doors to the same rows, and their asymmetry
| Door | For | What it does for you |
GET /db/tables, /db/tables/:table, /db/tables/:table/rows/:id | everyday reads and edits | cuts secret columns out — password, session_token, refresh_token, totp_secret… — from the rows AND from the column list |
POST /db/migrate — { sql, params } | anything the first cannot express | runs arbitrary SQL: DDL, SELECT with parameters, writes |
🔒 The second door bypasses the first one's protection, and that is why it is behind the machine
secret only — a session cookie is refused there whatever the role (use-data §2). A hash that leaves
the database lives on in logs, in responses, in screenshots and in an agent's context, where nobody
can take it back. Use /db/tables unless you genuinely cannot.
When /db/migrate is the right tool: a join the row API cannot express, a bulk update, a one-off
data repair, reading pragma_table_info to see what a table really holds. Say in the step that you
used it — raw SQL against a customer's data is a decision, not a detail.
4. Reading rows in a page
A subject has ONE reader in lib/<subject>/, shared by the page, the sitemap and the machine twin —
check:static refuses a direct @/lib/db import from a public route folder. A query living in a page
entry is repeated by the next entry and reused by nothing.
Rows that a page shows must be fetched on the server. A public page stays static: the shell is
prerendered and the dynamic part wakes up inside it (use-dynamic-pages).
🔒 Paging is a property of the DOOR you called, not of "the data layer". The layer's own table door
takes limit (default 500, hard ceiling 1000) and offset, plus search across the text columns:
/db/tables/<table>?limit=100&offset=200&search=…. The services it PROXIES speak their own dialect —
the knowledge graph, for instance, pages with page_size and refuses a value below its schema minimum.
✗ assuming one vocabulary for all doors returns a 400 that reads like a broken query. Ask
GET /capabilities when you are not sure; it answers for the door you are about to call.
🔒 A table door never returns a column just because it exists. /db/tables/users?limit=1 once
handed back the whole row including the bcrypt password hash. The door now selects columns
deliberately — when you add a table holding anything secret, that decision is yours to make explicitly,
not something the door guesses.
5. What belongs in a column, and what does not
- Translations of a row live in its
i18ncolumn as JSON, not in a column per language: a language per column means a schema migration for every new market. - Derived values that are expensive per row (image dimensions, a blur placeholder) are stored at write time. Twenty products on a page means twenty extra round-trips otherwise — the catalogue was built that way for exactly this reason.
- Nothing secret that you invented. If a new secret column feels necessary, it belongs to the auth
layer, not to the application's tables — and the secret-column filter only knows names it has been
told about (
SECRET_COLUMNSin the data service).
6. Before you call it done
- The table is in
SCHEMA, in this repository — not created by a query on the server. npm run check:types, then the page that reads it, opened for real.- You know which database answered: with a key it is the customer's data; without one, your own file with samples. Say which one you tested against.
- If you used
/db/migrate, the step says so, and says why the row API could not do it.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

