sink-parity
Skill262 starsChanged 2 months agoApache-2.0View on GitHub
Keep the fs, mongo and postgres sink backends at feature parity when changing any of them
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 6 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 6
Keep the sink backends at feature parity.
- Distinctive: line 8
Read AGENTS.md first. It is the canonical project guide for this repository.
- Distinctive: line 12
Use this skill whenever a change touches any of:
- Very specific: line 25
Add the member to the Sink interface with a doc comment stating its semantics (ordering, case sensitivity, empty-result shape).
- Distinctive: line 28
Add unit tests for every backend, not just the one you started from.
- Very specific: line 32
Update the class in src/db/types.ts.
- Very specific: line 36
create: insert the field, applying the same defaults as mongo (for example dateCreated/lastModified are stamped with the current ISO time …
- Very specific: line 37
update: extend the column allowlist.
- Distinctive: line 38
read: add the column to every select and to the row-to-entity mapping
- Very specific: line 39
If mongo or fs bump lastModified (or similar) on a mutation, every backend must bump it on that mutation.
- Distinctive: line 57
When you touch a backend, add or extend BOTH kinds for it: unit coverage for the logic, integration coverage for the real query shapes.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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
Keep the sink backends at feature parity.
Read AGENTS.md first. It is the canonical project guide for this repository.
GitProxy persists its state through interchangeable sink backends: src/db/file (NeDB), src/db/mongo, and src/db/postgres. They all implement the Sink interface in src/db/types.ts, and deployments pick one via the sink config. A feature that exists in one backend but not the others is a bug waiting for whichever deployment uses the others.
Use this skill whenever a change touches any of:
- the
Sinkinterface or the entity classes (Repo,User, push types) insrc/db/types.ts - any backend adapter under
src/db/file,src/db/mongo, orsrc/db/postgres - the migration framework (
src/db/migrations) or the postgres schema
The contract
src/db/types.tsis the single source of truth: theSinkinterface plus the doc comments on its members define the behaviour every backend must provide. No backend implementation, mongo included, outranks the contract. A newSinkmember or entity field is not done until all three backends implement it in the same change; do not leave a backend behind for a follow-up.npm run check-types:serverenforces the interface structurally, but it cannot see semantic drift. The rest of this checklist exists for what the compiler cannot catch.
Adding or changing a Sink member
- Add the member to the
Sinkinterface with a doc comment stating its semantics (ordering, case sensitivity, empty-result shape). - Implement it in
src/db/file,src/db/mongo, andsrc/db/postgres. The doc comment on the interface member is the reference for behaviour, not any one backend: whichever implementation lands first defines the semantics, so spell them out in the doc comment and make the other backends match it. Historically most members appeared in mongo first, but new functionality can just as well start in postgres; do not assume mongo is the template. - Export it from each backend's
index.tsand wire the dispatcher insrc/db/index.ts. - Add unit tests for every backend, not just the one you started from.
Adding a field to an entity
- Update the class in
src/db/types.ts. - fs and mongo store documents whole, so writes usually pass new fields through automatically; verify reads return them.
- postgres maps fields to columns explicitly, so every layer must be updated by hand:
- schema: add the column (see the migration rules below)
- create: insert the field, applying the same defaults as mongo (for example
dateCreated/lastModifiedare stamped with the current ISO time on create) - update: extend the column allowlist; a field missing from the allowlist is dropped silently, and an update reduced to zero columns throws, which has already nearly shipped a startup crash (
populateRepoDates) - read: add the column to every select and to the row-to-entity mapping
- If mongo or fs bump
lastModified(or similar) on a mutation, every backend must bump it on that mutation.
Postgres schema changes
- Schema changes are append-only migrations; never edit or reorder an entry that has shipped.
- Cross-backend logical migrations belong in
src/db/migrations(registered inregistry.ts) and run through theSinkhooks (getAppliedMigrations,recordMigration,unrecordMigration), so they must work against all three backends. deriveCreatedAtis best-effort by design: mongo derives a timestamp from the ObjectId, fs and postgres returnundefinedand callers fall back. Do not assume it returns a value.
Semantic parity rules
- Same defaults on create in every backend.
- Same case handling: usernames are lowercased on permission changes; name lookups are case-insensitive where mongo's are.
- Same projections: list endpoints must return the same field set from every backend, or UI behaviour diverges by deployment.
- Same error behaviour for invalid input (missing id, empty update).
Tests
- Each backend has unit tests under
test/db/<backend>that mock the driver (pgis mocked for postgres, NeDB runs in-memory for fs). Integration tests (test/db/postgres/*.integration.test.ts,test/db/mongo/*.integration.test.ts) run against a real service and are skipped when none is reachable; CI runs them in dedicated lanes. - When you touch a backend, add or extend BOTH kinds for it: unit coverage for the logic, integration coverage for the real query shapes. The fs backend has no external service, so unit coverage is enough there.
- Keep the test scenarios aligned across backends: perform the same operations with the same inputs, and assert the same outputs, so parity is something the suite proves rather than something reviewers eyeball. If a scenario genuinely does not apply to a backend, say so in a comment instead of silently skipping it.
Verify before pushing
npm run check-types:server
cross-env NODE_ENV=test npx vitest --run test/db
npm run lint
npm run format:checkPostgres integration tests (npm run test:integration:postgres) need a reachable PostgreSQL database; CI runs them in the dedicated lane.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- address-reviewSkill
- commitSkill
- docsSkill
- implementSkill
- issueSkill
- lintSkill
- summarySkill
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.

