Back to .md Directory

Cursor Rules: Development Flavor

Defines development conventions for a DUX object model project covering API design, testing, LLM integration, and deployment.

May 2, 2026
0 downloads
0 views
ai llm rag prompt cursor workflow safety
View source

What this file does

Defines development conventions for a DUX object model project covering API design, testing, LLM integration, and deployment.

When to use it

  • Building a DUX object model with JSON schema validation
  • Setting up a containerized development environment with Docker
  • Integrating LLM streaming and prompt engineering into a research app
  • Establishing code quality and testing standards for a new project

Assumes this stack

Neo4jDockerJSON SchemaLLMRESTVector Search

Cursor Rules: Development Flavor

Rapid prototyping, debugging, and code quality enforcement

include: .cursorrules.base

Development Architecture

  • API-First: Design APIs before implementation
  • Schema-Driven: Use JSON schemas to validate all data structures
  • Test-Driven: Write tests for all DUX object validations
  • Containerized: Docker-based development environment

Code Quality Standards

  • Type Safety: Use type hints and validation for all DUX objects
  • Error Handling: Graceful degradation and meaningful error messages
  • Logging: Structured logging for debugging and monitoring
  • Documentation: Inline docs for all public APIs and schemas

DUX Object Processing

  • Schema Validation: All objects must pass JSON schema validation
  • Evidence Linking: Ensure all claims link to valid Provenance objects
  • Atomic Operations: Process objects independently for fault tolerance
  • Batch Processing: Support bulk operations for efficiency

API Design Patterns

  • RESTful: Standard HTTP methods for CRUD operations
  • Streaming: Real-time processing for LLM responses
  • Validation: Input validation at API boundaries
  • Error Responses: Consistent error format with actionable messages

Database Integration

  • Neo4j: Graph database for DUX object relationships
  • Vector Search: Embedding-based similarity search
  • Indexing: Optimize queries for common access patterns
  • Backup: Regular backups of research data and schemas

LLM Integration

  • Prompt Engineering: Structured prompts for consistent object extraction
  • Streaming: Real-time token streaming for user feedback
  • Error Recovery: Handle LLM failures gracefully
  • Cost Optimization: Monitor and optimize token usage

Testing Strategy

  • Unit Tests: Test individual object validation and processing
  • Integration Tests: Test API endpoints and database operations
  • Schema Tests: Validate all JSON schemas are correct
  • End-to-End Tests: Test complete workflows from upload to storage

Development Workflow

  • Local Development: Docker Compose for local environment
  • Hot Reloading: Fast iteration for API development
  • Debugging: Comprehensive logging and error tracking
  • Code Review: Automated checks for schema compliance

Performance Optimization

  • Caching: Cache frequently accessed DUX objects
  • Async Processing: Non-blocking operations for better UX
  • Batch Operations: Efficient bulk processing of objects
  • Resource Monitoring: Track memory and CPU usage

Security Considerations

  • Input Sanitization: Validate and sanitize all user inputs
  • Authentication: Secure access to research data
  • Data Encryption: Encrypt sensitive research data
  • Audit Logging: Track all data access and modifications

Deployment Patterns

  • Containerization: Docker images for consistent deployment
  • Environment Variables: Configuration via environment variables
  • Health Checks: Monitor service health and dependencies
  • Rollback Strategy: Quick rollback for failed deployments

Monitoring & Observability

  • Metrics: Track API performance and object processing rates
  • Logging: Structured logs for debugging and analysis
  • Alerting: Notify on errors and performance issues
  • Tracing: Track requests through the system

What's inside

14 sections covering architecture, code quality, DUX processing, API design, database, LLM, testing, workflow, performance, security, deployment, and monitoring

Change this for your project

  • Replace DUX with your own domain object prefix throughout
  • Replace Neo4j with your own database if not using graph DB
  • Replace nicholasjayantylearns/dux-object-model-core with your repository name

Where it goes

Keep it in your repository where the agent or team that needs it will read it.

Worth borrowing

  • API-First and Schema-Driven design ensures contracts are validated before implementation
  • Structured sections for LLM integration, testing strategy, and monitoring provide a complete development playbook

Related Documents