cursorrules
CLAUDE.md88 starsChanged 13 months agoMITView on GitHub
This is a repository for managing and distributing Cursor AI rules, particularly focused on web development with strong emphasis on PHP/Drupal, frontend frameworks, and security best practices. The project provides an interactive PHP installer that allows developers to selectively install rule sets into their projects.
In this repository70 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/accessibility-standards.mdcCursor rule
- .cursor/rules/api-standards.mdcCursor rule
- .cursor/rules/behat-ai-guide.mdcCursor rule
- .cursor/rules/behat-steps.mdcCursor rule
- .cursor/rules/build-optimization.mdcCursor rule
- .cursor/rules/code-generation-standards.mdcCursor rule
- .cursor/rules/confluence-editing-standards.mdcCursor rule
- .cursor/rules/cursor-rules.mdcCursor rule
- .cursor/rules/debugging-standards.mdcCursor rule
- .cursor/rules/docker-compose-standards.mdcCursor rule
- .cursor/rules/drupal-authentication-failures.mdcCursor rule
- .cursor/rules/drupal-broken-access-control.mdcCursor rule
- .cursor/rules/drupal-cryptographic-failures.mdcCursor rule
- .cursor/rules/drupal-database-standards.mdcCursor rule
- .cursor/rules/drupal-file-permissions.mdcCursor rule
- .cursor/rules/drupal-injection.mdcCursor rule
- .cursor/rules/drupal-insecure-design.mdcCursor rule
- .cursor/rules/drupal-integrity-failures.mdcCursor rule
- .cursor/rules/drupal-logging-failures.mdcCursor rule
- .cursor/rules/drupal-security-misconfiguration.mdcCursor rule
- .cursor/rules/drupal-ssrf.mdcCursor rule
- .cursor/rules/drupal-vulnerable-components.mdcCursor rule
- .cursor/rules/generic_bash_style.mdcCursor rule
- .cursor/rules/git-commit-standards.mdcCursor rule
- .cursor/rules/github-actions-standards.mdcCursor rule
- .cursor/rules/improve-cursorrules-efficiency.mdcCursor rule
- .cursor/rules/javascript-broken-access-control.mdcCursor rule
- .cursor/rules/javascript-cryptographic-failures.mdcCursor rule
- .cursor/rules/javascript-identification-authentication-failures.mdcCursor rule
- .cursor/rules/javascript-injection.mdcCursor rule
- .cursor/rules/javascript-insecure-design.mdcCursor rule
- .cursor/rules/javascript-performance.mdcCursor rule
- .cursor/rules/javascript-security-logging-monitoring-failures.mdcCursor rule
- .cursor/rules/javascript-security-misconfiguration.mdcCursor rule
- .cursor/rules/javascript-server-side-request-forgery.mdcCursor rule
- .cursor/rules/javascript-software-data-integrity-failures.mdcCursor rule
- .cursor/rules/javascript-standards.mdcCursor rule
- .cursor/rules/javascript-vulnerable-outdated-components.mdcCursor rule
- .cursor/rules/lagoon-docker-compose-standards.mdcCursor rule
- .cursor/rules/lagoon-yml-standards.mdcCursor rule
- .cursor/rules/multi-agent-coordination.mdcCursor rule
- .cursor/rules/new-pull-request.mdcCursor rule
- .cursor/rules/node-dependencies.mdcCursor rule
- .cursor/rules/php-drupal-best-practices.mdcCursor rule
- .cursor/rules/php-drupal-development-standards.mdcCursor rule
- .cursor/rules/php-memory-optimisation.mdcCursor rule
- .cursor/rules/project-definition-template.mdcCursor rule
- .cursor/rules/pull-request-changelist-instructions.mdcCursor rule
- .cursor/rules/python-authentication-failures.mdcCursor rule
- .cursor/rules/python-broken-access-control.mdcCursor rule
- .cursor/rules/python-cryptographic-failures.mdcCursor rule
- .cursor/rules/python-injection.mdcCursor rule
- .cursor/rules/python-insecure-design.mdcCursor rule
- .cursor/rules/python-integrity-failures.mdcCursor rule
- .cursor/rules/python-logging-monitoring-failures.mdcCursor rule
- .cursor/rules/python-security-misconfiguration.mdcCursor rule
- .cursor/rules/python-ssrf.mdcCursor rule
- .cursor/rules/python-vulnerable-outdated-components.mdcCursor rule
- .cursor/rules/react-patterns.mdcCursor rule
- The first 60 shown.
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
22 rules. About 0 are common, 18 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈18
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 49
No specific linting commands configured - consider adding phpcs/phpmd
- Very specific: line 91
Update CURSOR_RULES_VERSION constant in install.php
- Distinctive: line 92
Update version history in repository documentation
- Distinctive: line 93
Create GitHub release matching the version number
- Distinctive: line 109
When piping the installer through curl, several PHP-specific behaviors can cause problems:
- Distinctive: line 118
Entry Point Detection: Check for both normal execution and "Standard input code"
- Distinctive: line 124
STDIN Cleanup: Always close STDIN before exit to prevent hanging
- Distinctive: line 139
Issue: Test suite only covered direct PHP execution, not curl piping scenarios
- Distinctive: line 140
Recommendation: Add tests for:
- Distinctive: line 149
Follow MDC format (Markdown with custom rule syntax)
- Very specific: line 150
Place in appropriate category under .cursor/rules/
- Distinctive: line 151
Update the rule arrays in install.php (core_rules, web_stack_rules, python_rules)
- Distinctive: line 152
Add rule to README.md documentation table
- Distinctive: line 153
Consider rule dependencies (e.g., web stack includes core rules)
- Very specific: line 158
Update CURSOR_RULES_VERSION constant when making changes
- Distinctive: line 159
Ensure all tests pass before committing
- Distinctive: line 160
Test with both local files and GitHub downloads
- Very specific: line 163
All tests are bash scripts in .tests/ directory
- Distinctive: line 169
Never commit sensitive information or API keys
- Distinctive: line 175
Follow conventional commits format (fix:, feat:, docs:, etc.)
- Distinctive: line 176
Update relevant documentation when adding features
- Distinctive: line 177
Ensure all tests pass before submitting PR
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a repository for managing and distributing Cursor AI rules, particularly focused on web development with strong emphasis on PHP/Drupal, frontend frameworks, and security best practices. The project provides an interactive PHP installer that allows developers to selectively install rule sets into their projects.
Common Development Tasks
Running Tests
# Run all tests
cd .tests && ./run-all-tests.sh
# Run individual test scripts
cd .tests
./test-copy.sh # Test basic installation functionality
./test-debug.sh # Test debug mode
./test-invalid-option.sh # Test invalid option handling
./test-conflicting-options.sh # Test conflicting options
./test-missing-files.sh # Test missing file handlingTesting the Installer
# Test installation interactively
php install.php
# Test with specific options
php install.php --core # Install core rules only
php install.php --web-stack # Install web stack rules (includes core)
php install.php --python # Install Python rules (includes core)
php install.php --all # Install all rules
# Test with debug mode
php install.php --debug --core
# Test installation to custom directory
php install.php --all --destination=my/custom/path
# Test installation via curl (non-interactive)
curl -s https://raw.githubusercontent.com/ivangrynenko/cursor-rules/main/install.php | php -- --ws
cat install.php | php -- --core # Test piped input locallyLinting and Code Quality
- PHP syntax validation:
php -l install.php - No specific linting commands configured - consider adding phpcs/phpmd
Architecture and Code Structure
Project Organization
- install.php: Main installer script (current version defined by CURSOR_RULES_VERSION constant)
- .cursor/rules/: Contains 56 MDC rule files organized by category
- .cursor/UPDATE.md: Installation receipt file tracking installed version and configuration (created by installer)
- .tests/: Bash test scripts for installer validation
- .github/workflows/: CI/CD pipeline using GitHub Actions for PHP 8.3
- AGENTS.md: Comprehensive guide for using Cursor Rules (created by installer)
Rule Categories
- Core Rules (7 files): Git standards, testing guidelines, README maintenance
- Web Development Rules:
- Frontend: JavaScript, React, Vue, Tailwind, accessibility
- Backend: PHP/Drupal standards, database
- Security: OWASP Top 10 implementations for Drupal
- DevOps: Docker, Lagoon, Vortex configurations
- Python Rules (10 files): Security-focused rules following OWASP standards
Key Design Patterns
- Installer Architecture:
- Stateless design - each execution is independent
- Builder pattern for rule set construction
- Strategy pattern for interactive vs non-interactive modes
- Factory pattern for rule set management
Installation Flow
- User executes install.php (directly or via curl)
- Script detects if running interactively or with parameters
- Creates .cursor/rules directory structure
- Downloads and installs selected rule files from GitHub
- Creates/overwrites .cursor/UPDATE.md file as an installation receipt
- Creates/updates AGENTS.md documentation (unless --yes flag overwrites)
Versioning System
Version Management
- Version Constant: Defined in install.php as
CURSOR_RULES_VERSION - Version History: Tracked in GitHub releases and repository documentation
- Release Process:
- Update CURSOR_RULES_VERSION constant in install.php
- Update version history in repository documentation
- Create GitHub release matching the version number
- Tag the release in git
.cursor/UPDATE.md File Purpose
The UPDATE.md file serves as an installation receipt that:
- Records the version of cursor-rules that was installed
- Documents the installation date and time
- Lists the number of rule files installed
- Shows the installation type (core, web-stack, Python, etc.)
- Records any tag filters that were applied
- Gets created/overwritten by the installer on each run
- Helps users identify which version and configuration they have installed
Known Issues and Solutions
Curl Piping Issues (Fixed in v1.0.6)
When piping the installer through curl, several PHP-specific behaviors can cause problems:
Problem: Script hangs when using curl ... | php commands
Root Causes:
$_SERVER['PHP_SELF']becomes "Standard input code" instead of script name when piped- PHP continues waiting for STDIN input even after script completion
- Arguments may not parse correctly when using
--separator with piped input
Solutions Implemented:
- Entry Point Detection: Check for both normal execution and "Standard input code"
if (basename(__FILE__) === basename($_SERVER['PHP_SELF'] ?? '') || ($_SERVER['PHP_SELF'] ?? '') === 'Standard input code') - STDIN Cleanup: Always close STDIN before exit to prevent hanging
if (defined('STDIN') && is_resource(STDIN)) { fclose(STDIN); } - Argument Parsing: Handle both with and without
--separatorif (!stream_isatty(STDIN) && $_SERVER['PHP_SELF'] === 'Standard input code') { // Parse arguments from argv when piped }
Testing Coverage Gaps
Issue: Test suite only covered direct PHP execution, not curl piping scenarios Recommendation: Add tests for:
curl ... | phpexecution pathscat install.php | phpscenarios- Argument parsing with and without
--separator - STDIN handling in different contexts
Important Considerations
When Adding New Rules
- Follow MDC format (Markdown with custom rule syntax)
- Place in appropriate category under .cursor/rules/
- Update the rule arrays in install.php (core_rules, web_stack_rules, python_rules)
- Add rule to README.md documentation table
- Consider rule dependencies (e.g., web stack includes core rules)
When Modifying the Installer
- Maintain PHP 8.3+ compatibility
- Preserve both interactive and non-interactive modes
- Update CURSOR_RULES_VERSION constant when making changes
- Ensure all tests pass before committing
- Test with both local files and GitHub downloads
Testing Guidelines
- All tests are bash scripts in .tests/ directory
- Tests use temporary directories to avoid affecting the actual installation
- Each test should output clear success/failure messages
- GitHub Actions runs all tests on push/PR to main branch
Security Considerations
- Never commit sensitive information or API keys
- Rule files should not contain hardcoded credentials
- Installer validates file permissions and directory creation
- Downloaded files are fetched over HTTPS from GitHub
Contributing
- Follow conventional commits format (fix:, feat:, docs:, etc.)
- Update relevant documentation when adding features
- Ensure all tests pass before submitting PR
- New rules should include clear descriptions and examples
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

