db-change
Skill2 starsChanged 59 days agoMITView on GitHub
Use when writing SQL, adding a column or table, or touching anything under lib/db or lib/repositories in todox. Two of these rules exist because of a live SQL injection, not a hypothetical one.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- skillist-io/skillisttheir own version, first seen Oct 11, 2026
- J3vb/OwnCordtheir own version, first seen Oct 8, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- J3vb/OwnCord★ 11same name
- skillist-io/skillist★ 1same name
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 repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- add-rpc-methodSkill
- i18n-stringsSkill
- ui-conventionsSkill
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 21
Use setClause(patch, COLUMNS) from lib/db/client.ts.
- Very specific: line 68
Do not hand-write a to_tsvector on either side.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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
Touching the database
No ? inside a SQL string literal
lib/db/client.ts rewrites ? to $n positionally. It does not parse
strings, so a question mark inside a quoted literal shifts every parameter
after it.
-- wrong: the literal eats a placeholder slot
WHERE note = 'why?' AND user_id = ?Never build a SET clause by hand
Use setClause(patch, COLUMNS) from lib/db/client.ts. Column names cannot be
bound as parameters, so they are interpolated — and patches arrive from
const { id, ...patch } = params at the RPC boundary. Iterating the patch's own
keys put caller-chosen text into the statement. That was a live SQL
injection. The allow-list is the fix; do not route around it.
One module per table
lib/repositories/— one file per table, no cross-table logic.- Repositories never call each other. Anything that must stay consistent
across tables — a status change writing a
task_eventsrow — belongs inlib/services/.
Ownership is checked in exactly one place
lib/services/ownership.ts. Do not inline WHERE user_id = ? at a call site
and consider it handled. A row belonging to somebody else answers 404, never
403 and never "not found for you": the message must not tell a caller that an id
exists.
Load in batches
The database is over the network. A per-row query inside a list is a per-row
round trip — use the listByTasks-style helpers.
Schema and migrations
- The schema lives in
lib/db/schema.tsand is idempotent. pnpm db:migrateis a deploy step, run deliberately. It does not run on cold start: DDL racing across serverless instances is a bad way to discover lock contention.- Nothing queries the database at build time — every page is
force-dynamic, which is what keeps CI free of secrets. statements()splitsSCHEMAon;and strips--comments after the split. So a semicolon inside a comment cuts it in half and the rest of the sentence arrives as a statement, and aDO $$ … $$block cannot be expressed here at all — its body has semicolons in it.
An index nothing uses fails silently
The two full-text rules that have already cost a day between them:
- An expression index is used only when the query's expression matches it
character for character. A mismatch is not an error and not a warning — the
index is ignored, the answer is identical, and search is just slow again.
lib/db/fts.tsis the single definition bothschema.tsandservices/search.tsbuild from, andsearch.test.tsasserts they agree. Do not hand-write ato_tsvectoron either side. - Postgres cannot use an index for an
ORunless it can use one for every branch. Search asks its full-text andILIKEquestions as two separateSELECTs unioned by id, and that is not a style choice: putting them back in oneWHEREun-indexes the full-text half without failing anything. Ownership is repeated in both arms for the same reason — dropping it from one leaks nothing, so no test of the results would notice, and every account's search starts scanning every other account's rows.
The server has no filesystem
It has no checkout. Anything that reads a path belongs in mcp/workspace.ts, on
the machine that holds the code. Hashing files and finding a repository root
used to happen in request handlers, where they returned nonsense and turned a
caller-supplied path into a real readFileSync.
Verifying
pnpm test # column allow-lists, RPC param validation
pnpm smoke:auth # needs a DATABASE_URL; run it if you touched authFull rules: CONTRIBUTING.md.
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.

