System rules for using DeepSeek V3 to develop backend APIs with Node.js/Express or Python/FastAPI, covering security, validation, error handling, and documentation.
# DeepSeek V3 Backend API Development Rules
## API Design Standards
- RESTful conventions: nouns for resources, HTTP verbs for actions
- Versioning: /api/v1/ prefix for all endpoints
- Response format: { success: boolean, data?: T, error?: { code: string, message: string } }
- Pagination: deepseek-based for large datasets, offset for small ones
- Rate limiting: include X-RateLimit-* headers in responses
## Security Rules (NON-NEGOTIABLE)
1. NEVER trust client input — validate and sanitize everything
2. Use parameterized queries for ALL database operations (no string concatenation)
3. Hash passwords with bcrypt (cost factor >= 12) or argon2
4. JWTs: short expiry (15min access, 7d refresh), rotate signing keys quarterly
5. CORS: whitelist specific origins, never use wildcard (*) in production
6. HTTPS only — set HSTS header
7. No sensitive data in URL parameters or logs
## Error Handling
- Custom error classes extending Error with status code and error code
- Global error handler middleware as last middleware in chain
- Log errors with structured logging (JSON format with request ID)
- Never expose stack traces or internal details in production responses
- Return appropriate HTTP status codes (400 for client, 500 for server errors)
## Database Rules
- Use migrations for ALL schema changes (never manual DDL in production)
- Foreign keys with proper ON DELETE actions
- Indexes on all columns used in WHERE, JOIN, and ORDER BY
- Connection pooling with proper min/max settings
- Query timeout limits to prevent long-running queries
## Documentation
- OpenAPI 3.1 spec for all endpoints
- Include request/response examples
- Document authentication requirements per endpoint
- List all possible error codes and their meaningsSystem rules for designing inter-service communication in microservices architectures with DeepSeek Coder, covering sync/async patterns, error handling, and resilience.
System rules for generating content in multiple languages with DeepSeek V3, covering translation quality, cultural adaptation, locale-specific formatting, and quality assurance.
System rules for safe code refactoring with DeepSeek R1, requiring test coverage verification, incremental changes, and behavior preservation checks.
System rules for using DeepSeek V3 to generate clear, maintainable technical documentation including API docs, architecture docs, and onboarding guides.
System rules for DeepSeek Coder to generate optimized database queries, with requirements for EXPLAIN analysis, indexing recommendations, and performance targets.
System rules for using DeepSeek V3 to generate infrastructure code, CI/CD pipelines, and operational runbooks with security and reliability best practices.