What I offer
Blog Topics
Contact
Strong Rules = Smart AI Coding
Make your IDE AI Coding Assistant more reliable and smarter through Global and Workspace Rules
Why Coding Rules Matter
AI follows structure, not intuition
No natural understanding of context
Ruleless = chaos
Spaghetti code, random decisions, hidden bugs
Standards bring predictability
Maintainable, scalable software development
How AI Follows These Rules
Generate structured components
Right architecture, right place
Use consistent logic patterns
Predictable approach to problems
Track changes in task.md
Document progress automatically
Suggest improvements
But never guess when uncertain
Comprehensive IDE Rules for AI Code Generation
1. Universal Project Structure
Create a clear hierarchical file structure
Group related files in appropriately named directories
Keep a consistent naming convention across the project
Separate concerns (UI, logic, data, utilities, etc.)
Create a task.md file at the project root to track progress and documentation
Update task.md after each milestone, progress, or new feature request
Keep all files under 500 lines of code, refactor when necessary
Include a README.md with project overview and setup instructions
Adapt structure appropriately for project type:
Browser extensions (manifest, background scripts, content scripts, etc.)
Web applications (frontend components, services, etc.)
Mobile applications (screens, native modules, etc.)
2. Universal Coding Standards
Use consistent and meaningful naming conventions
Implement proper code formatting and indentation
Limit line length to enhance readability (100-120 characters)
Prefer immutability (const over let/var when possible)
Follow SOLID principles for maintainable code
Keep functions small and focused on a single responsibility
Use appropriate comments to explain complex logic
Avoid deep nesting of loops and conditionals
Refactor any file that exceeds 500 lines of code
Use defensive programming techniques
Implement error handling appropriately
Follow language-specific best practices
3. Library and Dependency Management
Choose mature and well-maintained libraries
Document reasons for selecting specific libraries
Keep dependencies up to date
Be consistent with library choices across the project
Minimize dependency bloat
Consider bundle size impact when adding new dependencies
Use peer dependencies appropriately
Lock dependency versions for reproducible builds
Include only what you need from large libraries
Document any required installation steps
4. Documentation Requirements
Maintain a task.md file at project root for tracking progress
Update task.md after each:
Completed feature
Bug fix
Code refactoring
New planning decisions
Feature requests
Project milestones
Include date and brief description for each entry
Document technical decisions and their rationales
Keep a change log for significant updates
Document APIs and interfaces
Include setup and installation instructions
Add comprehensive README.md files
Document configuration options
Provide usage example
5. Code Organization and Refactoring
Keep files under 500 lines of code, refactor when necessary
Break large functions into smaller, focused functions
Organize code logically with related functionality grouped together
Extract reusable code into separate modules
Use appropriate design patterns for the problem domain
Separate concerns (UI, business logic, data access, etc.)
Create modular code that's easy to test
Avoid tight coupling between components
Manage complexity through abstraction when appropriate
Periodically review and refactor code for maintainability
Document complex refactorings in task.md
5.1 Single Responsibility and Delegation
Ensure each component, module, or function is responsible for only one piece of functionality
Delegate responsibilities by splitting concerns into specialized components, hooks, or services
For React and similar frameworks:
Move logic-heavy code into custom hooks
Keep UI components focused on rendering and user interaction
Use container-presentational component patterns where beneficial
For backend:
Separate data access, business logic, and route handling into distinct layers or files
Reuse logic across features through well-structured utilities or hooks
Review main components regularly to offload responsibilities to maintainable substructures
Document responsibility boundaries clearly in code comments and task.md when performing refactors
Ensure testability and readability by limiting each file, class, or function to a single responsibility
Use SRP not only for code clarity but also to facilitate future scalability and collaboration
6. Performance Guidelines
Optimize critical paths and frequently used functions
Use appropriate data structures for operations
Implement caching strategies where appropriate
Minimize DOM operations in web applications
Optimize resource loading and initialization
Implement lazy loading for resources and code
Avoid memory leaks by properly managing resources
Monitor and address performance bottlenecks
Consider time and space complexity of algorithms
Use performance profiling tools to identify issues
Document performance improvements in task.md
7. Testing Requirements
Write unit tests for core functionality
Implement integration tests for critical workflows
Create end-to-end tests for main user journeys
Test edge cases and error conditions
Aim for appropriate test coverage based on project risks
Implement automated testing in continuous integration
Create mock/stub services for external dependencies
Write testable code with dependency injection where appropriate
Include accessibility testing for user interfaces
Test for security vulnerabilities
Document testing approach and tools
8. Documentation Guidelines
Use clear and consistent commenting styles
Document public interfaces and APIs
Include usage examples where helpful
Maintain up-to-date documentation
Document complex algorithms and business logic
Create diagrams for complex architectures
Include troubleshooting information
Document known limitations
Keep documentation close to code when possible
Update documentation when code changes
Use standardized documentation formats
9. Error Handling
Implement consistent error handling patterns
Use appropriate error types for different scenarios
Provide meaningful error messages
Log errors with context for debugging
Handle expected failure scenarios gracefully
Implement fallback mechanisms where appropriate
Consider retry strategies for transient failures
Validate inputs to prevent errors
Avoid swallowing exceptions without handling
Report critical errors appropriately
Implement global error handling where needed
10. Accessibility Guidelines
Follow web content accessibility guidelines (WCAG)
Use semantic markup and structure
Implement proper focus management
Provide alternative text for images
Ensure sufficient color contrast
Support keyboard navigation
Make interactive elements accessible
Test with assistive technologies
Consider user preferences (reduced motion, color schemes, etc.)
Implement proper form labeling and validation
Document accessibility features
11. State Management
Choose appropriate state management approach for project complexity
Keep state minimal and normalized
Define clear state update patterns
Avoid redundant state
Implement proper state initialization
Consider performance implications of state changes
Separate UI state from application data
Use immutable state patterns where appropriate
Implement state persistence where needed
Document state structure and update flows
12. Code Quality Checks
Implement linting for static code analysis
Use code formatters for consistent style
Set up pre-commit hooks for quality checks
Implement continuous integration for automated validation
Use type checking where available
Track and address technical debt
Conduct regular code reviews
Refactor problematic code proactively
Measure and monitor code quality metrics
Document quality standards and processes
13. Security Practices
Follow security best practices for the platform
Validate all inputs and sanitize data
Implement proper authentication and authorization
Use secure communication protocols
Follow principle of least privilege
Handle sensitive data appropriately
Implement security headers and protection mechanisms
Keep dependencies updated for security patches
Conduct security testing and reviews
Document security considerations
Follow secure coding guidelines
14. API Integration
Use consistent patterns for API requests
Implement proper error handling for API failures
Document API dependencies and requirements
Version API endpoints appropriately
Handle authentication securely
Implement request retries and timeouts
Cache API responses where appropriate
Use appropriate data serialization methods
Mock APIs for testing and development
Monitor API usage and performance
15. Internationalization
Externalize all user-facing strings
Support right-to-left languages where needed
Format dates, numbers, and currencies based on locale
Implement language switching functionality
Provide fallback translations
Consider cultural differences in UI design
Test application with different locales
16. Task Tracking and Progress Management
Create task.md file in the project root directory
Structure task.md with clear sections:
Completed Features
In Progress
Planned Features
Known Issues
Refactoring Needs
For each task entry include:
Date (YYYY-MM-DD)
Brief description
Status
Associated files or components
Update task.md after each significant change
Use task.md as a living document during development
Include discussions about architectural decisions
Document all feature requests and their status
Track performance improvements
Note technical debt items for future refactoring
Reference task entries in commit messages when possible
17. Project-Specific Guidelines
Browser Extension Development:
Follow Chrome/Firefox extension manifest standards
Separate background, content, and popup scripts
Minimize permissions to only what's necessary
Handle cross-origin restrictions appropriately
Consider browser compatibility for target browsers
Use event-driven architecture where appropriate
Implement proper message passing between components
Keep extension footprint small for performance
Web Application Development:
Implement responsive design for various screen sizes
Optimize for web performance metrics (Core Web Vitals)
Consider progressive enhancement strategies
Implement proper client-side routing
Use appropriate state management for complexity level
Consider SEO implications
Implement proper caching strategies
Support main browsers and versions per requirements
15. Internationalization
Externalize all user-facing strings
Support right-to-left languages where needed
Format dates, numbers, and currencies based on locale
Implement language switching functionality
Provide fallback translations
Consider cultural differences in UI design
Test application with different locales
17. Project-Specific Guidelines
Browser Extension Development:
Follow Chrome/Firefox extension manifest standards
Separate background, content, and popup scripts
Minimize permissions to only what's necessary
Handle cross-origin restrictions appropriately
Consider browser compatibility for target browsers
Use event-driven architecture where appropriate
Implement proper message passing between components
Keep extension footprint small for performance
Web Application Development:
Implement responsive design for various screen sizes
Optimize for web performance metrics (Core Web Vitals)
Consider progressive enhancement strategies
Implement proper client-side routing
Use appropriate state management for complexity level
Consider SEO implications
Implement proper caching strategies
Support main browsers and versions per requirements
Mobile Application Development:
Follow platform-specific design guidelines (iOS/Android)
Consider native vs. cross-platform approach trade-offs
Implement responsive layouts for different device sizes
Handle offline capabilities appropriately
Consider battery and resource usage optimization
Implement proper permissions handling
Design for different input methods (touch, keyboard, etc.)
Accommodate platform-specific navigation patterns
18. AI Assistant Code Modification Guidelines
AI code modification guidelines:
Do not modify any existing code unless explicitly requested by the user
Never make assumptions about code changes that should be implemented
Only implement the specific features or changes requested by the user
Do not hallucinate or invent code that doesn't exist in the codebase
When suggesting improvements, clearly mark them as suggestions only
Do not refactor code without explicit permission
Always confirm understanding of requested changes before implementation
When unsure about requirements, ask for clarification rather than guessing
Provide explanations for implemented changes when relevant
Document all changes made in the task.md file
When working with partial code snippets, do not assume the structure of unseen code
Request additional context if needed to safely implement requested changes