Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Provides TypeScript patterns for DynamoDB-Toolbox v2 including schema/table/entity modeling, .build() command workflow, query/scan access patterns, batch and transaction operations, and single-table design with computed keys. Use when implementing type-safe DynamoDB access layers with DynamoDB-Toolbox v2 in TypeScript services or serverless applications.
.claude/skills/giuseppe-trisciuoglio-dynamodb-toolbox-patterns/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 56% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 11% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 58% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 188% | 0% |
This skill provides practical TypeScript patterns for using DynamoDB-Toolbox v2 with AWS SDK v3 DocumentClient. It focuses on type-safe schema modeling, .build() command usage, and production-ready single-table design.
item, string, number, list, set, map, and recordGetItem, PutItem, UpdateItem, DeleteItem via .build().key(), .required(), .default(), .transform(), .link()..build() commands everywhere: avoid ad-hoc command construction for consistency and type safety.bashnpm install dynamodb-toolbox @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb
typescriptimport { DynamoDBClient } from '@aws-sdk/client-dynamodb'; import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb'; import { Table } from 'dynamodb-toolbox/table'; import { Entity } from 'dynamodb-toolbox/entity'; import { item, string, number, list, map } from 'dynamodb-toolbox/schema'; const client = new DynamoDBClient({ region: process.env.AWS_REGION ?? 'eu-west-1' }); const documentClient = DynamoDBDocumentClient.from(client); export const AppTable = new Table({ name: 'app-single-table', partitionKey: { name: 'PK', type: 'string' }, sortKey: { name: 'SK', type: 'string' }, indexes: { byType: { type: 'global', partitionKey: { name: 'GSI1PK', type: 'string' }, sortKey: { name: 'GSI1SK', type: 'string' } } }, documentClient });
typescriptconst now = () => new Date().toISOString(); export const UserEntity = new Entity({ name: 'User', table: AppTable, schema: item({ tenantId: string().required('always'), userId: string().required('always'), email: string().required('always').transform(input => input.toLowerCase()), role: string().enum('admin', 'member').default('member'), loginCount: number().default(0), tags: list(string()).default([]), profile: map({ displayName: string().optional(), timezone: string().default('UTC') }).default({ timezone: 'UTC' }) }), computeKey: ({ tenantId, userId }) => ({ PK: `TENANT#${tenantId}`, SK: `USER#${userId}`, GSI1PK: `TENANT#${tenantId}#TYPE#USER`, GSI1SK: `EMAIL#${userId}` }) });
.build() CRUD Commandstypescriptimport { PutItemCommand } from 'dynamodb-toolbox/entity/actions/put'; import { GetItemCommand } from 'dynamodb-toolbox/entity/actions/get'; import { UpdateItemCommand, $add } from 'dynamodb-toolbox/entity/actions/update'; import { DeleteItemCommand } from 'dynamodb-toolbox/entity/actions/delete'; await UserEntity.build(PutItemCommand) .item({ tenantId: 't1', userId: 'u1', email: 'A@Example.com' }) .send(); const { Item } = await UserEntity.build(GetItemCommand) .key({ tenantId: 't1', userId: 'u1' }) .send(); await UserEntity.build(UpdateItemCommand) .item({ tenantId: 't1', userId: 'u1', loginCount: $add(1) }) .send(); await UserEntity.build(DeleteItemCommand) .key({ tenantId: 't1', userId: 'u1' }) .send();
typescriptimport { QueryCommand } from 'dynamodb-toolbox/table/actions/query'; import { ScanCommand } from 'dynamodb-toolbox/table/actions/scan'; const byTenant = await AppTable.build(QueryCommand) .query({ partition: `TENANT#t1`, range: { beginsWith: 'USER#' } }) .send(); const byTypeIndex = await AppTable.build(QueryCommand) .query({ index: 'byType', partition: 'TENANT#t1#TYPE#USER' }) .options({ limit: 25 }) .send(); const scanned = await AppTable.build(ScanCommand) .options({ limit: 100 }) .send();
typescriptimport { BatchWriteCommand } from 'dynamodb-toolbox/table/actions/batchWrite'; import { TransactWriteCommand } from 'dynamodb-toolbox/table/actions/transactWrite'; await AppTable.build(BatchWriteCommand) .requests( UserEntity.build(PutItemCommand).item({ tenantId: 't1', userId: 'u2', email: 'u2@example.com' }), UserEntity.build(PutItemCommand).item({ tenantId: 't1', userId: 'u3', email: 'u3@example.com' }) ) .send(); await AppTable.build(TransactWriteCommand) .requests( UserEntity.build(PutItemCommand).item({ tenantId: 't1', userId: 'u4', email: 'u4@example.com' }), UserEntity.build(UpdateItemCommand).item({ tenantId: 't1', userId: 'u1', loginCount: $add(1) }) ) .send();
TENANT#, USER#, ORDER#).computeKey) to avoid drift..options({ consistent: true }) only where strict read-after-write is required.Primary references curated from Context7 are available in:
references/api-dynamodb-toolbox-v2.md| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 20,964 | 14,686 | -30% | 1 | 1 | 0% | 4,189 | 4,949 | +18% | 0 | 0 | — |
case-02 | fail→pass | 12,961 | 11,145 | -14% | 1 | 1 | 0% | 2,731 | 4,266 | +56% | 0 | 0 | — |
case-03 | fail→pass | 18,585 | 10,001 | -46% | 1 | 1 | 0% | 3,588 | 3,969 | +11% | 0 | 0 | — |
case-12 | pass→pass | 9,132 | 4,984 | -45% | 1 | 1 | 0% | 1,736 | 2,878 | +66% | 0 | 0 | — |
case-04 | pass→pass | 9,369 | 11,799 | +26% | 1 | 1 | 0% | 1,915 | 4,094 | +114% | 0 | 0 | — |
case-05 | pass→pass | 13,617 | 14,279 | +5% | 1 | 1 | 0% | 2,612 | 4,628 | +77% | 0 | 0 | — |
case-06 | pass→pass | 7,207 | 5,470 | -24% | 1 | 1 | 0% | 1,362 | 2,857 | +110% | 0 | 0 | — |
case-07 | fail→pass | 14,734 | 6,022 | -59% | 1 | 1 | 0% | 1,845 | 2,907 | +58% | 0 | 0 | — |
case-08 | pass→pass | 5,483 | 4,178 | -24% | 1 | 1 | 0% | 976 | 2,607 | +167% | 0 | 0 | — |
case-09 | fail→pass | 4,515 | 1,961 | -57% | 1 | 1 | 0% | 752 | 2,167 | +188% | 0 | 0 | — |
case-10 | pass→pass | 8,208 | 4,253 | -48% | 1 | 1 | 0% | 1,292 | 2,558 | +98% | 0 | 0 | — |
case-11 | fail→pass | 10,213 | 5,734 | -44% | 1 | 1 | 0% | 1,780 | 2,865 | +61% | 0 | 0 | — |
case-13 | fail→pass | 10,012 | 5,435 | -46% | 1 | 1 | 0% | 1,696 | 2,842 | +68% | 0 | 0 | — |
case-14 | fail→pass | 15,838 | 6,520 | -59% | 1 | 1 | 0% | 2,990 | 3,340 | +12% | 0 | 0 | — |
case-15 | fail→pass | 13,363 | 10,882 | -19% | 1 | 1 | 0% | 2,484 | 3,453 | +39% | 0 | 0 | — |
case-16 | pass→pass | 8,875 | 5,473 | -38% | 1 | 1 | 0% | 1,514 | 2,697 | +78% | 0 | 0 | — |
case-17 | pass→pass | 5,212 | 3,201 | -39% | 1 | 1 | 0% | 847 | 2,446 | +189% | 0 | 0 | — |
case-18 | pass→pass | 8,177 | 7,472 | -9% | 1 | 1 | 0% | 1,330 | 2,533 | +90% | 0 | 0 | — |
case-19 | pass→pass | 10,645 | 6,420 | -40% | 1 | 1 | 0% | 1,941 | 3,047 | +57% | 0 | 0 | — |
case-20 | pass→pass | 10,607 | 3,603 | -66% | 1 | 1 | 0% | 1,896 | 2,467 | +30% | 0 | 0 | — |
case-21 | pass→pass | 10,811 | 6,165 | -43% | 1 | 1 | 0% | 2,152 | 2,971 | +38% | 0 | 0 | — |
case-22 | pass→pass | 8,694 | 6,347 | -27% | 1 | 1 | 0% | 1,442 | 3,011 | +109% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +41 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.