RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/ivangrynenko/cursorrules

Cursor rule

.cursor/rules/php-drupal-development-standards.mdc

Standards for PHP and Drupal development

Cursor rules

Quality

34/100

Scores the file, not the repository.

Length

427 words

1 headings · 0 code blocks

Repository

86

— · pushed 280 days ago

Last changed

3 days ago

First indexed 3 days ago.
ivangrynenko/cursorrules/.cursor/rules/php-drupal-development-standards.mdcRawGitHub
1---
2description: Standards for PHP and Drupal development
3globs: *.php, *.module, *.inc, *.install, *.theme
4---
5# Enhanced PHP and Drupal Development Standards
6 
7Ensures adherence to PHP 8.3+ features and Drupal development best practices for improved code quality, security, and maintainability.
8 
9<rule>
10name: enhanced_php_drupal_development_standards
11description: Enforce PHP 8.3+ and Drupal development standards
12filters:
13 - type: file_extension
14 pattern: "\\.(php|module|inc|install|theme)$"
15 - type: file_path
16 pattern: "web/modules/custom/|web/themes/custom/"
17 
18actions:
19 - type: enforce
20 conditions:
21 - pattern: "^(?!declare\\(strict_types=1\\);)"
22 message: "Add 'declare(strict_types=1);' at the beginning of PHP files for type safety."
23 
24 - pattern: "class\\s+\\w+\\s*(?!\\{[^}]*readonly\\s+\\$)"
25 message: "Consider using readonly properties where immutability is required for better code safety."
26 
27 - pattern: "public\\s+function\\s+\\w+\\([^)]*\\)\\s*(?!:)"
28 message: "Add return type declarations for all methods to enhance type safety."
29 
30 - pattern: "extends\\s+\\w+\\s*\\{[^}]*public\\s+function\\s+\\w+\\([^)]*\\)\\s*(?!#\\[Override\\])"
31 message: "Add #[Override] attribute for overridden methods for clear intent."
32 
33 - pattern: "\\$\\w+\\s*(?!:)"
34 message: "Use typed properties with proper nullability to improve code readability and prevent errors."
35 
36 - pattern: "function\\s+hook_\\w+\\([^)]*\\)\\s*(?!:)"
37 message: "Add type hints and return types for all hooks to leverage PHP's type system."
38 
39 - pattern: "new\\s+\\w+\\([^)]*\\)\\s*(?!;\\s*//\\s*@inject)"
40 message: "Use proper dependency injection with services for better testability and modularity."
41 
42 - pattern: "extends\\s+FormBase\\s*\\{[^}]*validate"
43 message: "Implement proper form validation in FormBase classes for security."
44 
45 - pattern: "(?<!\\bTRUE\\b)\\btrue\\b|(?<!\\bFALSE\\b)\\bfalse\\b|(?<!\\bNULL\\b)\\bnull\\b"
46 message: "Use uppercase for TRUE, FALSE, and NULL constants for consistency."
47 
48 - pattern: "(?i)\\/\\/\\s[a-z]"
49 message: "Ensure inline comments begin with a capital letter and end with a period for readability."
50 
51 - pattern: "\\$this->config\\('\\w+'\\)"
52 message: "Use ConfigFactory for configuration management to ensure proper dependency injection."
53 
54 - type: suggest
55 message: |
56 **PHP/Drupal Development Best Practices:**
57 - **File Structure:** Place module files in `web/modules/custom/[module_name]/` for organization.
58 - **Module Files:** Ensure modules include .info.yml, .module, .libraries.yml, .services.yml where applicable.
59 - **Dependencies:** Use hook_requirements() to manage external dependencies.
60 - **Forms:** Use FormBase or ConfigFormBase for creating forms, always include CSRF protection.
61 - **Caching:** Apply proper cache tags and contexts for performance optimization.
62 - **Error Handling & Logging:** Implement robust error handling and logging using Drupal's mechanisms.
63 - **Type Safety:** Leverage type safety in form methods and throughout your code.
64 - **Dependency Injection:** Follow Drupal's dependency injection patterns for better maintainability.
65 - **Service Container:** Use Drupal's service container to manage dependencies.
66 - **Security:** Validate all user inputs, use Drupal's security practices like sanitization and escaping.
67 - **Schema Updates:** Implement hook_update_N() for database schema changes.
68 - **Translation:** Use Drupal's t() function for all user-facing strings.
69 
70 - type: validate
71 conditions:
72 - pattern: "web/modules/custom/[^/]+/\\.info\\.yml$"
73 message: "Ensure each custom module has a required .info.yml file."
74 
75 - pattern: "web/modules/custom/[^/]+/\\.module$"
76 message: "Ensure module has .module file if hooks are implemented."
77 
78 - pattern: "web/modules/custom/[^/]+/src/Form/\\w+Form\\.php$"
79 message: "Place form classes in the Form directory for consistency."
80 
81 - pattern: "try\\s*\\{[^}]*\\}\\s*catch\\s*\\([^)]*\\)\\s*\\{\\s*\\}"
82 message: "Implement proper exception handling in catch blocks for robustness."
83 
84metadata:
85 priority: critical
86 version: 1.1
87</rule>

Sections

  • Enhanced PHP and Drupal Development Standards

Stack — with the evidence

shell

(0.80)

github-actions

(0.60)

Glob targeting

  • *.php
  • *.module
  • *.inc
  • *.install
  • *.theme

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
ivangrynenko
Language
—
License
—
Archived
no

All configs in this repo

Also in ivangrynenko/cursorrules

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
ivangrynenko/cursorrules.cursor/rules/accessibility-standards.mdc · 86Cursor rulesshellgithub-actionsui44/1003 days ago
ivangrynenko/cursorrules.cursor/rules/api-standards.mdc · 86Cursor rulesshellgithub-actionsapi44/1003 days ago
ivangrynenko/cursorrules.cursor/rules/behat-steps.mdc · 86Cursor rulesshellgithub-actionslint-formatstyleperformanceagent-behaviour42/1003 days ago
ivangrynenko/cursorrules.cursor/rules/build-optimization.mdc · 86Cursor rulesshellgithub-actionsbuild48/1003 days ago
ivangrynenko/cursorrules.cursor/rules/confluence-editing-standards.mdc · 86Cursor rulesshellgithub-actionsstylearchsecuritydeployment60/1003 days ago
ivangrynenko/cursorrules.cursor/rules/debugging-standards.mdc · 86Cursor rulesshellgithub-actionsno sections30/1003 days ago
ivangrynenko/cursorrules.cursor/rules/docker-compose-standards.mdc · 86Cursor rulesshellgithub-actionsstyle62/1003 days ago
ivangrynenko/cursorrules.cursor/rules/drupal-broken-access-control.mdc · 86Cursor rulesshellgithub-actionsstylesecurity52/1003 days ago
ivangrynenko/cursorrules.cursor/rules/drupal-cryptographic-failures.mdc · 86Cursor rulesshellgithub-actionssecurity48/1003 days ago
ivangrynenko/cursorrules.cursor/rules/drupal-database-standards.mdc · 86Cursor rulesshellgithub-actionsdatabase30/1003 days ago
ivangrynenko/cursorrules.cursor/rules/drupal-injection.mdc · 86Cursor rulesshellgithub-actionssecuritydo-not55/1003 days ago
ivangrynenko/cursorrules.cursor/rules/drupal-insecure-design.mdc · 86Cursor rulesshellgithub-actionssecurity48/1003 days ago
ivangrynenko/cursorrules.cursor/rules/drupal-integrity-failures.mdc · 86Cursor rulesshellgithub-actionsstyle60/1003 days ago
ivangrynenko/cursorrules.cursor/rules/drupal-logging-failures.mdc · 86Cursor rulesshellgithub-actionssecurity48/1003 days ago
ivangrynenko/cursorrules.cursor/rules/drupal-security-misconfiguration.mdc · 86Cursor rulesshellgithub-actionssecurity48/1003 days ago
ivangrynenko/cursorrules.cursor/rules/drupal-vulnerable-components.mdc · 86Cursor rulesshellgithub-actionsstylesecurity67/1003 days ago
ivangrynenko/cursorrules.cursor/rules/git-commit-standards.mdc · 86Cursor rulesshellgithub-actionsgit44/1003 days ago
ivangrynenko/cursorrules.cursor/rules/github-actions-standards.mdc · 86Cursor rulesshellgithub-actionsno sections44/1003 days ago
ivangrynenko/cursorrules.cursor/rules/improve-cursorrules-efficiency.mdc · 86Cursor rulesshellgithub-actionsno sections34/1003 days ago
ivangrynenko/cursorrules.cursor/rules/javascript-cryptographic-failures.mdc · 86Cursor rulesshellgithub-actionssecurity40/1003 days ago
Diff against .cursor/rules/accessibility-standards.mdc Diff against .cursor/rules/api-standards.mdc Diff against .cursor/rules/behat-steps.mdc Diff against .cursor/rules/build-optimization.mdc Diff against .cursor/rules/confluence-editing-standards.mdc Diff against .cursor/rules/debugging-standards.mdc Diff against .cursor/rules/docker-compose-standards.mdc Diff against .cursor/rules/drupal-broken-access-control.mdc Diff against .cursor/rules/drupal-cryptographic-failures.mdc Diff against .cursor/rules/drupal-database-standards.mdc Diff against .cursor/rules/drupal-injection.mdc Diff against .cursor/rules/drupal-insecure-design.mdc Diff against .cursor/rules/drupal-integrity-failures.mdc Diff against .cursor/rules/drupal-logging-failures.mdc Diff against .cursor/rules/drupal-security-misconfiguration.mdc Diff against .cursor/rules/drupal-vulnerable-components.mdc Diff against .cursor/rules/git-commit-standards.mdc Diff against .cursor/rules/github-actions-standards.mdc Diff against .cursor/rules/improve-cursorrules-efficiency.mdc Diff against .cursor/rules/javascript-cryptographic-failures.mdc

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
skillrecordings/egghead-next.cursor/rules/project-update-user-rules.mdc · 1.4kCursor rulestypescriptnode+14buildtestlint-formatstyle+796/1003 days ago
nerds-odd-e/doughnut.cursor/rules/cli.mdc · 49Cursor rulestypescriptcypress+14setupbuildteststyle+496/1003 days ago
skillrecordings/egghead-next.cursor/rules/gh-task-plan.mdc · 1.4kCursor rulestypescriptnode+14teststylearchtypes+296/1003 days ago
skillrecordings/egghead-next.cursor/rules/project-update-rules.mdc · 1.4kCursor rulestypescriptnode+14buildtestlint-formatstyle+796/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack