dynamodb-electrodb

Installation
SKILL.md

DynamoDB + ElectroDB

DynamoDB Single-Table Design

Single-table design stores all entity types in one DynamoDB table. Entities are distinguished by PK/SK prefix patterns.

Core principles

  • Design for access patterns, not entities: Start from how data will be queried, then design keys around those patterns. Unlike relational databases, you cannot add arbitrary queries after the fact.
  • Use composite keys: PK and SK are strings composed of multiple attributes (e.g., USER#<userId> for PK, PROFILE for SK). ElectroDB handles this composition automatically.
  • GSIs extend access patterns: A Global Secondary Index (GSI) provides an alternative PK/SK combination for queries that the main table's keys don't support.
  • Denormalize intentionally: Store data redundantly across items when read patterns demand it. Write-time aggregation (updating a counter when an item is created) avoids expensive read-time scans.
  • Avoid scans: Full table scans are expensive and slow. Every data access should use a Query (PK + optional SK condition) or GetItem (exact PK + SK).

Key design patterns

Pattern PK SK Use case
Entity lookup USER#<id> PROFILE Single-item get by ID
Related skills
Installs
2
First Seen
Mar 19, 2026