kraxy-buff/continue-dev-rules-generation-prompt-template icon
public
Published on 9/1/2025
Continue.dev Rules Generation Prompt Template

Rules

Continue.dev Rules Generation Prompt Template

🎯 Core Prompt Template

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)

[Project Name] Coding Rules

Code Style

  • [Rule 1]
  • [Rule 2]

Architecture

  • [Rule 3]
  • [Rule 4]

[Additional Categories...]


#### Option B: YAML Format (for config.yaml)
```yaml
rules:
  - [Rule 1]
  - [Rule 2]
  - [Rule 3]

Option C: Hub Block Format (for sharing on Continue Hub)

name: [owner-slug]/[rules-name]
version: 1.0.0
schema: v1

rules:
  - [Rule 1]
  - [Rule 2]
  - [Rule 3]

5. SPECIAL INSTRUCTIONS

  • Include 10-20 rules minimum, organized by category
  • Balance between being comprehensive and maintainable
  • Consider rules that fix common AI assistant annoyances
  • Include rules specific to the technology stack mentioned
  • Add meta-rules about how the AI should behave and respond

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

Example 2: Python Backend Development

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

Example 3: Go Microservices

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

🔧 Advanced Rule Templates

Multi-Environment Rules

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

Team Collaboration Rules

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

Performance-Critical Rules

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

🎨 Customization Guidelines

For Specific Frameworks

  • React: Focus on component lifecycle, hooks, and state management
  • Vue: Emphasize composition API, reactivity, and template syntax
  • Angular: Include RxJS patterns, dependency injection, and modules
  • Django: Cover ORM usage, middleware, and admin customization
  • FastAPI: Focus on async patterns, dependency injection, and OpenAPI
  • Spring Boot: Include annotations, dependency injection, and AOP

For Specific Industries

  • FinTech: Emphasize security, audit trails, and compliance
  • Healthcare: Focus on HIPAA compliance, data privacy, and validation
  • E-commerce: Include performance, scalability, and payment security
  • Gaming: Emphasize real-time performance and state synchronization

📝 Template Variables

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 benchmarks

🚀 Quick Start Examples

Minimal Rules Set

rules:
  - 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

Comprehensive Rules Set

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...]

📊 Rule Quality Checklist

Before finalizing your rules:

  • [ ] Each rule is clear and unambiguous
  • [ ] Rules don't contradict each other
  • [ ] Technology-specific rules are accurate
  • [ ] Rules address common pain points
  • [ ] AI behavior rules improve response quality
  • [ ] Rules are organized logically
  • [ ] Total rule count is manageable (15-30 rules)
  • [ ] Rules can be verified or enforced
  • [ ] Team has reviewed and approved rules
  • [ ] Rules align with project goals

🔄 Iteration Guidelines

  1. Start Small: Begin with 5-10 essential rules
  2. Test: Use rules for a week and note gaps
  3. Refine: Adjust rules based on AI responses
  4. Expand: Add rules for newly discovered needs
  5. Prune: Remove rules that don't add value
  6. Version: Track rule changes over time

📚 Best Practices

  1. Be Specific: "Use 4 spaces for indentation" vs "Indent properly"
  2. Be Consistent: Align rules with existing team standards
  3. Be Practical: Rules should be achievable and verifiable
  4. Be Concise: Each rule should be one clear instruction
  5. Be Comprehensive: Cover all major aspects of development
  6. Be Flexible: Allow for exceptions when documented
  7. Be Current: Update rules as technologies evolve

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.