data-layer-patterns-edho-ferdian
Skill21 starsChanged 2 months agoMITView on GitHub
Design and setup guidance for the data layer — Postgres schema design, Prisma ORM patterns, Redis caching/queue patterns, and cross-ORM migration strategy (expand-contract). A design-time companion to code-review-edho-ferdian's database-lens (which reviews existing SQL/ schema/migrations) — use this when SETTING UP or DESIGNING a data layer, not when reviewing one. Trigger phrases: "desain schema untuk X", "setup Prisma/Redis", "bagaimana strategi migration yang aman", "cache invalidation strategy".
In this repository115 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/api-design-edho-ferdian.mdcCursor rule
- .cursor/rules/backend-engineering-edho-ferdian.mdcCursor rule
- .cursor/rules/billing-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/build-fix-edho-ferdian.mdcCursor rule
- .cursor/rules/click-path-audit-edho-ferdian.mdcCursor rule
- .cursor/rules/code-quality-tooling-edho-ferdian.mdcCursor rule
- .cursor/rules/code-review-edho-ferdian.mdcCursor rule
- .cursor/rules/code-simplification-edho-ferdian.mdcCursor rule
- .cursor/rules/communications-triage-edho-ferdian.mdcCursor rule
- .cursor/rules/config-hygiene-edho-ferdian.mdcCursor rule
- .cursor/rules/container-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/counterparty-comms-edho-ferdian.mdcCursor rule
- .cursor/rules/data-layer-patterns-edho-ferdian.mdcCursor rule
- .cursor/rules/dead-code-cleanup-edho-ferdian.mdcCursor rule
- .cursor/rules/deployment-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/desktop-e2e-edho-ferdian.mdcCursor rule
- .cursor/rules/dev-kickoff-edho-ferdian.mdcCursor rule
- .cursor/rules/docs-sync-edho-ferdian.mdcCursor rule
- .cursor/rules/e2e-testing-edho-ferdian.mdcCursor rule
- .cursor/rules/frontend-engineering-edho-ferdian.mdcCursor rule
- .cursor/rules/gan-harness-edho-ferdian.mdcCursor rule
- .cursor/rules/git-and-release-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/language-code-review-edho-ferdian.mdcCursor rule
- .cursor/rules/legal-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/marketing-edho-ferdian.mdcCursor rule
- .cursor/rules/networking-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/opensource-release-edho-ferdian.mdcCursor rule
- .cursor/rules/performance-audit-edho-ferdian.mdcCursor rule
- .cursor/rules/research-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/safe-execution-edho-ferdian.mdcCursor rule
- .cursor/rules/security-review-edho-ferdian.mdcCursor rule
- .cursor/rules/seo-audit-edho-ferdian.mdcCursor rule
- .cursor/rules/skill-audit-edho-ferdian.mdcCursor rule
- .cursor/rules/skill-authoring-edho-ferdian.mdcCursor rule
- .cursor/rules/spec-mining-edho-ferdian.mdcCursor rule
- .cursor/rules/system-design-edho-ferdian.mdcCursor rule
- .cursor/rules/test-authoring-edho-ferdian.mdcCursor rule
- .cursor/rules/video-style-edho-ferdian.mdcCursor rule
- api-design-edho-ferdianSkill
- backend-engineering-edho-ferdianSkill
- billing-ops-edho-ferdianSkill
- build-fix-edho-ferdianSkill
- click-path-audit-edho-ferdianSkill
- code-quality-tooling-edho-ferdianSkill
- code-review-edho-ferdianSkill
- code-simplification-edho-ferdianSkill
- communications-triage-edho-ferdianSkill
- config-hygiene-edho-ferdianSkill
- container-ops-edho-ferdianSkill
- counterparty-comms-edho-ferdianSkill
- dead-code-cleanup-edho-ferdianSkill
- deployment-ops-edho-ferdianSkill
- desktop-e2e-edho-ferdianSkill
- dev-kickoff-edho-ferdianSkill
- docs-sync-edho-ferdianSkill
- e2e-testing-edho-ferdianSkill
- frontend-engineering-edho-ferdianSkill
- gan-harness-edho-ferdianSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 45
If a user asks you to review code that already exists, don't run this skill's content against it — hand off to code-review-edho-ferdian …
- Distinctive: line 80
State the access pattern before the schema: Don't design tables in the abstract — ask (or infer from context) how the data will be read and …
- Very specific: line 86
Prefer the boring, provably-safe migration path: When a schema change could lock a large table or lose data if done in one step, default to …
- Very specific: line 105
Design-time, not review-time: Never present this skill's output as a review finding, and never run it against code presented for audit — …
- Very specific: line 112
Don't duplicate
database-lens.md: If a review-time query/index check applies, point there instead of re-deriving it here.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Data Layer Patterns — Edho Ferdian Mode (Skill Edition)
You are helping design and set up a data layer — schema, ORM, cache, and migration strategy — before code exists to review. You think like an engineer sketching the shape of the system on a whiteboard: what tables, what access patterns, what will this look like at 10x the current data volume, and what will break first.
Boundary — read this before doing anything else
This skill is authoring/design-time. It is not a review lens.
code-review-edho-ferdian's references/database-lens.md is a review
lens: it runs against code/SQL/migrations that already exist, and finds
problems in them — missing indexes confirmed via EXPLAIN ANALYZE, RLS
policy mistakes, SELECT * in a diff. It activates automatically during a
code review when the scope touches *.sql, migrations/, or an ORM schema.
This skill runs the opposite direction in time: it helps decide what to
build before it exists — which columns, which indexes up front, which
caching strategy, which migration sequence — so that database-lens finds
less to flag later. Concretely:
- "Review this migration for safety" / "is this query slow" / "audit my
schema" → that's
database-lensterritory (viacode-review-edho-ferdianorsecurity-review-edho-ferdianfor the RLS/privilege half). Point the user there. - "Help me design a schema for X" / "how should I set up Prisma/Redis" / "what's a safe migration strategy for adding this column" / "how should I invalidate this cache" → that's this skill.
If a user asks you to review code that already exists, don't run this
skill's content against it — hand off to code-review-edho-ferdian
(database lens) or security-review-edho-ferdian instead. If they ask how
to build something that doesn't exist yet, this skill is the right one, even
if the conversation started from a review.
Scope map
| Topic | Reference file |
| Postgres schema design decisions made at setup time | references/postgres.md |
| MySQL/MariaDB schema, indexing, transaction, and replication design | references/mysql.md |
| Prisma-specific setup, pooling, N+1, migration workflow | references/prisma.md |
| Redis caching/queue/invalidation strategy, anti-patterns | references/redis.md |
| Cross-ORM migration strategy, expand-contract, reversibility | references/migrations.md |
| JPA/Java persistence — entity design, fetch strategy, transactions, pagination, indexing, HikariCP pooling | references/jpa.md |
references/postgres.md is intentionally thin — most Postgres depth
already lives in database-lens.md as review criteria. Read that file's
note at the top before assuming something is missing here.
references/mysql.md is a separate engine, not a Postgres reskin — InnoDB
locking, utf8mb4 defaults, ON DUPLICATE KEY UPDATE, and replica-lag
mechanics all diverge from Postgres. Use it whenever the target is MySQL or
MariaDB rather than assuming postgres.md transfers; it starts with an
explicit statement of what's different and why.
Workflow
- Identify what's being designed. Schema for a new feature? A cache
layer for an existing hot path? A migration for a breaking schema change?
Route to the relevant reference file(s) — a real task often touches more
than one (e.g. "add a new required column" touches both
prisma.md/postgres.mdfor the schema shape andmigrations.mdfor how to roll it out safely). - State the access pattern before the schema. Don't design tables in the abstract — ask (or infer from context) how the data will be read and written: point lookups vs. range scans, read-heavy vs. write-heavy, expected row-count order of magnitude. The right schema/index/cache choice depends on this, and guessing wrong here is expensive to unwind later.
- Prefer the boring, provably-safe migration path. When a schema
change could lock a large table or lose data if done in one step, default
to expand-contract (
references/migrations.md) rather than a single destructive migration — even if the team is impatient. Say why, briefly. - Hand off setup output that
database-lenswill approve of. Since this skill and the review lens are two ends of the same pipeline, a schema this skill helps design should not trip its own review findings later (e.g. don't emitintPKs,timestampwithout timezone, or missing FK indexes —postgres.mdanddatabase-lens.mdagree on these defaults).
Language routing (fixed — see skill-authoring-edho-ferdian's canonical contract)
Communication to the user in Bahasa Indonesia; schema names, code, comments,
and any generated files in English — fixed, never ask. Full contract:
skill-authoring-edho-ferdian §7.
Global rules
- Design-time, not review-time. Never present this skill's output as a
review finding, and never run it against code presented for audit — hand
that to
code-review-edho-ferdian/security-review-edho-ferdian. - Access pattern first. A schema or cache decision without a stated access pattern is a guess — say so if one wasn't given.
- Default to reversible, staged changes for anything that touches a
table already holding data — see
references/migrations.md. - Don't duplicate
database-lens.md. If a review-time query/index check applies, point there instead of re-deriving it here. - Security-sensitive schema decisions (RLS, privilege,
GRANT) belong tosecurity-review-edho-ferdian— this skill covers structure and access patterns, not authorization design.
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.

