You are an expert in creating Continue.dev rules that serve as guardrails for AI coding assistants. Your task is to generate comprehensive, well-structured rules that transform a generic AI assistant into a knowledgeable team member who understands specific project requirements and constraints.
## Context Information
**Project Type**: [e.g., React Frontend, Go Backend, Python Data Science, etc.]
**Team Size**: [e.g., Solo developer, Small team, Large enterprise]
**Technology Stack**: [List main technologies, frameworks, languages]
**Development Environment**: [e.g., VS Code, JetBrains, etc.]
**Key Requirements**: [List 3-5 main requirements or pain points]
## Rule Generation Requirements
Generate rules following these specifications:
### 1. RULE STRUCTURE
Create rules as either:
- **Plain text format**: Simple bullet points with clear directives
- **YAML format**: Structured rules array for config.yaml
### 2. RULE CATEGORIES TO INCLUDE
Generate rules covering these areas:
- **Coding Standards**: Language-specific conventions and patterns
- **Code Structure**: File organization, component architecture, naming conventions
- **Documentation**: Comments, docstrings, inline documentation requirements
- **Error Handling**: Exception management, logging, debugging practices
- **Performance**: Optimization patterns, efficiency guidelines
- **Security**: Security best practices, vulnerability prevention
- **Testing**: Test structure, coverage requirements, testing patterns
- **Dependencies**: Package management, import conventions
- **AI Behavior**: How the assistant should respond and format answers
### 3. RULE CHARACTERISTICS
Each rule should be:
- **Imperative**: Use command form (e.g., "Use", "Always", "Never", "Prefer")
- **Specific**: Clear and unambiguous instructions
- **Measurable**: Can be verified or checked
- **Contextual**: Relevant to the specified technology stack
- **Actionable**: The AI can directly apply the rule
### 4. OUTPUT FORMAT
#### Option A: Plain Text Rules (.continuerules file format)
#### Option B: YAML Format (for config.yaml)
```yaml
rules:
- [Rule 1]
- [Rule 2]
- [Rule 3]
name: [owner-slug]/[rules-name]
version: 1.0.0
schema: v1
rules:
- [Rule 1]
- [Rule 2]
- [Rule 3]
Please generate the rules now based on the context provided above.
## 📋 Rule Generation Examples by Domain
### Example 1: React Frontend Development
```yaml
rules:
# Component Architecture
- Use functional components with hooks instead of class components
- Define TypeScript interfaces for all component props
- Keep components under 200 lines; split into smaller components if larger
- Place component files in folders with the component name, including index.tsx and styles
# State Management
- Use hooks for local state management
- Implement context API for cross-component state sharing
- Avoid prop drilling beyond 2 levels
# Styling
- Use Tailwind CSS classes for styling instead of inline styles or CSS modules
- Follow mobile-first responsive design approach
- Maintain consistent spacing using Tailwind's spacing scale
# Code Organization
- Use lowercase with dashes for directory names (e.g., auth-wizard)
- Export components using named exports, not default exports
- Group related components in feature folders
# TypeScript
- Always define return types for functions
- Use strict TypeScript settings
- Prefer interfaces over types for object shapes
# Performance
- Memoize expensive computations with useMemo
- Use React.lazy for route-level code splitting
- Implement virtual scrolling for lists over 100 items
# Testing
- Write unit tests for utility functions
- Include integration tests for critical user flows
- Use data-testid attributes for test selectors
# Documentation
- Include JSDoc comments for complex components
- Document prop types with descriptions
- Add README files in feature folders
# AI Assistant Behavior
- Provide code examples with TypeScript types included
- Always show import statements in code snippets
- Format responses with clear section headers
- Explain the "why" behind architectural decisions
rules:
# Type Safety
- Always use type hints for function parameters and return values
- Use typing module for complex type annotations
- Enable mypy for static type checking
# Code Structure
- Follow PEP 8 style guidelines strictly
- Use snake_case for variables and functions
- Use UPPER_CASE for constants
- Limit functions to 50 lines maximum
# Error Handling
- Never use bare except clauses
- Log exceptions with full traceback
- Implement custom exception classes for domain-specific errors
- Use context managers for resource handling
# Documentation
- Write Google-style docstrings for all public functions and classes
- Include usage examples in docstrings for complex functions
- Document type information in docstrings even with type hints
# Testing
- Maintain minimum 80% code coverage
- Use pytest for all tests
- Implement fixtures for common test data
- Write property-based tests for critical algorithms
# Performance
- Use generators for large data processing
- Implement caching with functools.lru_cache where appropriate
- Profile code before optimizing
- Prefer built-in functions over custom implementations
# Security
- Never hardcode credentials or secrets
- Validate all user inputs
- Use parameterized queries for database operations
- Implement rate limiting for API endpoints
# Dependencies
- Pin exact versions in requirements.txt
- Use virtual environments for all projects
- Document why each dependency is needed
- Regularly update dependencies for security patches
# Database
- Use SQLAlchemy ORM for database operations
- Implement database migrations with Alembic
- Never use raw SQL unless absolutely necessary
- Add indexes for frequently queried columns
# AI Assistant Behavior
- Always include error handling in code examples
- Show both the happy path and error cases
- Provide performance considerations for solutions
- Suggest alternative approaches when relevant
rules:
# Project Structure
- Follow standard Go project layout
- Keep main.go minimal, delegate to packages
- Use cmd/ directory for application entry points
- Place shared code in pkg/ directory
# Error Handling
- Return errors instead of using panic
- Wrap errors with context using fmt.Errorf
- Check all errors explicitly
- Use custom error types for domain logic
# Concurrency
- Use channels for communication between goroutines
- Implement context for cancellation and timeouts
- Avoid goroutine leaks with proper cleanup
- Use sync package primitives correctly
# Code Style
- Run gofmt on all code
- Use golint and go vet in CI pipeline
- Keep functions under 40 lines
- Prefer composition over inheritance
# Testing
- Write table-driven tests with subtests
- Maintain minimum 70% test coverage
- Use testify for assertions
- Implement integration tests for API endpoints
# Performance
- Use pointers for large structs
- Implement connection pooling for databases
- Profile CPU and memory usage regularly
- Pre-allocate slices when size is known
# API Design
- Follow RESTful conventions
- Version APIs using URL path (e.g., /v1/)
- Return consistent error responses
- Implement OpenAPI documentation
# Observability
- Add structured logging with zerolog or zap
- Implement distributed tracing
- Export Prometheus metrics
- Include correlation IDs in logs
# Security
- Validate all inputs
- Use prepared statements for SQL
- Implement rate limiting
- Enable TLS for all external communication
# AI Assistant Behavior
- Always show the complete import block
- Include error handling in every example
- Demonstrate idiomatic Go patterns
- Explain goroutine safety when relevant
rules:
# Development Environment
- In development, use verbose logging and detailed error messages
- Enable hot reloading for faster development cycles
# Production Environment
- In production, use structured JSON logging
- Never expose internal error details to clients
- Implement graceful shutdown for all services
# Testing Environment
- Use in-memory databases for unit tests
- Mock external services in integration tests
rules:
# Code Review
- Include PR description template compliance
- Require approval from code owners
- Address all review comments before merging
# Documentation
- Update README when adding new features
- Document breaking changes in CHANGELOG
- Include ADRs for architectural decisions
# Communication
- Use clear, descriptive commit messages
- Reference issue numbers in commits
- Update team wiki for complex implementations
rules:
# Optimization
- Profile before optimizing
- Document performance benchmarks
- Use caching strategically
- Implement pagination for large datasets
# Resource Management
- Set connection pool limits
- Implement circuit breakers for external calls
- Use batch processing for bulk operations
- Monitor memory usage and garbage collection
When using this template, replace these variables:
[Project Name]
: Your project or team name[Technology Stack]
: Primary languages and frameworks[Team Standards]
: Specific team conventions[Industry Requirements]
: Compliance or industry-specific needs[Performance Targets]
: Specific metrics or benchmarksrules:
- Use TypeScript for all new code
- Write tests for all public functions
- Follow existing code patterns in the project
- Handle all errors explicitly
- Document complex logic with comments
name: myteam/engineering-standards
version: 1.0.0
schema: v1
rules:
# Core Principles
- Prioritize code readability over cleverness
- Write code for the next developer (including future you)
- Optimize for maintainability unless performance is critical
# [Additional categories with 15-25 more rules...]
Before finalizing your rules:
This template is designed to generate high-quality Continue.dev rules that transform AI assistants into effective team members who understand and follow your specific development standards.