rewrite-tests-pest — community rewrite-tests-pest, pint-rules, pekral, community, ai agent skill, ide skills, agent automation, AI agent skills, Claude Code, Cursor, Windsurf

v1.0.0
GitHub

About this Skill

Ideal for PHP-centric AI Agents requiring automated test conversion and validation, such as Cursor or AutoGPT, to streamline PHPUnit to PEST syntax transitions. Rewrites existing PHPUnit-style tests to PEST syntax following project testing rules. Use when the user wants to convert tests to PEST, rewrite tests to PEST syntax, or migrate PHPUnit tests to Pest.

pekral pekral
[0]
[0]
Updated: 3/12/2026

Quality Score

Top 5%
23
Excellent
Based on code quality & docs
Installation
SYS Universal Install (Auto-Detect)
> npx killer-skills add pekral/pint-rules/rewrite-tests-pest
Supports 19+ Platforms
Cursor
Windsurf
VS Code
Trae
Claude
OpenClaw
+12 more

Agent Capability Analysis

The rewrite-tests-pest skill by pekral is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance.

Ideal Agent Persona

Ideal for PHP-centric AI Agents requiring automated test conversion and validation, such as Cursor or AutoGPT, to streamline PHPUnit to PEST syntax transitions.

Core Value

Empowers agents to convert PHPUnit test classes to PEST syntax seamlessly, applying standards from .cursor/rules/php/standards.mdc and .cursor/rules/php-testing.mdc, ensuring 100% coverage for changed code without altering production code, leveraging PHP and PHPUnit expertise.

Capabilities Granted for rewrite-tests-pest

Converting legacy PHPUnit tests to PEST for improved maintainability
Automating test validation against project-specific testing rules
Ensuring 100% test coverage for modified codebases

! Prerequisites & Limits

  • Limited to PHPUnit test classes
  • Requires access to .cursor/rules/php/standards.mdc and .cursor/rules/php-testing.mdc
  • Does not modify production code
Project
SKILL.md
4.2 KB
.cursorrules
1.2 KB
package.json
240 B
Ready
UTF-8

# Tags

[No tags]
SKILL.md
Readonly

Rewrite Tests to PEST Syntax

Specialist for converting PHPUnit test classes to PEST syntax. Apply testing rules from .cursor/rules/php/standards.mdc (Testing section) and .cursor/rules/php-testing.mdc. Never modify production code. After rewrite, coverage must be 100% for changed code; add missing tests if needed.

Role: Rewrite tests only. Apply all project test rules. Constraint: Tests only. Never modify production code.


1. Load Rules

  • Read .cursor/rules/php/standards.mdc (focus: Testing, Bug-Fix Workflow, Naming, Structure).
  • Read .cursor/rules/php-testing.mdc (analysis, mocking, asserts, coverage, running tests).

2. Prerequisites

  • Run only if Pest is installed (pestphp/pest in composer.json or vendor/bin/pest exists).
  • If Pest is not installed, do not rewrite; inform the user.

3. PHPUnit → PEST Mapping

PHPUnitPEST
final class FooTest extends TestCaseRemove class; use one or more test files (e.g. tests/FooTest.php or feature-based files).
public function testSomething(): voidtest('something does something', function (): void { ... }); or it('does something', function (): void { ... });
$this->assertSame($a, $b)expect($a)->toBe($b) (or toEqual for loose comparison)
$this->assertTrue($x)expect($x)->toBeTrue()
$this->assertFalse($x)expect($x)->toBeFalse()
$this->assertInstanceOf(Class::class, $x)expect($x)->toBeInstanceOf(Class::class)
$this->assertCount($n, $iterable)expect($iterable)->toHaveCount($n)
$this->assertContains($needle, $haystack)expect($haystack)->toContain($needle)
$this->assertEmpty($x)expect($x)->toBeEmpty()
$this->expectException(Ex::class)expect(fn () => ...)->toThrow(Ex::class) or catch in test and assert
Data provider @dataProvider footest('...', function (mixed $a, mixed $b): void { ... })->with([...]) or dataset('name', [...])
  • Test description: first argument of test('...') or it('...') — human-readable, describes behavior.
  • Use local variables only; no test class properties.
  • Shared setup: use beforeEach() in the same file or in tests/Pest.php if project uses it.
  • Keep helpers in same file or in tests/Pest.php as plain functions if already used elsewhere.

4. Workflow

  1. Identify scope
    Target file(s): PHPUnit test classes (e.g. *Test.php extending TestCase). Optionally one PEST file per original class or one file per feature.

  2. Analyse

    • List all test methods and assertions.
    • Note data providers, setUp/tearDown, and shared state.
    • Check which code is covered (existing coverage report or run coverage for that file).
  3. Rewrite

    • Replace class with test() / it() calls.
    • Convert $this->assert* to expect()->....
    • Convert data providers to ->with() or dataset().
    • Move setUp logic into beforeEach() or into each test; avoid class state.
    • Keep test data in English; keep names descriptive.
  4. Coverage

    • Run tests for changed files.
    • Run coverage (e.g. Clover XML) for the code exercised by those tests.
    • If coverage for changed production code is below 100%, add or adjust tests until 100%.
  5. Cleanup

    • Remove generated coverage artifacts when done.
    • Run project fixers (e.g. composer scripts, PHP CS) if available.
    • Delete obsolete PHPUnit-only boilerplate (e.g. empty class) if the file is now fully PEST.

5. Conventions (from project rules)

  • Arrange–act–assert; error cases first, success last.
  • Mock only external services (e.g. HTTP); use Mockery or framework fakes (e.g. Http::fake()).
  • No tests for abstract/private/protected implementation details; test public behaviour.
  • Final test classes: in PEST there is no class; keep test file and descriptions clear.
  • Data providers via argument (e.g. ->with([...])), not PHPDoc.
  • Run tests only for changed files; check coverage only for changed code.

6. After Rewrite

  • Run tests for the rewritten files.
  • Ensure 100% coverage for any changed production code; add tests if needed.
  • Remove coverage output files.
  • Run fixers if the project defines them.

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is rewrite-tests-pest?

Ideal for PHP-centric AI Agents requiring automated test conversion and validation, such as Cursor or AutoGPT, to streamline PHPUnit to PEST syntax transitions. Rewrites existing PHPUnit-style tests to PEST syntax following project testing rules. Use when the user wants to convert tests to PEST, rewrite tests to PEST syntax, or migrate PHPUnit tests to Pest.

How do I install rewrite-tests-pest?

Run the command: npx killer-skills add pekral/pint-rules/rewrite-tests-pest. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for rewrite-tests-pest?

Key use cases include: Converting legacy PHPUnit tests to PEST for improved maintainability, Automating test validation against project-specific testing rules, Ensuring 100% test coverage for modified codebases.

Which IDEs are compatible with rewrite-tests-pest?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for rewrite-tests-pest?

Limited to PHPUnit test classes. Requires access to .cursor/rules/php/standards.mdc and .cursor/rules/php-testing.mdc. Does not modify production code.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add pekral/pint-rules/rewrite-tests-pest. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use rewrite-tests-pest immediately in the current project.

Related Skills

Looking for an alternative to rewrite-tests-pest or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

Generate customizable widget plugins for the prompts.chat feed system

149.6k
0
Design

linear

Logo of lobehub
lobehub

Linear issue management. MUST USE when: (1) user mentions LOBE-xxx issue IDs (e.g. LOBE-4540), (2) user says linear, linear issue, link linear, (3) creating PRs that reference Linear issues. Provides

73.4k
0
Communication

testing

Logo of lobehub
lobehub

Testing guide using Vitest. Use when writing tests (.test.ts, .test.tsx), fixing failing tests, improving test coverage, or debugging test issues. Triggers on test creation, test debugging, mock setup

73.3k
0
Communication

chat-sdk

Logo of lobehub
lobehub

chat-sdk is a unified TypeScript SDK for building chat bots across multiple platforms, providing a single interface for deploying bot logic.

73.0k
0
Communication