بنقرة واحدة
coder-system-design-db-schema
Database schema design and migration safety rules for production systems.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Database schema design and migration safety rules for production systems.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Mandatory baseline rules for any agent. Must be loaded before any work
Frontend design system practices: tokens, typography, color, layout, and component consistency.
Frontend UI/UX practices: flows, interaction states, accessibility-first UX, forms, and perceived performance.
Clean code execution rules for coding agents with verifiable quality gates.
Debugging requirements protocol from reproducible issue to verified fix and regression protection.
Requirement quality rules for coding tasks with traceable MUST/SHOULD and verifiable acceptance criteria.
| name | coder-system-design-db-schema |
| description | Database schema design and migration safety rules for production systems. |
<when_to_use> Designing relational schema for new services or major feature changes Planning schema evolution and data migrations in production Reviewing index/constraint strategy and multi-tenant data isolation </when_to_use>
<input_requirements> Core entities and relationships Read/write access patterns and query shapes Data retention, audit, and compliance constraints Deployment constraints (downtime, lock tolerance, rollback) </input_requirements>
<design_principles> Start normalized; denormalize only for measured bottlenecks Enforce integrity in database using PK/FK/unique/check constraints Design indexes from real query predicates and sort patterns Use compatibility-first schema evolution via expand and contract Treat tenant isolation as explicit schema and policy decision Separate audit history needs from soft-delete convenience </design_principles>
<decision_points> Normalization vs denormalization based on read latency and write amplification tradeoff Tenant model: database-per-tenant vs schema-per-tenant vs shared-schema with tenant_id Deletion model: hard delete vs soft delete vs temporal/audit tables Key strategy: surrogate vs natural keys with interoperability constraints </decision_points>
<migration_safety_checklist> Migration is split into expand, backfill, switch, and contract phases Lock impact and long-running DDL risk are analyzed before rollout Online index strategy is used where supported Backfill is batched, idempotent, and observable Rollback or roll-forward path is explicitly documented Post-migration validation queries are defined before deploy </migration_safety_checklist>
<quality_rules> Do not perform breaking schema changes without compatibility window Do not rely on app-level validation for integrity-critical constraints only Do not ship index changes without query-path rationale Do not run unbounded data backfill during peak load without controls </quality_rules>
<do_not> Do not rename/drop hot-path columns and tables in same release as app switch Do not add broad indexes "just in case" Do not treat soft delete as complete audit solution </do_not>
<output_requirements> Schema proposal with constraints and index rationale Phased migration plan with safety controls Verification SQL and rollback strategy Risks and operational caveats </output_requirements>