Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Provides AWS implementation patterns for Lambda, ECS, S3, DynamoDB, and CDK or Terraform infrastructure as code.
78% 96%+17 ptsof test cases passed
Passed 22 of 23 test cases with the skill, and 18 of 23 without it.
When modeling items in a DynamoDB single-table design interface in TypeScript (such as OrderItem records), what property names should be assigned for Global Secondary Index 1 partition key and sort key?
Uses lowercase gsi1pk for the GSI 1 partition key property name.
3 of 3 safety checks passed
import { APIGatewayProxyHandlerV2 } from "aws-lambda";
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, GetCommand } from "@aws-sdk/lib-dynamodb";
const client = DynamoDBDocumentClient.from(new DynamoDBClient({}));
export const handler: APIGatewayProxyHandlerV2 = async (event) => {
const id = event.pathParameters?.id;
if (!id) {
return { statusCode: 400, body: JSON.stringify({ error: "Missing id" }) };
}
const result = await client.send(
new GetCommand({ TableName: process.env.TABLE_NAME!, Key: { pk: id } })
);
if (!result.Item) {
return { statusCode: 404, body: JSON.stringify({ error: "Not found" }) };
}
return {
statusCode: 200,
headers: { "Content-Type": "application/json" },
body: JSON.stringify(result.Item),
};
};
Initialize SDK clients outside the handler to reuse connections across invocations.
interface OrderItem {
pk: string; // USER#<userId>
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.