
Craft pest
Gives agents a safe Pest workflow for testing Craft CMS 5 plugins without touching live
Craft pest is an open-source agent skill for developer tools. It is available on Claude Code.
- Scripts
- shell
- Platforms
- Claude Code
- GitHub stars
- 91
- Last commit
- License
- MIT
- Listing updated
Similar skills
About Craft pest
This skill guides an agent through writing, running and reviewing Pest tests for Craft CMS 5 plugins and modules using the markhuot/craft-pest-core harness. Its main focus is test isolation: making sure suites wrap writes in a rollback transaction, pin a dedicated test database and environment, and refuse to run against the wrong database. It also covers the bootstrap and phpunit.xml.dist wiring, timezone pinning, per-test site fixtures, idempotent install migrations, and CI jobs.
The skill is organised around a set of reference files covering isolation, Craft internals that affect tests (such as permission caching, login simulation and muted audit or event surfaces), general test patterns, shared-install concerns and CI wiring. It includes a checklist for reviewing an existing plugin suite and warns against running a suite through a shared project root, where plugin-level environment pins would be ignored.
Users need a Craft CMS 5 plugin or module, Pest with craft-pest-core, and a database the tests can safely use. A small shell script reports the Craft version of the current project.
When your agent uses it
Testing Craft CMS 5 plugins and modules with Pest: test isolation, database safety, and the markhuot/craft-pest-core harness. ALWAYS load when writing, running, fixing, or reviewing tests for a Craft plugin or module, and whenever a suite touches a real Craft install. Covers opt-in rollback, tests/Pest.php + tests/bootstrap.php wiring, phpunit.xml.dist <env> pins (DB name, table prefix, connection, CRAFT_ENVIRONMENT against server-scoped locks), why --configuration= defeats isolation, fail-closed DB guards, installing the plugin under test, timezone pinning, per-test site fixtures, idempotent Install migrations, stale service caches, audit sinks, queue stubs, factories, HTTP/DB assertions, CI jobs.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
- Runs shell scripts(see the files on GitHub)
- Asks for: Bash(sh ${CLAUDE_SKILL_DIR}/scripts/craft-version.sh)(see the files on GitHub)
- No network calls found in its scripts(see the files on GitHub)
- License: MIT(see the files on GitHub)
From a static check of its 7 files (96 KB) on GitHub on 3 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the craftcms-claude-skills plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add michtio/craftcms-claude-skills
/plugin install craftcms-claude-skills@craftcms-claude-skillsOr copy only this skill to ~/.claude/skills/craft-pest:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/craft-pest &&
cp -R "$tmp/skills/craft-pest" ~/.claude/skills/craft-pest &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/craft-pest inside it instead.
Copy the skill folder to ~/.agents/skills/craft-pest to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/craft-pest &&
cp -R "$tmp/skills/craft-pest" ~/.agents/skills/craft-pest &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/craft-pest inside it instead.
Copy the skill folder to ~/.cursor/skills/craft-pest to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/craft-pest &&
cp -R "$tmp/skills/craft-pest" ~/.cursor/skills/craft-pest &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/craft-pest inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/michtio/craftcms-claude-skills.git --path skills/craft-pestOr copy the folder to ~/.gemini/skills/craft-pest yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/craft-pest:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/craft-pest &&
cp -R "$tmp/skills/craft-pest" ~/.copilot/skills/craft-pest &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/craft-pest inside it instead.
Get the folder:
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.gitThen copy craftcms-claude-skills/skills/craft-pest into your agent's skills folder as craft-pest. Agents that support SKILL.md read one folder per skill.
What it does
- Database isolation setup
- Covers rollback transactions, forced test database names and fail-closed bootstrap guards so tests cannot write to a live install.
- PHPUnit environment pinning
- Explains which phpunit.xml.dist env entries to set so suites use unique environment locks and table prefixes.
- Craft state handling
- Addresses permission caching, simulated logins, muted audit and event surfaces, and stale service caches.
- Test writing patterns
- Describes factories, HTTP and database assertions, queue stubs, multi-site fixtures and pure unit tests.
- CI job guidance
- Explains how to run a Pest job in CI from the plugin root and verify it against a fresh database.
- Install migration hygiene
- Shows how to make Install migrations idempotent so repeated runs do not accumulate duplicate keys.
Good for
- Set up Pest tests for a new Craft CMS 5 plugin
- Stop a test suite from writing thousands of entries into a dev database
- Fix a test that passes alone but fails when the full suite runs
- Add a Pest job to a plugin's GitHub Actions workflow
- Test a controller action or element factory in a Craft plugin
Craft pest FAQ
What does the skill need to be useful?
It needs a Craft CMS 5 plugin or module that uses Pest with the markhuot/craft-pest-core harness. It reads the Craft version from the project when the script runs.
Why must RefreshesDatabase be bound alongside TestCase?
TestCase alone does not open a transaction, so writes made during tests are committed permanently. RefreshesDatabase is the trait that starts a transaction and rolls it back on teardown.
Where should a plugin's test suite be run from?
From the plugin's own root directory. Running it with a --configuration flag from a shared project root means the plugin's environment pins are not loaded.
Which languages and tools are involved?
The tests are written in PHP with Pest and the craft-pest-core package. The skill's helper script is a shell script run through the Claude Code allowed tools.
How do I install Craft pest in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/craft-pest to use it in all your projects, or to .claude/skills/craft-pest in one project. Or install the craftcms-claude-skills plugin, which includes it: /plugin marketplace add michtio/craftcms-claude-skills, then /plugin install craftcms-claude-skills@craftcms-claude-skills.
Does Craft pest run scripts?
Yes. It runs shell scripts. No network calls were found in its scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Craft pest?
Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.
What are the best alternatives to Craft pest?
The closest alternatives to Craft pest are Craftcms, Testing wp, Craft plugin release, Craft php guidelines and Craft gated build.
Where this comes from
- Description: from the skill's own SKILL.md.
More from michtio/craftcms-claude-skills

Guides an agent through Craft Cloud config, deploys, caching, and Cloud-specific limits
- Open source
- 91 GitHub stars
- Databases

Guides Craft CMS 5 content architecture: sections, entry types, fields, Matrix
- Open source
- 91 GitHub stars
- Developer tools

Deploys and runs Craft CMS on fortrabbit managed PHP hosting with safe git workflows
- Open source
- 91 GitHub stars
- Developer tools

Guides agents writing Craft CMS control panel JavaScript with the Garnish UI toolkit
- Open source
- 91 GitHub stars
- Developer tools

Runs one approved Craft CMS slice through outside builders under locked test gates
- Open source
- 91 GitHub stars
- Developer tools

Guides setting up and extending Craft CMS 5.12+ MCP servers and OAuth access
- Open source
- 91 GitHub stars
- Developer tools


