This repository contains a set of Cursor AI rules specifically designed to enhance efficiency, enforce coding standards, and automate best practices for web developers, particularly those working with PHP, Drupal, JavaScript, and frontend frameworks.
These rules help Cursor AI assist developers by:
- Enforcing coding standards and best practices
- Ensuring tests and documentation remain up to date
- Detecting inefficiencies in AI query usage and improving response quality
- Providing automated suggestions for commit messages, dependencies, and performance optimizations
This repository is ideal for:
- PHP & Drupal developers following Drupal coding standards
- Web developers working with JavaScript, React, Vue, Tailwind, and other frontend technologies
- Software teams looking for a structured, automated workflow with Cursor AI
- Open-source contributors who want a standardized set of development rules
For a fully interactive installation with prompts:
# Step 1: Download the installer
curl -s https://raw.githubusercontent.com/ivangrynenko/cursor-rules/main/install.php -o install.php
# Step 2: Run the installer interactively
php install.php
This two-step process ensures you get the interactive experience with:
- Prompts to choose which rule sets to install (Core, Web Stack, Python, or All)
- Option to remove the installer file after installation (defaults to yes)
For a quick installation without prompts (installs core rules only):
curl -s https://raw.githubusercontent.com/ivangrynenko/cursor-rules/main/install.php | php
To install with specific options and bypass the interactive mode:
curl -s https://raw.githubusercontent.com/ivangrynenko/cursor-rules/main/install.php | php -- [options]
For example, to install all rules:
curl -s https://raw.githubusercontent.com/ivangrynenko/cursor-rules/main/install.php | php -- --all
The installer supports the following options:
--core
: Install core rules only--web-stack
: Install web stack rules (includes core rules)--python
: Install Python rules (includes core rules)--all
: Install all rules--yes
or-y
: Automatically answer yes to all prompts--destination=DIR
: Install to a custom directory (default: .cursor/rules)--debug
: Enable detailed debug output for troubleshooting installation issues--help
or-h
: Show help message
If you encounter issues during installation, try running the installer with the debug option:
php install.php --debug
This will provide detailed information about what the installer is doing, which can help identify the source of any problems.
Common issues:
- If only core rules are installed when selecting other options, make sure your internet connection is working properly as the installer needs to download additional rules from GitHub.
- If you're behind a corporate firewall or proxy, you may need to configure PHP to use your proxy settings.
Install core rules only:
curl -s https://raw.githubusercontent.com/ivangrynenko/cursor-rules/main/install.php | php -- --core
Install web stack rules (includes core rules):
curl -s https://raw.githubusercontent.com/ivangrynenko/cursor-rules/main/install.php | php -- --web-stack
Install all rules:
curl -s https://raw.githubusercontent.com/ivangrynenko/cursor-rules/main/install.php | php -- --all
Install to a custom directory:
curl -s https://raw.githubusercontent.com/ivangrynenko/cursor-rules/main/install.php | php -- --all --destination=my/custom/path
If you prefer to install manually:
-
Clone this repository:
git clone https://github.com/ivangrynenko/cursor-rules.git
-
Copy the rules to your project:
mkdir -p /path/to/your/project/.cursor/rules cp -r cursor-rules/.cursor/rules/* /path/to/your/project/.cursor/rules/
Each rule is written in .mdc
format and structured to enforce best practices in different aspects of development.
File Name | Purpose |
---|---|
cursor-rules.mdc |
Defines standards for creating and organizing Cursor rule files |
improve-cursorrules-efficiency.mdc |
Detects and optimizes inefficient AI queries |
git-commit-standards.mdc |
Enforces structured Git commit messages with proper prefixes and formatting |
readme-maintenance-standards.mdc |
Ensures README documentation is comprehensive and up-to-date |
github-actions-standards.mdc |
Ensures GitHub Actions workflows follow best practices |
testing-guidelines.mdc |
Ensures proper testing practices and separation between test and production code |
File Name | Purpose |
---|---|
accessibility-standards.mdc |
WCAG compliance and accessibility best practices |
api-standards.mdc |
RESTful API design and documentation standards |
build-optimization.mdc |
Webpack/Vite configuration and build process optimization |
javascript-performance.mdc |
Best practices for optimizing JavaScript performance |
javascript-standards.mdc |
Standards for JavaScript development in Drupal |
node-dependencies.mdc |
Node.js versioning and package management best practices |
react-patterns.mdc |
React component patterns and hooks usage guidelines |
tailwind-standards.mdc |
Tailwind CSS class organization and best practices |
vue-best-practices.mdc |
Vue 3 and NuxtJS specific standards and optimizations |
File Name | Purpose |
---|---|
php-drupal-best-practices.mdc |
PHP & Drupal Development Standards and Best Practices |
php-drupal-development-standards.mdc |
Standards for PHP and Drupal development |
drupal-database-standards.mdc |
Database schema changes, migrations, and query optimization |
drupal-file-permissions.mdc |
Drupal file permissions security standards |
govcms-saas.mdc |
Constraints and best practices for GovCMS Distribution projects |
File Name | Purpose |
---|---|
security-practices.mdc |
Security best practices for PHP, JavaScript, and Drupal |
drupal-broken-access-control.mdc |
Prevents broken access control vulnerabilities in Drupal |
drupal-cryptographic-failures.mdc |
Prevents cryptographic failures in Drupal applications |
drupal-injection.mdc |
Prevents injection vulnerabilities in Drupal |
drupal-insecure-design.mdc |
Prevents insecure design patterns in Drupal |
drupal-security-misconfiguration.mdc |
Prevents security misconfigurations in Drupal |
drupal-vulnerable-components.mdc |
Identifies and prevents vulnerable components in Drupal |
drupal-authentication-failures.mdc |
Prevents authentication failures in Drupal |
drupal-integrity-failures.mdc |
Prevents integrity failures in Drupal |
drupal-logging-failures.mdc |
Prevents logging failures in Drupal |
drupal-ssrf.mdc |
Prevents Server-Side Request Forgery in Drupal |
File Name | Purpose |
---|---|
docker-compose-standards.mdc |
Docker Compose standards |
lagoon-docker-compose-standards.mdc |
Standards for Lagoon Docker Compose configuration |
lagoon-yml-standards.mdc |
Standards for Lagoon configuration files and deployment workflows |
vortex-cicd-standards.mdc |
Standards for Vortex CI/CD and Renovate configuration |
vortex-scaffold-standards.mdc |
Standards for Vortex/DrevOps scaffold usage and best practices |
File Name | Purpose |
---|---|
code-generation-standards.mdc |
Standards for code generation and implementation |
debugging-standards.mdc |
Standards for debugging and error handling |
multi-agent-coordination.mdc |
Multi-agent coordination and workflow standards |
tests-documentation-maintenance.mdc |
Require tests for new functionality and enforce documentation updates |
third-party-integration.mdc |
Standards for integrating external services |
generic_bash_style.mdc |
Enforce general Bash scripting standards with enhanced logging |
project-definition-template.mdc |
Template for defining project context |
File Name | Purpose |
---|---|
python-broken-access-control.mdc |
Prevents broken access control vulnerabilities in Python |
python-cryptographic-failures.mdc |
Prevents cryptographic failures in Python applications |
python-injection.mdc |
Prevents injection vulnerabilities in Python |
python-insecure-design.mdc |
Prevents insecure design patterns in Python |
python-security-misconfiguration.mdc |
Prevents security misconfigurations in Python |
python-vulnerable-outdated-components.mdc |
Identifies and prevents vulnerable components in Python |
python-authentication-failures.mdc |
Prevents authentication failures in Python |
python-integrity-failures.mdc |
Prevents integrity failures in Python |
python-logging-monitoring-failures.mdc |
Prevents logging and monitoring failures in Python |
python-ssrf.mdc |
Prevents Server-Side Request Forgery in Python |
Once installed, Cursor AI will automatically use these rules when working with your codebase. The rules will:
- Provide Guidance: Offer suggestions and best practices when writing code
- Enforce Standards: Flag code that doesn't meet the defined standards
- Automate Repetitive Tasks: Generate boilerplate code, documentation, and tests
- Improve Security: Identify potential security vulnerabilities
- Optimize Performance: Suggest performance improvements
You can customize the rules by:
- Editing Rule Files: Modify the
.mdc
files to match your project's specific requirements - Adding New Rules: Create new
.mdc
files following the same format - Disabling Rules: Remove or rename rule files you don't want to use
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'feat: add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project follows the Conventional Commits specification. Commit messages should be structured as follows:
<type>: <description>
[optional body]
[optional footer(s)]
Types include:
fix
: for bug fixesfeat
: for new featuresperf
: for performance improvementsdocs
: for documentation updatesstyle
: for frontend changes (SCSS, Twig, etc.)refactor
: for code refactoringtest
: for adding or updating testschore
: for maintenance tasks
Example: feat: add support for Python security rules
This project is licensed under the MIT License - see the LICENSE file for details.
- Cursor AI for the amazing AI-powered code editor
- All contributors who have helped improve these rules
-
Consistency:
- Maintain consistent coding style across projects
- Reduce cognitive load when switching between tasks
- Ensure best practices are followed even when under time pressure
-
Efficiency:
- Automate repetitive coding tasks
- Reduce time spent on boilerplate code
- Get immediate feedback on code quality
-
Learning:
- Learn best practices through contextual suggestions
- Discover security vulnerabilities and how to fix them
- Improve coding habits through consistent reinforcement
-
Standardization:
- Enforce team-wide coding standards
- Reduce code review friction
- Maintain consistent documentation
-
Knowledge Sharing:
- Codify team knowledge in rules
- Reduce onboarding time for new team members
- Share best practices automatically
-
Quality Assurance:
- Catch common issues before they reach code review
- Ensure security best practices are followed
- Maintain high code quality across the team
-
Governance:
- Enforce organizational standards
- Ensure compliance with security requirements
- Maintain consistent code quality across teams
-
Efficiency:
- Reduce time spent on code reviews
- Decrease technical debt accumulation
- Streamline development processes
-
Knowledge Management:
- Preserve institutional knowledge in rules
- Simplified onboarding for new team members
-
Selective Rule Usage:
- Disable rules not relevant to your specific technology stack
- Configure rule priorities based on your project's needs
- Consider creating custom installation scripts that only install relevant rules
-
Performance Optimization:
- If experiencing slowdowns, review which rules are most frequently triggered
- Consider disabling computationally expensive rules for very large files
- Report performance issues so rule patterns can be optimized
-
Custom Rule Development:
- When creating custom rules, follow the patterns established in existing rules
- Use specific file filters to minimize unnecessary rule evaluation
- Test new rules thoroughly in isolation before adding to the collection
While maintaining all rules in a single repository currently provides the best developer experience, we're preparing for potential future growth:
-
Enhanced Categorization:
- Rules include clear language/framework tagging with a structured hierarchical system (As seen in the OWASP Top Ten Rules):
language:php
- Explicitly identifies the programming languageframework:drupal
- Specifies the framework or CMScategory:security
- Defines the primary functional categorysubcategory:injection
- Provides more granular categorization (e.g., injection, authentication)standard:owasp-top10
- Identifies the security standard being appliedrisk:a01-broken-access-control
- Specifies the exact risk identifier
- This tagging system enables selective installation based on language, framework, or security concern
- Installation scripts can target specific categories (e.g., only install PHP rules or only OWASP rules)
- Rules include clear language/framework tagging with a structured hierarchical system (As seen in the OWASP Top Ten Rules):
-
Modular Design:
- Rule file structure supports potential future separation
- Consistent naming conventions facilitate organization
-
Monitoring and Feedback:
- Repository growth and performance impacts are monitored
- User feedback helps identify optimization opportunities
If you encounter any issues with rule management or have suggestions for improving organization, please submit an issue or pull request.