PHPackages                             pekral/cursor-rules - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. pekral/cursor-rules

ActiveComposer-plugin[Testing &amp; Quality](/categories/testing)

pekral/cursor-rules
===================

PHP and Laravel Cursor rules — coding standards, testing, and conventions for Cursor editor

0.5.1(3mo ago)1137.7k↑18.4%[2 issues](https://github.com/pekral/cursor-rules/issues)4MITPHPCI passing

Since Aug 24Pushed 1mo agoCompare

[ Source](https://github.com/pekral/cursor-rules)[ Packagist](https://packagist.org/packages/pekral/cursor-rules)[ Docs](https://github.com/pekral/cursor-rules)[ RSS](/packages/pekral-cursor-rules/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (17)Versions (48)Used By (4)

 [![Cursor rules](assets/logo.png)](assets/logo.png)

Cursor Rules for PHP and Laravel
================================

[](#cursor-rules-for-php-and-laravel)

**Cursor rules for PHP and Laravel** — a complete set of `.mdc` rule files and Cursor Agent skills for the Cursor editor. One package for PHP and Laravel cursor rules: coding standards, testing, and conventions. The installer discovers the project root (via `composer.json` lookup from the current directory), mirrors the `rules/` directory into `.cursor/rules` and the `skills/` directory into `.cursor/skills`, and copies or symlinks every file into the target project. Use cursor rules for PHP and Laravel to keep every edit aligned with enforced standards, plus comprehensive Agent skills for issue resolution, bug fixing, code review, security analysis, refactoring, testing, and package review.

Why This Package
----------------

[](#why-this-package)

- cursor rules for PHP and Laravel in one Composer-installable package
- unified PHP coding guidelines for PHP 8.4 projects
- Pest-based testing with mandatory code analysis and 100% coverage
- strong focus on clean code: typed properties, SRP, no redundant comments
- **30 comprehensive Agent skills** for automated workflows (v0.6.1)
- fast onboarding inside development repositories

Installation
------------

[](#installation)

```
composer require pekral/cursor-rules --dev
vendor/bin/cursor-rules install
```

By default the installer targets **Cursor** only (`.cursor/rules`, `.cursor/skills`). Use `--editor=` to choose the agent:

- **cursor** (default): `.cursor/rules`, `.cursor/skills`
- **claude**: `.claude/rules`, `.claude/skills`, and when `HOME`/`USERPROFILE` is set also `~/.claude/skills`
- **codex**: `.codex/rules`, `.codex/skills`, and when `HOME`/`USERPROFILE` is set also `~/.codex/skills`
- **all**: all of the above (Cursor, Claude, Codex in project + home)

When the package is required via Composer, sources are read from `vendor/pekral/cursor-rules/rules` and `vendor/pekral/cursor-rules/skills`; in development it falls back to the local `rules/` and `skills/` directories.

**Important:** By default, the installer only copies missing files and keeps existing content untouched. Use the `--force` flag to overwrite existing files: `vendor/bin/cursor-rules install --force`. This is particularly useful when you want to update rules to their latest versions or when you've made local changes that should be replaced. The file `.cursor/rules/project.mdc` is never overwritten once it exists in the target project, so you can safely customize it for your project.

### Installing rules from GitHub (Cursor only)

[](#installing-rules-from-github-cursor-only)

You can use this repository as a **Remote Rule** in Cursor without installing the package via Composer:

1. Open **Cursor Settings** → **Rules**.
2. In the **Project Rules** section, click **Add Rule**.
3. Select **Remote Rule (Github)**.
4. Enter the repository URL: `https://github.com/pekral/cursor-rules`.

Cursor will fetch and apply the rules from the repository. Note: this method provides rules only; Agent skills are installed into your project when you use the Composer-based installation above.

### Available Commands

[](#available-commands)

```
vendor/bin/cursor-rules help                        # print help
vendor/bin/cursor-rules install                     # install for Cursor (default)
vendor/bin/cursor-rules install --editor=claude     # install for Claude
vendor/bin/cursor-rules install --editor=codex      # install for Codex
vendor/bin/cursor-rules install --editor=all        # install for Cursor, Claude, and Codex
vendor/bin/cursor-rules install --force             # overwrite existing files
vendor/bin/cursor-rules install --symlink          # prefer symlinks (fallback to copy)
```

### Installer Flow

[](#installer-flow)

1. Determine the project root by walking up from the current directory until `composer.json` is found.
2. Resolve the rules source (local `rules/` or `vendor/pekral/cursor-rules/rules`).
3. Install rules into the target directory(ies) for the chosen editor (see `--editor`).
4. If present, resolve the skills source and install into the corresponding skill directory(ies).
5. Optionally overwrite existing files with `--force`; use `--symlink` to prefer symlinks (fallback to copy on Windows).
6. Surface explicit errors for missing directories, removal failures, and copy/symlink failures.

### CLI Switches

[](#cli-switches)

OptionDescription`--editor=EDITOR`Target editor: `cursor` (default), `claude`, `codex`, `all`.`--force`Overwrite files that already exist in the target directory.`--symlink`Create symlinks when the OS permits; automatically falls back to copy.*(default)*Only copy missing files and keep existing content untouched.---

🎯 Skills Overview — **v0.6.1**
==============================

[](#-skills-overview--v061)

> Current release includes 31 skills for issue resolution, code review, refactoring, testing, security, SQL performance, and delivery workflows.

Agent skills are installed into the chosen editor’s skill directory (see `--editor`). Use `--editor=all` to install for Cursor, Claude, and Codex at once. They can be invoked when relevant. Each skill follows project conventions, ensures code quality, and maintains 100% test coverage where applicable.

Issue Resolution &amp; Delivery
-------------------------------

[](#issue-resolution--delivery)

SkillDescription`analyze-problem`Analyze problems from issue trackers, including attachments, technical context, and human-readable outputs.`resolve-bugsnag-issue`End-to-end Bugsnag issue resolution with fixes, review loops, coverage checks, and PR creation.`resolve-github-issue`End-to-end GitHub issue resolution with fixes, review loops, coverage checks, and PR creation.`resolve-jira-issue`End-to-end JIRA issue resolution with fixes, review loops, coverage checks, and PR creation.`resolve-random-jira-issue`Pick and resolve a random JIRA issue with the full quality workflow.`answer-pr-questions`Find unanswered current issue/PR questions and generate short PM/client-friendly unified answers.`merge-github-pr`Merge one GitHub PR that is ready for deployment.`create-issue`Create a tracker issue from provided task text while preserving original meaning and structure.`create-jira-issue-from-pr`Draft a JIRA-ready issue from GitHub PR review context while preserving original assignment text.Code Review, Security &amp; Architecture
----------------------------------------

[](#code-review-security--architecture)

SkillDescription`code-review`Senior PHP code review focused on architecture, risk, and behavior (read-only).`code-review-github`Review GitHub pull requests with severity-based findings and review comments.`code-review-jira`Review JIRA-linked changes with GitHub PR comments and structured findings.`process-code-review`Process existing review feedback, resolve comments, and prepare next review cycle.`security-review`OWASP-focused security review (injection, auth, exposure, misconfigurations).`class-refactoring`Refactor PHP classes using SOLID and Laravel best practices with testability focus.`race-condition-review`Review shared-state and concurrency paths for race conditions and atomicity gaps.`refactor-entry-point-to-action`Refactor controller/job/command/listener entry-point logic into Action classes.`smartest-project-addition`Propose one high-impact, low-risk project improvement.`understand-propose-implement-verify`Enforce a strict 4-step loop: understand, propose, implement, verify.Testing &amp; Quality Automation
--------------------------------

[](#testing--quality-automation)

SkillDescription`create-test`Add tests following project rules with deterministic behavior and high coverage.`create-missing-tests-in-pr`Validate review recommendations and add missing tests for current PR changes.`rewrite-tests-pest`Rewrite tests to PEST style while preserving behavior and conventions.`test-like-human`Validate PR behavior from user perspective using scenario-driven testing.`test-driven-development`Enforce strict red-green-refactor flow for bugfixes and features.`postman-collections`Create or update Postman collections for changed API endpoints.Platform, Data &amp; SEO
------------------------

[](#platform-data--seo)

SkillDescription`composer-update`Analyze composer updates, conflicts, and changelog impact.`package-review`Review `composer.json` and package metadata/configuration quality.`mysql-problem-solver`Diagnose and optimize MySQL queries, indexes, and execution plans.`laravel-telescope`Analyze Laravel Telescope request data from URL, match entries in DB, and propose concrete optimizations.`seo-fix`Implement and maintain Laravel SEO assets (robots/sitemap/meta/canonical).`seo-geo`Improve SEO + GEO (AI search visibility and citation-readiness).---

Rules Overview
--------------

[](#rules-overview)

Cursor rules for PHP and Laravel included in this package:

FileDescriptionScope`project.mdc`Base rules for actual projectAlways`php/core.mdc`Project tech stack and core contextAlways`php/standards.mdc`Unified coding standards for PHP/Laravel projectsAlways`git/conventions.mdc`Git and commit conventionsAlways`git/general.mdc`Git workflow — analyze branch/commits when outside mainAlways`git/pr.mdc`Create pull request in GithubAlways`laravel/architecture.mdc`Laravel architecture and conventionsLaravel`laravel/arch-app-services.mdc`BaseModelService/Data Validator conventions for `pekral/arch-app-services` projectsLaravel`laravel/filament.mdc`Filament v4 specific rulesFilament`laravel/livewire.mdc`Livewire component rules and conventionsLivewire`sql/optimalize.mdc`SQL query optimization, index design, schema standardsAlways`security/backend.md`Backend security rules and OWASP Top 10 checksAlways`security/frontend.md`Frontend security rules (XSS, CSRF, CSP)Frontend`security/mobile.md`Mobile-specific security rules and WebView checksMobileAll `.mdc` and `.md` files are ready for automatic injection by Cursor so every PHP and Laravel edit stays aligned with the enforced standards.

Development &amp; Testing
-------------------------

[](#development--testing)

### Composer Scripts

[](#composer-scripts)

```
composer check              # run full quality check (normalize, phpcs, pint, rector, phpstan, audit, tests)
composer fix                # run all automatic fixes (normalize, rector, pint, phpcs)
composer build              # fix then check
composer analyse            # run PHPStan static analysis
composer test:coverage       # run tests with 100% coverage
composer coverage           # alias for test:coverage
composer security-audit     # run security audit of dependencies
```

### Individual Commands

[](#individual-commands)

```
composer phpcs-check        # PHP CodeSniffer check
composer phpcs-fix          # PHP CodeSniffer fix
composer pint-check         # Laravel Pint check
composer pint-fix           # Laravel Pint fix
composer rector-check       # Rector check (dry-run)
composer rector-fix         # Rector fix
```

### Testing

[](#testing)

```
./vendor/bin/pest           # run all tests
composer test:coverage      # run tests with coverage (min. 100%)
```

Remove `coverage.xml` before committing if it was produced locally.

Author
------

[](#author)

**Petr Král** — PHP Developer &amp; Laravel programmer, open source contributor ([pekral.cz](https://pekral.cz)).

License
-------

[](#license)

MIT — free to use, modify, and distribute.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance67

Regular maintenance activity

Popularity36

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 97.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~16 days

Recently: every ~3 days

Total

12

Last Release

90d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/820760fa5b2ca7e1c749f0e15c0fb9b0881ddc54ce924cb083f4bb6ae2490948?d=identicon)[pekral](/maintainers/pekral)

---

Top Contributors

[![pekral](https://avatars.githubusercontent.com/u/9308589?v=4)](https://github.com/pekral "pekral (442 commits)")[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (10 commits)")

---

Tags

aicursor-ruleslaravelphpphppestPHPStanlaravelrulesclean codecursorcoding-standardscursor-rulescursor-editorphp-cursor-ruleslaravel-cursor-rules

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pekral-cursor-rules/health.svg)

```
[![Health](https://phpackages.com/badges/pekral-cursor-rules/health.svg)](https://phpackages.com/packages/pekral-cursor-rules)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[calebdw/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

1484.6k3](/packages/calebdw-larastan)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
