cursor-rules / rules
Cursor rule8 starsChanged 19 months agoMITView on GitHub
AWS DynamoDB Best Practices
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository17 other files it gives its agents.
- .cursor/rules/aws-bedrock.mdcCursor rule
- .cursor/rules/aws-cloudformation.mdcCursor rule
- .cursor/rules/aws-eventbridge.mdcCursor rule
- .cursor/rules/aws-gamelift.mdcCursor rule
- .cursor/rules/aws-iam.mdcCursor rule
- .cursor/rules/aws-lambda.mdcCursor rule
- .cursor/rules/aws-sagemaker.mdcCursor rule
- .cursor/rules/aws-sam.mdcCursor rule
- .cursor/rules/aws-vpc.mdcCursor rule
- .cursor/rules/base.mdcCursor rule
- .cursor/rules/docs-structure.mdcCursor rule
- .cursor/rules/expo.mdcCursor rule
- .cursor/rules/nextjs.mdcCursor rule
- .cursor/rules/react.mdcCursor rule
- .cursor/rules/react-native.mdcCursor rule
- .cursor/rules/readme-documentation.mdcCursor rule
- .cursor/rules/typescript.mdcCursor rule
The file
Show its rules and text
We split this aws-dynamodb.mdc into the rules it gives an agent
44 rules. About 0 are common, 43 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈43
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Start with access patterns before determining table structure
- Distinctive: line 18
Use single-table design for related entities when appropriate
- Distinctive: line 19
Keep item sizes small (preferably under 4KB)
- Distinctive: line 20
Avoid overly normalized data structures
- Distinctive: line 26
Avoid partition keys that could create hot spots
- Distinctive: line 27
Use composite sort keys for hierarchical relationships
- Distinctive: line 29
Use meaningful prefixes in sort keys for item collection filtering
- Distinctive: line 31
Consider using GSIs for alternative access patterns
- Distinctive: line 34
Use consistent attribute naming conventions
- Distinctive: line 37
Use short attribute names for frequently accessed items
- Distinctive: line 39
Use consistent JSON serialization for complex nested objects
- Distinctive: line 40
Consider compression for large attribute values
- Distinctive: line 43
Use sparse indexes where appropriate
- Distinctive: line 44
Create GSIs only for required access patterns
- Very specific: line 45
Keep index projections minimal (KEYS_ONLY or INCLUDE specific attributes)
- Distinctive: line 46
Use LSIs sparingly due to partition size limits
- Distinctive: line 48
Consider overloading indexes for multiple access patterns
- Distinctive: line 49
Use index sort keys to enable range filtering
- Distinctive: line 52
Use query operations instead of scans whenever possible
- Distinctive: line 54
Use consistent reads for time-sensitive operations
- Distinctive: line 55
Use eventually consistent reads for non-critical operations
- Distinctive: line 61
Use BatchWriteItem for bulk operations (max 25 items)
- Distinctive: line 62
Use conditional writes to prevent race conditions
- Distinctive: line 64
Use atomic counters for high-contention updates
- Distinctive: line 69
Use streams for event-driven architectures
- Distinctive: line 78
Use on-demand capacity for unpredictable workloads
- Distinctive: line 79
Use provisioned capacity with auto-scaling for predictable workloads
- Distinctive: line 82
Use DAX for read-heavy workloads that can leverage caching
- Distinctive: line 84
Use appropriate retry policies with exponential backoff
- Distinctive: line 89
Use TTL for automatic data expiration
- Distinctive: line 92
Use DAX for read-heavy workloads to reduce read capacity needs
- Distinctive: line 93
Consider using Reserved Capacity for stable workloads
- Distinctive: line 97
Use VPC endpoints for private access
- Distinctive: line 100
Use IAM condition keys to restrict access to specific items
- Distinctive: line 107
Create migration strategies for changing access patterns
- Distinctive: line 108
Use DynamoDB Streams for online migrations
- Distinctive: line 109
Test migrations in non-production environments
- Distinctive: line 111
Document data structures and access patterns
- Distinctive: line 114
Use a repository pattern to abstract database operations
- Distinctive: line 115
Create strongly typed data models
- Distinctive: line 120
Add tracing and logging for database operations
- Distinctive: line 124
Use transactions for multi-item operations requiring consistency
- Distinctive: line 126
Document consistency requirements for each operation
- Distinctive: line 127
Consider event sourcing for complex state tracking
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
--- description: AWS DynamoDB Best Practices globs: alwaysApply: false --- --- Description: AWS DynamoDB Best Practices Globs: **/dynamodb/**/*.ts, **/models/**/*.ts, **/database/**/*.ts, **/repositories/**/*.ts --- # AWS DynamoDB Development Standards @base.mdc @typescript.mdc ## Data Modeling Principles - Design for query patterns, not data relationships - Start with access patterns before determining table structure - Use single-table design for related entities when appropriate - Keep item sizes small (preferably under 4KB) - Avoid overly normalized data structures - Balance between read and write efficiency based on workload - Design with future growth and changing access patterns in mind ## Key Design - Choose partition keys with high cardinality to distribute data evenly - Avoid partition keys that could create hot spots - Use composite sort keys for hierarchical relationships - Design sort keys to support range queries efficiently - Use meaningful prefixes in sort keys for item collection filtering - Implement composite keys with delimiters (e.g., `USER#123#PROFILE`) - Consider using GSIs for alternative access patterns ## Item Structure - Use consistent attribute naming conventions - Include entity type discriminator attributes - Denormalize data when it supports common access patterns - Use short attribute names for frequently accessed items - Store date/time values in ISO format - Use consistent JSON serialization for complex nested objects - Consider compression for large attribute values ## Secondary Indexes - Use sparse indexes where appropriate - Create GSIs only for required access patterns - Keep index projections minimal (KEYS_ONLY or INCLUDE specific attributes) - Use LSIs sparingly due to partition size limits - Design indexes to support efficient query patterns - Consider overloading indexes for multiple access patterns - Use index sort keys to enable range filtering ## Query Optimization - Use query operations instead of scans whenever possible - Implement pagination for large result sets - Use consistent reads for time-sensitive operations - Use eventually consistent reads for non-critical operations - Batch operations for multiple items when possible - Leverage query filtering only for post-filtering, not as a primary filter - Implement cursor-based pagination over offset-based ## Write Operations - Use BatchWriteItem for bulk operations (max 25 items) - Use conditional writes to prevent race conditions - Implement optimistic locking with version attributes - Use atomic counters for high-contention updates - Leverage transactions for multi-item consistency - Implement idempotent write operations ## DynamoDB Streams - Use streams for event-driven architectures - Process stream events asynchronously - Implement idempotent Lambda consumers - Set appropriate batch size and window for stream processors - Handle partial failures in stream consumers - Track stream processing position for recovery - Leverage Kinesis for complex stream processing ## Performance & Scaling - Use on-demand capacity for unpredictable workloads - Use provisioned capacity with auto-scaling for predictable workloads - Implement adaptive capacity planning - Monitor and adjust capacity based on usage patterns - Use DAX for read-heavy workloads that can leverage caching - Implement client-side request batching and caching - Use appropriate retry policies with exponential backoff ## Cost Optimization - Choose the right capacity mode for your workload - Minimize index count and attribute projections - Use TTL for automatic data expiration - Implement data archiving strategies for historical data - Monitor and optimize read/write capacity usage - Use DAX for read-heavy workloads to reduce read capacity needs - Consider using Reserved Capacity for stable workloads ## Security Best Practices - Implement fine-grained IAM policies with least privilege - Use VPC endpoints for private access - Enable server-side encryption - Implement attribute-level encryption for sensitive data - Use IAM condition keys to restrict access to specific items - Audit DynamoDB access with CloudTrail - Implement data classification and handling procedures ## Data Migration & Evolution - Plan for schema evolution in single-table designs - Implement versioning for item structures - Create migration strategies for changing access patterns - Use DynamoDB Streams for online migrations - Test migrations in non-production environments - Implement rollback procedures for failed migrations - Document data structures and access patterns ## Repository Pattern Implementation - Use a repository pattern to abstract database operations - Create strongly typed data models - Implement data validation before persistence - Create entity-specific repositories - Share common query building utilities - Handle errors and retries consistently - Add tracing and logging for database operations ## Data Consistency - Understand and leverage DynamoDB's consistency model - Use transactions for multi-item operations requiring consistency - Implement optimistic concurrency control - Document consistency requirements for each operation - Consider event sourcing for complex state tracking
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

