Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add pekral/cursor-rules --skill rewrite-tests-pestgit clone --depth 1 https://github.com/pekral/cursor-rulesWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/pekral/cursor-rules/rewrite-tests-pest)<a href="https://agentmods.dev/skills/pekral/cursor-rules/rewrite-tests-pest"><img src="https://agentmods.dev/badge/skills/pekral/cursor-rules/rewrite-tests-pest/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/pekral/cursor-rules/rewrite-tests-pest"><img src="https://agentmods.dev/badge/skills/pekral/cursor-rules/rewrite-tests-pest.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00036 | $0.00895 |
| Opus 5.5 | $0.00014 | $0.00358 |
| Sonnet 5.5 | $0.00007 | $0.00179 |
| Haiku 4.5 | $0.00004 | $0.00089 |
Grade A, and why
rewrite-tests-pest scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Constraints
- Apply
@rules/php/core-standards.mdc - Apply
@rules/code-testing/general.mdc - If the current project uses Laravel, also apply
@rules/laravel/laravel.mdc,@rules/laravel/architecture.mdc,@rules/laravel/filament.mdc, and@rules/laravel/livewire.mdc - Do not generate
covers()
Use when
- Existing tests are written in PHPUnit-style syntax and should be rewritten to Pest
- You want to modernize tests without changing their intended behavior
Required approach
- Preserve test intent and coverage of the rewritten behavior
- Keep tests deterministic and non-flaky
- Prefer simple, readable Pest syntax
- Use helper methods or datasets when they clearly reduce duplication
- Avoid reflection; prefer mocks or partial mocks when readable and effective
- Avoid branching in tests; prefer separate test cases or datasets instead
Read, Map & Verify before rewriting (mandatory pre-flight)
Reading, mapping, and verifying come first; rewriting comes last. This pre-flight is blocking — do not rewrite a single line until all three steps pass, and never act on an assumption you have not confirmed by reading the code.
- Read — open and read the actual tests being rewritten and the code they exercise (the system under test, shared setup, helpers, datasets). Confirm what each test asserts by reading it, not by guessing from its name.
- Map — map the change's blast radius: every assertion and covered code path that must survive the rewrite, the shared setup/helpers to reuse, and the project's existing Pest conventions.
- Verify — run the existing tests first and confirm they pass, so you rewrite from a known-green baseline. If the original behavior or coverage is unclear, stop and clarify instead of rewriting on a wrong premise.
Only after Read, Map, and Verify are complete may the rewrite begin.
Execution
- Identify existing tests that should be rewritten to Pest syntax.
- Analyze repeated setup and assertions before rewriting.
- Rewrite tests to Pest syntax without changing covered behavior.
- Use datasets/data providers where they simplify similar test cases.
- Move broadly shared lightweight test helpers to
Pest.phpwhen it improves clarity and reuse. - If a Pest test needs to call a helper method defined on the test case for abstract-class scenarios, use
test()->methodName(). - Keep tests structured and easy to read, preferably with clear arrange / act / assert flow.
- Separate success and failure scenarios into distinct test cases where practical.
- Run the rewritten tests and confirm they pass consistently.
- Simplify nearby similar tests only when the cleanup is small, safe, and clearly improves maintainability.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 67 lines · 36 tokens per session scan A 27b71da230cc
rewrite-tests-pest is a skill published in the GitHub repository pekral/cursor-rules (11 stars, last pushed 19d ago), licensed MIT. It adds 36 tokens to every session and 895 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
Laravel Dusk Testing
Expert-level Laravel Dusk browser testing skill for PHP/Laravel applications. Covers Chrome-based E2E testing, browser assertions, Page Objects, component testing, authentication helpers, and database integration.
php-laravel
Use this skill when building Laravel applications — MVC structure, Eloquent ORM, service layer, validation, queues, and testing. This skill enforces: thin controllers, service layer for business logic, Eloquent best practices with eager loading, form request validation, and queue job structure. Requires Laravel 10+ or…
Test Scaffold (Laravel/PHPUnit)
Generate PHP/Laravel (PHPUnit) test skeletons from specifications.
laravel-testing
Test strategy for a layered Laravel application — which test style fits each layer, hand-written fakes over mocks, real-database tests for Query Classes and Repositories, pure tests for Value Objects, and feature tests that assert authorization, payload shape and query counts. Use when writing or reviewing Laravel…
craft-test-suite
Crafting a test suite. Zero to green in 60 seconds.
craft-test-factory
Crafting Test Factories. Beyond Laravel defaults.