-
Notifications
You must be signed in to change notification settings - Fork 8
Restructured cursor rule files for improved readability and consistency #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… consistency - Simplified rule file structure across all 22 rule files - Reorganised content with dedicated sections for Rule Details, Filters, Rejections, and Suggestions - Converted verbose rule definitions into more concise, readable format - Improved consistency in formatting and documentation standards - Enhanced clarity of metadata and priority levels - Maintained all existing functionality whilst improving maintainability
Summary of ChangesHello @ivangrynenko, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request implements a significant refactoring across 22 Cursor rule files. The core objective is to enhance the overall quality of the rule set by standardizing their internal structure, improving readability, and boosting maintainability. The changes involve reorganizing rule definitions into clear, consistent sections, simplifying their presentation, and unifying formatting, all without altering the underlying logic or validation patterns of the rules. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request is a significant and valuable refactoring of 22 Cursor rule files, successfully transitioning them to a more readable and consistent Markdown-based format. The new structure greatly improves maintainability.
My review has identified a few issues introduced during the restructuring. Most notably, there is a critical issue in code-generation-standards.mdc where a language-specific constraint was lost, which alters the rule's logic. I've also found several medium-to-high severity inconsistencies in the new format within cursor-rules.mdc and docker-compose-standards.mdc, including misaligned comments, extraneous text, and duplicated section headers.
Addressing these points will ensure the new format is applied correctly and consistently across all rule files, preserving the original intent of the rules.
| - pattern `function\\s+\\w+\\s*\\([^)]*\\)\\s*\\{\\s*(?:return\\s+null|throw\\s+new\\s+Error|console\\.log)\\s*\\}` – Implement full functionality - no stub methods. | ||
| - pattern `\\bif\\b\\s*\\(\\s*false\\s*\\)` – Remove or replace conditional statements that are always false. | ||
| - pattern `\\bconsole\\.[^(]+|print\\s*\\(` – negated `DEBUG|LOGGING` – Remove debug logging unless it's conditional on a debug flag. | ||
| - pattern `^\\s*#\\s*\\w+:\\s*\\w+\\s*$` – In Python, prefer type hints over comments for type annotations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The language: python specifier for this pattern was lost during the restructuring. This is a critical issue because the rule, which was intended only for Python, will now apply to all file types matched by the filters (including PHP, JS, Java, etc.), likely causing incorrect linting. Please restore the language-specific constraint in the new format.
For example, you could adopt a format like this:
pattern ...– language:python – message
- pattern `^\s*#\s*\w+:\s*\w+\s*$` – language: `python` – In Python, prefer type hints over comments for type annotations.
| - file extension pattern: `\\.mdc$` | ||
| - Match files that look like Cursor rules | ||
| - content: `(?s)<rule>.*?</rule>` | ||
| - Match file creation or modification events | ||
| - event: `file_create|file_modify` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The descriptions for the filter patterns appear to be misaligned. For instance, 'Match files that look like Cursor rules' should describe the content pattern, not the file extension pattern. This makes the rule definition confusing. Additionally, the description for the file extension pattern ('Match any .mdc files') is missing.
- file extension pattern: `\.mdc$`
- Match any .mdc files
- content: `(?s)<rule>.*?</rule>`
- Match files that look like Cursor rules
- event: `file_create|file_modify`
- Match file creation or modification events
| - - **When Adding New Rules: ** | ||
| - - **When Modifying Existing Rules: ** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Rejections | ||
| - Conditions: | ||
| - pattern `^\\s*version\\s*:` – The 'version' field is deprecated in Docker Compose files. Compose files are now version-less by default. | ||
|
|
||
| ## Rejections | ||
| - Conditions: | ||
| - pattern `^( |\t)` – Inconsistent indentation detected. Use 2 spaces for indentation. | ||
|
|
||
| ## Rejections | ||
| - Conditions: | ||
| - pattern `^\\s*links\\s*:` – The 'links' key is deprecated. Use networks and service names for inter-service communication. | ||
|
|
||
| ## Rejections | ||
| - Conditions: | ||
| - pattern `^\\s*image\\s*:\\s*[^:]+$` – Specify an explicit image tag to ensure consistency. | ||
|
|
||
| ## Rejections | ||
| - Conditions: | ||
| - pattern `^\\s*privileged\\s*:\\s*true` – Running services in privileged mode is discouraged for security reasons. | ||
|
|
||
| ## Rejections | ||
| - Conditions: | ||
| - pattern `^\\s*services\\s*:\\s*[^\\n]+\\n(?!.*\\blimits\\b)` – Define resource limits for each service to prevent resource exhaustion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains multiple ## Rejections sections. For consistency with other rule files and better readability, all rejection conditions should be grouped under a single ## Rejections heading.
## Rejections
- Conditions:
- pattern `^\s*version\s*:` – The 'version' field is deprecated in Docker Compose files. Compose files are now version-less by default.
- pattern `^( |\t)` – Inconsistent indentation detected. Use 2 spaces for indentation.
- pattern `^\s*links\s*:` – The 'links' key is deprecated. Use networks and service names for inter-service communication.
- pattern `^\s*image\s*:\s*[^:]+$` – Specify an explicit image tag to ensure consistency.
- pattern `^\s*privileged\s*:\s*true` – Running services in privileged mode is discouraged for security reasons.
- pattern `^\s*services\s*:\s*[^\n]+\n(?!.*\blimits\b)` – Define resource limits for each service to prevent resource exhaustion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ## Rule Details | ||
|
|
||
| - **Name:** git_commit_standards | ||
|
|
||
| - **Description:** Enforce structured Git commit messages. | ||
|
|
||
| ## Filters | ||
| - file extension pattern: `\\.git/.*` | ||
|
|
||
| ## Enforcement Checks | ||
| - Conditions: | ||
| - pattern `^(?!fix|feat|perf|docs|style|refactor|test|chore): ` – Use a commit message prefix followed by colon and space (fix:, feat:, etc.). | ||
| - More precise regex to ensure prefix is followed by colon and space | ||
| - pattern `^(fix|feat|perf|docs|style|refactor|test|chore): [A-Z]` – First word after prefix should be lowercase. | ||
| - Check for uppercase after the prefix | ||
| - pattern `^(fix|feat|perf|docs|style|refactor|test|chore): .{46,}` – Keep commit message content (excluding prefix) under 46 characters. | ||
| - More precise length check that excludes the prefix from the count | ||
| - pattern `^(fix|feat|perf|docs|style|refactor|test|chore):(?! )` – Include a space after the colon in prefix. | ||
| - Ensure there's a space after the colon | ||
|
|
||
| ## Suggestions | ||
| - Guidance: | ||
| Recommended commit format: | ||
| - "fix: resolved bug in user authentication" | ||
| - "feat: added new search functionality" | ||
| - "docs: updated installation guide" | ||
| - "style: fixed button alignment" | ||
| - "refactor: simplified login logic" | ||
| - "test: added unit tests for auth" | ||
| - "chore: updated dependencies" | ||
| - "perf: optimized database queries" | ||
|
|
||
| ## Metadata | ||
| - Priority: high | ||
| - Version: 1.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore
<rule> structure so Cursor can load commit checks
The rule content was rewritten as plain Markdown headings and bullet lists, but the <rule> block with filters, actions, and metadata was removed. The repository’s own cursor-rules.mdc file documents that Cursor only picks up rules defined inside <rule> elements. In this state the commit message checks are no longer defined in machine-readable form, so Cursor will ignore the file and the standards it enforced previously. The same rewrite pattern appears in the other rule files, effectively disabling the entire ruleset.
Useful? React with 👍 / 👎.
- Updated 22 rule files to reflect the restructuring changes - Incremented minor version across the following files: - accessibility-standards.mdc: 1.1 → 1.2 - api-standards.mdc: 1.1 → 1.2 - build-optimization.mdc: 1.1 → 1.2 - code-generation-standards.mdc: 1.1 → 1.2 - cursor-rules.mdc: 1.0 → 1.1 - debugging-standards.mdc: 1.0 → 1.1 - docker-compose-standards.mdc: 1.0 → 1.1 - drupal-authentication-failures.mdc: 1.0 → 1.1 - drupal-broken-access-control.mdc: 1.0 → 1.1 - drupal-cryptographic-failures.mdc: 1.0 → 1.1 - drupal-database-standards.mdc: 1.0 → 1.1 - drupal-file-permissions.mdc: 1.1 → 1.2 - drupal-injection.mdc: 1.0 → 1.1 - drupal-insecure-design.mdc: 1.0 → 1.1 - drupal-integrity-failures.mdc: 1.0 → 1.1 - drupal-logging-failures.mdc: 1.0 → 1.1 - drupal-security-misconfiguration.mdc: 1.0 → 1.1 - drupal-ssrf.mdc: 1.0 → 1.1 - drupal-vulnerable-components.mdc: 1.0 → 1.1 - generic_bash_style.mdc: 1.1 → 1.2 - git-commit-standards.mdc: 1.1 → 1.2 - github-actions-standards.mdc: 1.0 → 1.1 - Front matter and all other content preserved
Description
This pull request restructures all 22 Cursor rule files to improve readability, consistency, and maintainability across the entire rule set. All affected files have had their minor version incremented to reflect these structural changes.
Changes Made
Rule File Restructuring (22 files)
Restructured the following rule files with improved formatting and organisation:
.cursor/rules/accessibility-standards.mdc(1.1 → 1.2).cursor/rules/api-standards.mdc(1.1 → 1.2).cursor/rules/build-optimization.mdc(1.1 → 1.2).cursor/rules/code-generation-standards.mdc(1.1 → 1.2).cursor/rules/cursor-rules.mdc(1.0 → 1.1).cursor/rules/debugging-standards.mdc(1.0 → 1.1).cursor/rules/docker-compose-standards.mdc(1.0 → 1.1).cursor/rules/drupal-authentication-failures.mdc(1.0 → 1.1).cursor/rules/drupal-broken-access-control.mdc(1.0 → 1.1).cursor/rules/drupal-cryptographic-failures.mdc(1.0 → 1.1).cursor/rules/drupal-database-standards.mdc(1.0 → 1.1).cursor/rules/drupal-file-permissions.mdc(1.1 → 1.2).cursor/rules/drupal-injection.mdc(1.0 → 1.1).cursor/rules/drupal-insecure-design.mdc(1.0 → 1.1).cursor/rules/drupal-integrity-failures.mdc(1.0 → 1.1).cursor/rules/drupal-logging-failures.mdc(1.0 → 1.1).cursor/rules/drupal-security-misconfiguration.mdc(1.0 → 1.1).cursor/rules/drupal-ssrf.mdc(1.0 → 1.1).cursor/rules/drupal-vulnerable-components.mdc(1.0 → 1.1).cursor/rules/generic_bash_style.mdc(1.1 → 1.2).cursor/rules/git-commit-standards.mdc(1.1 → 1.2).cursor/rules/github-actions-standards.mdc(1.0 → 1.1)Key Improvements
Improved Structure: Reorganised rule files with dedicated sections:
Enhanced Readability:
Consistency:
Maintainability:
Version Management:
Statistics
Why These Changes?
This refactoring addresses the need for:
Testing
All rule functionality has been preserved. The restructuring is cosmetic and structural—no changes have been made to the underlying rule logic or validation patterns. Version increments reflect the structural improvements without affecting functionality.
Related Documentation
.cursor/rules/cursor-rules.mdcfor standards on rule file structure and maintenanceREADME.mdfor the complete list of available Cursor rulesAGENTS.mdfor information on rule installation and bundlingScreenshots
N/A (Internal restructuring)