physical-data-modeling
Physical data model — vendor-specific schema with platform types, indexes, partitioning, sharding, de-normalization driven by query patterns, DDL. Platform-specific.
What this skill does
# Physical Data Modeling
You produce a vendor-specific physical schema: platform types, indexes, partitioning, sharding, de-normalization decisions, and DDL.
## Core rules
- **Platform declared** (Postgres / MySQL / MongoDB / DynamoDB / Cassandra / BigQuery / Snowflake)
- **Query patterns drive indexes + de-normalization** — not theoretical optimization
- **De-normalization justified** — every departure from 3NF has a reason (read pattern / scale / latency)
- **Cost-awareness** — indexes cost writes; partitions cost complexity
- **Migration safety** — schema changes reversible or carefully planned
## Platform-specific considerations
### Postgres
- Rich types (JSONB, arrays, ranges, custom)
- GIN/GiST indexes for JSONB/full-text
- Table partitioning (range / list / hash)
- Vacuum/autovacuum considerations
### MySQL
- InnoDB defaults
- Limited JSON support (use sparingly)
- Partitioning coarse-grained
### MongoDB
- Document design: embed vs reference per access pattern
- Single-table denormalization typical
- Indexes on query paths
- Sharding key critical (cannot change)
### DynamoDB
- Single-table design typical
- Partition key + sort key drive everything
- GSI / LSI for alternate access patterns
- Query-first modeling
### Cassandra
- Query-first
- Partition + clustering keys
- Materialized views / secondary indexes limited
### BigQuery / Snowflake (analytical)
- Columnar
- Partition by date
- Clustering on common filter keys
- Minimal indexes (vs OLTP)
## Index strategy
Per table:
- **Primary key** — implicit clustered index
- **Unique indexes** — for uniqueness + fast lookup
- **Non-unique secondary indexes** — per access pattern
- **Composite indexes** — ordering matters; leftmost-prefix rule
- **Covering indexes** — include columns to avoid table lookups
- **Partial / filtered indexes** — when only subset of rows queried
- **GIN / GiST / Hash** — for JSONB / full-text / equality-only
Rule of thumb: index only for measured query patterns; too many = write-amplification.
## Partitioning
Triggered by table size > threshold (typically 100M+ rows) or regulatory separation:
- **Range** — time-series (created_at)
- **List** — per-region, per-tenant
- **Hash** — when data distribution uneven
Trade-offs:
- Partition pruning speeds queries
- Cross-partition queries slower
- Management overhead (new partitions, retention)
## Sharding
For horizontal scale beyond single-node:
- **Shard key choice** (irreversible in some DBs)
- **Consistent hashing** or range
- **Cross-shard queries** (slow — avoid in hot path)
- **Rebalancing** strategy
## De-normalization
Per de-normalization decision:
- **What** was de-normalized
- **Why** (query pattern, latency SLO, scale)
- **Maintenance cost** (update consistency, migration)
- **Alternative considered**
## Constraint enforcement
| Constraint | DB-level | App-level | Notes |
|---|---|---|---|
| NOT NULL | ✅ | — | Always DB-level |
| UNIQUE | ✅ | — | Always DB-level |
| CHECK | ✅ | ✅ | DB for guarantee; app for UX |
| FK | ✅ / ⚠️ | ✅ | Some DBs (Mongo, DynamoDB) — app-level only |
| Business rules | — | ✅ | App-level (with trigger rarely) |
## DDL output
Emit vendor-specific DDL:
```sql
-- Postgres example
CREATE TABLE orders (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
customer_id UUID NOT NULL REFERENCES customers(id) ON DELETE RESTRICT,
status VARCHAR(32) NOT NULL CHECK (status IN ('pending','paid','shipped','delivered','refunded')),
total_cents BIGINT NOT NULL CHECK (total_cents >= 0),
metadata JSONB,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
) PARTITION BY RANGE (created_at);
CREATE INDEX idx_orders_customer ON orders (customer_id);
CREATE INDEX idx_orders_status ON orders (status) WHERE status IN ('pending','paid');
CREATE INDEX idx_orders_metadata ON orders USING GIN (metadata);
```
## Report
```markdown
# Physical Data Model: [Domain / Platform]
## Platform + Rationale
[Why this DB for this use case]
## Logical-to-Physical Mapping
[Per logical entity → physical representation]
## Indexes
[Per index: columns / type / use case / cost-benefit]
## Partitioning / Sharding
[Strategy + key choice]
## De-normalization Decisions
[Per decision: what / why / cost]
## Constraints
[Enforcement location per constraint]
## DDL
[SQL / NoSQL schema definitions]
## Migration Plan
[Deployment approach, reversibility]
```
## Failure behavior
- Platform not declared → require
- Query patterns unknown → predict typical; flag as `[Assumed]`
- Over-indexed → recommend cleanup
- Sharding key questionable → flag irreversibility risk
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.