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 agentmods add skills/pekral/cursor-rules/rewrite-tests-pestnpx 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.svg" alt="Measured on agentmods" 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 | $0.00018 | $0.00447 |
| Sonnet 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 yesterday.
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.
- yesterday 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 (6 stars, last pushed 5d ago), licensed MIT. It adds 36 tokens to every session and 895 once invoked, about $0.0002 per session on Opus 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.
laravel-expert
Laravel & PHP Development Instructions for GitHub Copilot.
php-laravel-codestyle
Custom Instructions: PHP 8+ & Laravel Architecture Expert.
laravel
Writes Laravel PHP — Eloquent, Artisan controllers, FormRequests, jobs, events, policies, providers. For Symfony / Doctrine use symfony-workflow. For framework-free PHP use php-coder.
laravel-api-endpoint
Use when creating a new Laravel API endpoint — Controller, FormRequest, Resource, route, Policy, OpenAPI annotations — versioned route layout, single-action invoke controllers.
composer-packages
Use when building or maintaining a Composer library — versioning, Laravel integration, autoloading, publishing to private registries — even when the user says 'release a new version'.