craft-pest

craft-pest is a skill for Claude Code from michtio/craftcms-claude-skills. It costs 353 tokens per session (3,263 once invoked), scanned A, original, MIT.

A testing guide for Craft CMS 5 plugins and modules using Pest, a PHP testing framework, and a Craft-specific test harness. It focuses on isolated tests and safe handling of database changes.

In plain words
What is it for?
Use it when writing, running, fixing, or reviewing tests for a Craft plugin or module, especially when tests use a database or a real Craft installation.
Why use it?
It helps prevent tests from changing a real Craft installation or passing only because of leftover data. The guidance puts test setup and isolation before assertions.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the craftcms-claude-skills plugin — 13 skills, 6 agents shipped together

Good fit Use it when writing, running, fixing, or reviewing tests for a Craft plugin or module, especially when tests use a database or a real Craft installation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/michtio/craftcms-claude-skills/craft-pest
Install

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.

Any agent
npx skills add michtio/craftcms-claude-skills --skill craft-pest
Clone the repo
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills

Made for: Claude Code.

Or install craftcms-claude-skills, the plugin that ships this one along with the rest of its 13 skills, 6 agents.

Wrote 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.

agentmods badge for craft-pest

README.md
[![agentmods](https://agentmods.dev/badge/skills/michtio/craftcms-claude-skills/craft-pest/github.svg)](https://agentmods.dev/skills/michtio/craftcms-claude-skills/craft-pest)
Your own site
<a href="https://agentmods.dev/skills/michtio/craftcms-claude-skills/craft-pest"><img src="https://agentmods.dev/badge/skills/michtio/craftcms-claude-skills/craft-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.

agentmods 80×15 button for craft-pest

Your own site · 80×15
<a href="https://agentmods.dev/skills/michtio/craftcms-claude-skills/craft-pest"><img src="https://agentmods.dev/badge/skills/michtio/craftcms-claude-skills/craft-pest.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 353 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,263 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00353 $0.03263
Opus 5 $0.00177 $0.01631
Sonnet 5 $0.00071 $0.00653
Haiku 4.5 $0.00035 $0.00326

Measured 12d ago against content hash 3ddec5e35a37, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

craft-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 12d 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.

skills/craft-pest/SKILL.md · 165 lines

How it starts

The opening of the file, as written. The whole thing — 165 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Testing Craft CMS Plugins with Pest

Reference for testing Craft CMS 5 plugins and modules with Pest, primarily via markhuot/craft-pest-core.

The dominant failure mode in Craft plugin testing is not a wrong assertion — it's a suite that writes to a database it shouldn't, or that passes only because of ambient state on the developer's install. Both are silent. Both look like a green suite. This skill leads with isolation for that reason: get the harness right first, then write tests.

Verified against markhuot/craft-pest-core 3.2.2 and craftcms/cms 5.10.12 (August 2026). Where a claim names a class or method, it was read in that package's source. craft-pest's own README and docs are not authoritative on these points — several of the behaviors below are unstated there.

Companion Skills — Load When Needed

  • craftcms — Plugin/module architecture, elements, controllers, events, project config. Load when the code under test is being written or changed, not just exercised.
  • craft-php-guidelines — PHP standards for the test files themselves (PHPDocs, naming, ECS).
  • ddev — Every command runs through DDEV. Load for the correct invocation of a plugin's own suite inside a host project (ddev exec --dir …).

Documentation

Use WebFetch for specific pages, but prefer reading vendor/markhuot/craft-pest-core/src/ when the question is "what does it actually do."

The Two Non-Negotiables

Everything else in this skill is technique. These two are the ones that cause data loss.

1. Rollback is opt-in — TestCase alone commits everything

markhuot\craftpest\test\TestCase boots Craft and mixes in ~15 traits (ActingAs, RequestBuilders, DatabaseAssertions, Queues, …). RefreshesDatabase is not one of them. Only that trait opens a transaction (setUpRefreshesDatabase()beginTransaction()) and rolls it back on teardown.

Read the full file on GitHub · 165 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

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.

  1. 12d ago First seen · 165 lines · 353 tokens per session scan A 3ddec5e35a37

Subscribe to this mod's changes

craft-pest is a skill published in the GitHub repository michtio/craftcms-claude-skills (78 stars, last pushed 10d ago), licensed MIT. It adds 353 tokens to every session and 3,263 once invoked, about $0.0018 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-08-30.

Related

Other skills, from other repositories

php-testing

Use when writing/configuring tests on a non-Laravel PHP project — PHPUnit vs Pest. Do NOT use for Laravel test helpers or quality tooling (php-quality-tooling).

fusengine/agents · 38 tokens

phx-verify

Verify Elixir/Phoenix changes — compile, format, and test in one loop. Use after implementation, before PRs, or after fixing bugs.

oliver-kriska/claude-elixir-phoenix · 36 tokens

111-java-maven-dependencies

Use when you need to add or evaluate Maven dependencies that improve code quality or domain modeling — including nullness annotations (JSpecify), static analysis (Error Prone + NullAway), functional programming (VAVR), architecture testing (ArchUnit), or money and currency support (JavaMoney) — and want a…

jabrena/plinth · 133 tokens

130-java-testing-strategies

Use when you need to apply testing strategies for Java code — RIGHT-BICEP to guide test creation, A-TRIP for test quality characteristics, or CORRECT for verifying boundary conditions. This should trigger for requests such as Review Java code for testing strategies; Apply RIGHT-BICEP testing strategies in Java code…

jabrena/plinth · 96 tokens

131-java-testing-unit-testing

Use when you need to review, improve, or write Java unit tests — including migrating from JUnit 4 to JUnit 5, adopting AssertJ for fluent assertions, structuring tests with Given-When-Then, ensuring test independence, applying parameterized tests, mocking dependencies with Mockito, verifying boundary conditions…

jabrena/plinth · 160 tokens

421-frameworks-quarkus-testing-unit-tests

Use when you need to write fast unit tests for Quarkus applications — including pure tests with @ExtendWith(MockitoExtension.class), @QuarkusTest with @InjectMock for full CDI mock replacement, @InjectSpy for partial CDI bean mocking, REST Assured for resource-focused tests, @ParameterizedTest with @CsvSource /…

jabrena/plinth · 205 tokens