laravel-pest-rector
Adopt Pest's Rector plugin on a Pest 5 project and refactor tests into Pest matchers — scoped to tests/, dry-run gated.
Skill by bravros
Chalk Labs
Need help deploying laravel-pest-rector?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/bravros-laravel-pest-rector
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 26, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/laravel-pest-rector
What's inside
- Skill name
laravel-pest-rector- Description
- Adopt Pest's Rector plugin on a Pest 5 project and refactor tests into Pest matchers — scoped to tests/, dry-run gated. Use on /laravel-pest-rector, or when adding pest-plugin-rector.
- License
- MIT
- Instructions
- 194 lines in SKILL.md · view on GitHub
Files (2)
- SKILL.md
- generated-config-trap.md · references/
SKILL.md (first lines)
# Pest Rector — refactor tests into Pest matchers
Turns raw assertions into Pest's own matchers across an existing Pest 5 suite:
```diff
-expect(count($array))->toBe(5);
-expect(array_key_exists('id', $array))->toBeTrue();
+expect($array)->toHaveCount(5)
+ ->toHaveKey('id');
```
60 rules, one set. It refactors tests that are **already Pest** — it does not convert PHPUnit
class-style tests (that is `/laravel-pest5-upgrade` step 3, and a hard prerequisite here).
Despite the name, nothing in this flow is Laravel-specific — it works on any Pest 5 PHP project.
The prefix keeps it beside its sibling skill.
## 1. Preconditions — both are hard gates
**Pest 5 installed.** `vendor/bin/pest --version` reports 5.x. Not there yet ⇒ `/laravel-pest5-upgrade` first.
**A green suite, unfiltered.** This rewrites hundreds of test files at once; without a known-good
baseline you cannot attribute a single failure afterwards.
```bash
./vendor/bin/pest --parallel --no-tia
```
`--no-tia` matters even here. If the repo followed `/laravel-pest5-upgrade`, `pest()->tia()->locally()`
makes a bare `--parallel` run impact-filtered — a green that proves nothing about the files Rector
is about to touch. **Every suite run in this skill is `--no-tia`.**
Working tree clean before step 4 — Rector rewrites in place with no backup, and a dirty tree makes
its diff unreviewable.
## 2. Install
```bash
composer require pestphp/pest-plugin-rector --dev
composer require rector/rector --dev
```
The plugin already depends on `rector/rector ^2.6.1`, so `vendor/bin/rector` arrives either way.
The second line is what the docs prescribe and it pins Rector at top level — worth having when the
plugin's own constraint later widens.
**Require v5.0.2 or newer.** v5.0.0–v5.0.1 shipped a `ChainExpectCallsRector` bug that collapsed
two `expect()` calls on an AST-equal *side-effectful* subject into a single chain, silently dropping
the second evaluation and turning passing tests red. Fixed in v5.0.2 by an `isSideEffectFree()`
guard. `composer require` takes the latest by default — confirm with
`composer show pestphp/pest-plugin-rector`.
Not this plugin's job: converting PHPUnit class-style tests to Pest. That is
`pestphp/pest-plugin-drift`, a separate package — and `/laravel-pest5-upgrade` step 3.
## 3. Write `rector.php` BEFORE invoking rector at all
⛔ **This is the step that decides whether the skill did anything at all.**
With no `rector.php` present, `vendor/bin/rector` asks *"No rector.php config found. Should we
generate it for you?"* — and **you do not get to decline it.** Symfony's question helper returns
the default answer when stdin is not a TTY, and an agent shell is not a TTY, so the prompt
auto-answers **yes**, writes the file, and exits SUCCESS *having processed nothing*. Every later
run then silently uses that generated config.
So the config has to exist before rector is invoked even once. There is no `rector init` to reach
for — the command does not exist in Rector 2.x. Write the file.
The generated one carries the project's whole source tree and **no Pest set**, so a `process`
against it applies generic Rector rules to your application while performing zero Pest refactoring.
Write this instead:
```php
<?php
declare(strict_types=1);
use Pest\Rector\Set\PestSetList;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withPaths([__DIR__ . '/tests'])
->withSets([
PestSetList::CODING_STYLE,
]);
```
Two things are load-bearing: `withPaths` names **only** `tests/`, and `withSets` registers
`PestSetList::CODING_STYLE`. Drop either and this becomes a generic refactor of unrelated code.
**A `rector.php` already exists?** Do not overwrite it — merge. Add `PestSetList::CODING_STYLE` to
its `withSets(...)`, and if its `withPaths(...)` reaches beyond `tests/`, stop and ask: this skill's
gates assume a test-only blast radius, and the existing config is someone's deliberate choice.
Measured cost of getting this wrong: `references/generated-config-trap.md`.
## 4. Preview, read the diff, then apply
```bash
vendor/bin/rector process --dry-run
```
**Read it before applying** — this is the review, and there is no other. Confirm three things:
every path is under `tests/`; the changes are Pest matcher conversions and expectation chaining;
the file count is in the range you expect for the suite's size.
**`--dry-run` exits non-zero when it finds changes** (`ExitCode::CHANGED_CODE`). Here that is the
success case, not a failure — never gate on `$?` alone at this step, and never let a wrapper read
it as an error and abort.
The preview is faithful. Rector re-runs the whole rule pipeline over each file until an iteration
changes nothing, and `--dry-run` uses that same loop, returning just before the write — so chained
effects, like a matcher rewrite that then enables a chain merge, are already in the diff. Only a
cross-file cascade could need a second pass, which is what step 5's final check catches.
**`->only()` markers get stripped.** `RemoveOnlyRector` is in the set, so any focused test left in
the working tree loses its `->only()`. Look for that in the dry-run diff before applying.From bravros/bravros, MIT.
More from bravros/bravros
- 0.609score
after-merge
bravros
Generate an after-merge.md operational deploy checklist for homolog-to-main aggregate releases.
SkillAFreshness: A★ 3Claude Code +9 - 0.609score
laravel-pest5-upgrade
bravros
Upgrade a PHP/Laravel repo from Pest 4 to Pest 5 and turn on Test Impact Analysis (TIA) so local full runs only re-execute the tests a change can reach.
SkillAFreshness: A★ 3Claude Code +9 - 0.609score
interview-me
bravros
Stress-test a plan or design via a round-by-round interview — ask the whole frontier of independent questions each round until every branch of the decision…
SkillAFreshness: A★ 3Claude Code +9 - 0.609score
doctor-plus
bravros
Runs Claude Code's built-in /doctor health check, then audits the workspace against Anthropic's 6 then-and-now context-engineering shifts (rules→judgement…
SkillAFreshness: A★ 3Claude Code +9 - 0.609score
context
bravros
Scan project and generate/audit CLAUDE.md files with stack auto-detection and Context7 docs.
SkillAFreshness: A★ 3Claude Code +9 - 0.606score
advise-project-approach
bravros
Research and advise how a software project should be built — stack selection, architecture, operating-cost tradeoffs, and real-world comparables.
SkillAFreshness: A★ 3Claude Code +9 - 0.606score
graphify-this-project
bravros
Set up a graphify knowledge graph for the current project — in-project committed graph.json, AST extraction + external labelling, tracked refresh hooks…
SkillAFreshness: A★ 3Claude Code +9 - 0.606score
backlog
bravros
Capture, list, and promote pre-planning ideas.
SkillAFreshness: A★ 3Claude Code +9 - 0.606score
batch-merge-prs
bravros
Verify N PRs, address review feedback, ordered-merge to the staging branch (never main), close linked issues/backlog per merge, then hand off the full test…
SkillAFreshness: A★ 3Claude Code +9 - 0.606score
finish
bravros
Complete a feature — merge the approved PR, record plan completion, route the homolog→main decision.
SkillAFreshness: A★ 3Claude Code +9 - 0.606score
graphify-status
bravros
Report knowledge-graph label coverage across every graphify-enabled project on this machine — communities, labels, and how many nodes still render as…
SkillAFreshness: A★ 3Claude Code +9 - 0.603score
hotfix
bravros
Emergency hotfix deploy — commit, push homolog, PR to main, merge now.
SkillAFreshness: A★ 3Claude Code +9
Signals
- Stars
- 3
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 22, 2026 (2 months ago)
- Last release
- Oct 1, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/bravros/bravros
- Website
- bravros.dev
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from bravros
- 0.609score
after-merge
bravros
Generate an after-merge.md operational deploy checklist for homolog-to-main aggregate releases.
SkillAFreshness: A★ 3Claude Code +9 - 0.609score
context
bravros
Scan project and generate/audit CLAUDE.md files with stack auto-detection and Context7 docs.
SkillAFreshness: A★ 3Claude Code +9 - 0.609score
doctor-plus
bravros
Runs Claude Code's built-in /doctor health check, then audits the workspace against Anthropic's 6 then-and-now context-engineering shifts (rules→judgement…
SkillAFreshness: A★ 3Claude Code +9 - 0.609score
interview-me
bravros
Stress-test a plan or design via a round-by-round interview — ask the whole frontier of independent questions each round until every branch of the decision…
SkillAFreshness: A★ 3Claude Code +9 - 0.609score
laravel-pest5-upgrade
bravros
Upgrade a PHP/Laravel repo from Pest 4 to Pest 5 and turn on Test Impact Analysis (TIA) so local full runs only re-execute the tests a change can reach.
SkillAFreshness: A★ 3Claude Code +9 - 0.606score
graphify-this-project
bravros
Set up a graphify knowledge graph for the current project — in-project committed graph.json, AST extraction + external labelling, tracked refresh hooks…
SkillAFreshness: A★ 3Claude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get laravel-pest-rector running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
laravel-pest-rector skill. Agent Mart. https://agentmart.dev/skills/bravros-laravel-pest-rector (last updated 2026-10-24)