Ref https://sbstjn.com/blog/ai-code-companion-cursor-rules/
When processing these requirements, the AI assistant must:
- Enforce all standards in code suggestions and recommendations
- Proactively identify any deviations from these guidelines
- Provide clear explanations for architectural decisions with references to specific sections
- Consider security, scalability, and maintainability in all suggestions
- Validate code against the quality requirements defined herein
Solutions must align with:
- Domain-Driven Design (DDD) principles
- Twelve-Factor App methodology
- AWS cloud-native architecture
- Controlled vendor lock-in strategy
- Serverless-first approach
Solutions must demonstrate understanding of:
- Team Topologies for organizational design
- Wardley Mapping for strategic planning
- Conway's Law implications
- SOLID principles
- Single Source of Truth
- Bounded Contexts
- Command Query Responsibility Segregation
- Systems Thinking
- Organizational Theory
When evaluating implementation choices, consider:
-
Security Impact:
- Data protection requirements
- Authentication/authorization implications
- Compliance requirements
-
Operational Excellence:
- Monitoring capabilities
- Deployment complexity
- Maintenance overhead
-
Cost Optimization:
- Resource utilization
- Scaling characteristics
- Service selection trade-offs
-
Performance Efficiency:
- Response time targets
- Resource constraints
- Scaling thresholds
Infrastructure as Code must use AWS IAC.CDK with TypeScript and follow these standards:
- Use
aws-cdk-libwith explicitaws_*prefixes - Implement custom constructs for reusable patterns
- Separate concerns into distinct CloudFormation stacks
- Organize resources by functional groups: storage, compute, authentication, API, access
Follow AWS Well-Architected Framework principles.
- Lambda: Node.js with JSDocs for types implementation on ARM64 architecture
- Authentication: Cognito with OAuth2 and OIDC support
- API: API Gateway with Cognito/IAM authentication
- GraphQL: AppSync with function resolvers, avoid VTL templates
- Workflow: Step Functions for orchestration
- Security: Custom KMS keys and encryption-at-rest
- Observability: Comprehensive logging, metrics, and tracing
- Use DynamoDB as primary data store
- Use expression attributes for reserved words
- Implement pagination with nextToken
- Define explicit partition/sort key strategies
- Use API gateway REST and HTTP versions where applicable.
- API endpoints should follow REST best practices
- API endpoints should follow JSONAPI spec https://jsonapi.org/
- Maintain consistent error handling
- Document all schema changes
- React with TypeScript via JSDocs
- CSS Modules and PostCSS for styling
- Mantine component library
...
- Use the
uvunpm package for unit testing - API testing should using https://github.com/Huachao/vscode-restclient?tab=readme-ov-file#usage where API calls are marked in the docs in codefences marked with http like below:
POST https://example.com/comments HTTP/1.1
content-type: application/json
{
"name": "sample",
"time": "Wed, 21 Oct 2015 18:27:50 GMT"
}- React Testing Library for frontend component testing
- For cloud resource testing, we prefer integration testing against a live stack