Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

dynamodb-table-designDynamodb 表设计

Agent Skill

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

总安装

465

周安装

19

GitHub Stars

公开资料未说明

下载量

150
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:dynamodb-table-design(Dynamodb 表设计)
来源仓库:https://github.com/juancarestre/dynamodb-skills
仓库路径:skills/dynamodb-table-design
安装命令:
npx skills add https://github.com/juancarestre/dynamodb-skills --skill dynamodb-table-design
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/juancarestre/dynamodb-skills --skill dynamodb-table-design

简介

将访问模式文档转化为具体的 DynamoDB 主键、排序键及全局索引设计方案。

  • 映射每条查询路径至实际 API 调用,明确条件表达式与投影字段规则。
  • 支持实体扩展与现有表结构兼容,输出可直接用于 Terraform 或 CloudFormation。
  • 依赖前置的模式文件,若未检测到输入则提示用户提供 .md 格式访问清单。
  • dynamodb-table-design 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

DynamoDB Table Design

This skill takes a formalized access patterns document and produces a complete DynamoDB single-table design. It maps every access pattern to a concrete DynamoDB operation with explicit key conditions.

When to Use

  • The user has an access patterns .md file (from dynamodb-access-patterns or manually written)
  • The user wants to design PK/SK structures for their entities
  • The user wants to decide which GSIs they need
  • The user wants to verify that every access pattern is covered by the table design
  • The user wants to add a new entity to an existing table design

Pipeline Position

  1. Access Patterns  -->  [2. Table Design]  -->  3. Query Interfaces
  (dynamodb-access-       (this skill)           (dynamodb-query-
   patterns)                                      interfaces)

Input: Access patterns .md file Output: Table design .md file consumed by dynamodb-query-interfaces


Prerequisites

Before starting, read the access patterns file. If it doesn't exist or is incomplete, tell the user to run the dynamodb-access-patterns skill first.

If the user already has a table in production and wants to add entities, also read their existing table design file (if any) to understand current keys and GSIs.


Design Workflow

Step 1: Read and Validate Access Patterns

Read the access patterns file and verify:

  1. Every access pattern has an ID (AP-XXX)
  2. Every pattern specifies input parameters and result type
  3. Multi-entity patterns are explicitly marked
  4. Write patterns specify transaction requirements

If anything is missing, ask the user to clarify before proceeding.

Step 2: Group Entities into Item Collections

This is the core of single-table design. Analyze the access patterns to determine which entities should share a partition key.

Rules for grouping:

  1. Entities fetched together in a multi-entity read MUST share a PK.

- If AP-003 fetches User + Orders together, they must share a PK.

  1. 1:N relationships where the parent is always known go under the parent's PK.

- Orders belong to a User -> PK = USER#userId

  1. Entities accessed only by their own ID get their own PK.

- A Product looked up by productId -> PK = PRODUCT#productId

  1. Global collections (list all, leaderboard) use a static PK.

- All products catalog -> PK = PRODUCTS

  1. N:N or deeply nested relationships use composite PKs.

- Items in a specific cart -> PK = USER#userId#CART#cartId

Present the proposed grouping to the user:

Based on your access patterns, here's how I'd group entities:

Item Collection 1: User scope
  PK = USER#<userId>
  Contains: User, Order, Balance, Preferences
  Supports: AP-001, AP-002, AP-003, AP-005

Item Collection 2: Product catalog
  PK = PRODUCTS
  Contains: Product (catalog entries)
  Supports: AP-006, AP-007

Item Collection 3: Product detail
  PK = PRODUCT#<productId>
  Contains: Product (full record), Review
  Supports: AP-008, AP-009, AP-010

Does this grouping make sense? Any patterns I'm missing?

Step 3: Design Primary Keys

For each item type, define the PK and SK.

Key Design Principles:

Separator Convention

Use # as the separator between key segments. This is the universal DynamoDB convention.

PK = ENTITY_PREFIX#identifier
SK = ENTITY_PREFIX#identifier

PK Patterns

PatternFormatUse Case
Entity-scopedENTITY#<id>Self-lookup, entity owns its collection
Parent-scopedPARENT#<parentId>Children queried under a parent
Static collectionCOLLECTION_NAMEGlobal lists, catalogs, leaderboards
HierarchicalPARENT#<id>#CHILD#<childId>Deep nesting (use sparingly)

SK Patterns

PatternFormatUse Case
Same as PKENTITY#<id>1:1 self-referencing record
Child entityCHILD_TYPE#<childId>Items in a collection
CompositeTYPE#<sortField>#<uniqueId>Multi-field sorting
MetadataMETADATA or COUNTERSingleton items in a collection
Timestamp-prefixedTYPE#<ISO-timestamp>#<id>Time-ordered collections

Sort Key Design for Range Queries

If an access pattern needs sorting or range queries, the sort field MUST be encoded in the SK:

# Sort by date (newest first -- use ScanIndexForward=false)
SK = ORDER#2024-01-15T10:30:00Z#01HORDERID

# Sort by score (string-encoded numbers must be zero-padded)
SK = SCORE#000150#01HPLAYERID    (score=150, padded to 6 digits)

# Sort by status + date (hierarchical sort)
SK = ORDER#SHIPPED#2024-01-15T10:30:00Z#01HORDERID

Zero-padding rule: When numbers are used in string sort keys, they MUST be zero-padded to a fixed width so lexicographic order matches numeric order. Decide the maximum expected value and pad accordingly.

Descending order trick: To sort descending without ScanIndexForward=false, invert the value:

SK = SCORE#<(MAX_SCORE - actualScore) zero-padded>#<id>

Step 4: Identify GSI Requirements

For each access pattern NOT covered by the table's PK/SK, determine if a GSI is needed.

You need a GSI when:

SituationExample
Query by a non-key attribute"Find user by email" (table PK is userId)
Different sort order on same collection"Orders by total" (table SK sorts by date)
Inverted relationship"Find all orders containing product X"
Global sorted view"Leaderboard sorted by score"

GSI Design Rules:

  1. Reuse GSIs aggressively. DynamoDB allows max 20 GSIs per table. Each GSI costs additional storage and write capacity. Design GSI keys to be overloaded across entity types when possible.
  2. Name GSIs generically. Use GSI1, GSI2, GSI3 for overloaded indexes. Use descriptive names only for single-purpose indexes (e.g., email-index).
  3. GSI key attributes follow the naming convention:

- Overloaded: GSI1PK (String), GSI1SK (String) - Single-purpose: The actual attribute name (e.g., email as PK, createdAt as SK)

  1. Choose the right projection:

- ALL -- projects all attributes (default, simplest, most expensive) - KEYS_ONLY -- only key attributes (cheapest, requires table fetch for other attributes) - INCLUDE -- specific attributes (middle ground)

  1. Sparse indexes are powerful. If only some items have the GSI attributes, only those items appear in the index. Use this to create filtered views.

Present GSI decisions to the user:

I need the following GSIs:

GSI1 (overloaded, String/String):
  - User lookup by email: GSI1PK=EMAIL#<email>, GSI1SK=EMAIL#<email>
  - Order leaderboard: GSI1PK=ORDERS, GSI1SK=ORDER#<total-inverted>#<orderId>
  Projection: ALL

No additional GSIs needed. Total: 1 GSI.

Does this look right? Are there access patterns I should reconsider?

Step 5: Map Every Access Pattern to a DynamoDB Operation

This is the accountability step. EVERY access pattern from the input file must be mapped to a concrete DynamoDB operation.

For each access pattern, define:

FieldDescription
AP IDReference to the access pattern
DynamoDB OperationQuery, GetItem, BatchGetItem, PutItem, TransactWriteItems, UpdateItem, DeleteItem
Table or GSIWhich index to use
PK ValueExact partition key value (with placeholders)
SK Condition=, begins_with, >, <, >=, <=, BETWEEN
SK Value(s)The sort key value(s)
Additional ParametersLimit, ScanIndexForward, FilterExpression, ProjectionExpression
Condition ExpressionFor writes: conditions that must be met

Example:

AP-001: Get user by userId
  Operation: Query
  Table: Main
  PK: USER#<userId>
  SK: = USER#<userId>
  Params: Limit=1

AP-002: List orders for user, newest first
  Operation: Query
  Table: Main
  PK: USER#<userId>
  SK: begins_with(ORDER#)
  Params: ScanIndexForward=false, Limit=20, paginated

AP-010: Create order
  Operation: TransactWriteItems
  Items:
    1. Put: PK=USER#<userId>, SK=ORDER#<timestamp>#<orderId> (Condition: attribute_not_exists(pk))
    2. Put: PK=ORDER#<orderId>, SK=ORDER#<orderId> (Condition: attribute_not_exists(pk))
    3. Update: PK=USER#<userId>, SK=ORDER_COUNT (SET count = count + 1)

Step 6: Validate the Design

Read reference/validation-checklist.md and run through every check with the user before finalizing.


Output Format

Persist the output as a markdown file. Suggest docs/dynamodb/table-design.md or alongside the access patterns file.

Read reference/output-template.md for the exact file structure to use.


Common Design Patterns

Read reference/design-patterns.md for a catalog of reusable single-table design patterns. Reference these when making key design decisions and present relevant patterns to the user.


Rules for the Agent

  1. Read the access patterns file first. Never design keys without documented access patterns.
  2. Map EVERY access pattern. If a pattern can't be mapped, it's a design problem -- don't skip it.
  3. Prefer the base table over GSIs. Only add a GSI when the base table genuinely can't serve the pattern.
  4. Be interactive. Present groupings and key designs to the user for approval before finalizing.
  5. Show concrete examples. For each entity, include a sample JSON item.
  6. Document decisions. When there are trade-offs (e.g., duplication vs. extra query), explain both options and document the choice.
  7. Stay language-agnostic. Use DynamoDB operation names (Query, GetItem, TransactWriteItems) not SDK-specific function names.
  8. Challenge hot partitions. If a static PK like PRODUCTS will receive heavy traffic, discuss sharding strategies with the user.
  9. Consider write amplification. If an entity is written to 3 item collections, that's 3x write cost. Make sure it's justified.
  10. Persist the file. Always write the output to a .md file.

Next Step

Once the table design file is complete, tell the user:

Table design is documented at [file path].

The next step is to generate the query interface -- method signatures
for every access pattern, ready to be implemented in your language of choice.

To continue, use the `dynamodb-query-interfaces` skill with this file as input.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.54%
按下载量换算58

Claude

31.49%
按下载量换算47

Cursor

18.73%
按下载量换算28

Gemini CLI

9.03%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills