
Perl Testing
Install when you develop Perl modules or apps and want Test2::V0 or Test::More suites, prove workflows, mocks, and TDD red-green-refactor.
Overview
perl-testing is an agent skill most often used in Ship (also Build) that teaches Perl TDD with Test2::V0, Test::More, prove, mocking, and coverage workflows.
Install
npx skills add https://github.com/affaan-m/everything-claude-code --skill perl-testingWhat is this skill?
- RED-GREEN-REFACTOR TDD cycle with concrete Calculator-style walkthrough
- Test2::V0 subtests and modern assertions alongside Test::More fundamentals
- prove runner usage (`prove -lv`) for local and CI-style execution
- Mocking strategies and Devel::Cover for coverage visibility
- Migration and review guidance from Test::More-heavy suites toward Test2::V0
Adoption & trust: 4k installs on skills.sh; 210k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You ship Perl changes without a consistent test layout, or your prove runs fail and you lack a TDD structure to fix them safely.
Who is it for?
Indie Perl authors maintaining lib/ + t/ trees who want prove-friendly suites and coverage habits before merging or deploying.
Skip if: Projects with zero Perl footprint or teams that only run manual QA with no automated harness.
When should I use this skill?
Writing new Perl code with TDD, designing test suites, reviewing coverage, setting up testing infrastructure, migrating Test::More to Test2::V0, or debugging failing Perl tests.
What do I get? / Deliverables
After the skill runs, you get organized `.t` files, assertion patterns, and a red-green-refactor loop agents can repeat on every Perl change.
- `.t` test files with planned or done_testing
- Minimal module implementation matching green tests
- prove command and optional Devel::Cover run instructions
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Automated tests are the canonical Ship gate, though TDD starts as soon as you write Perl in Build. Focus is test harness design, assertions, coverage, and failure debugging—not security or release tagging.
Where it fits
Start a new Moo module with a failing Test2::V0 subtest before implementing the method.
Run prove across t/unit and t/integration before tagging a CPAN or internal release.
Reproduce a regression with a focused .t file after a production bug in Perl business logic.
How it compares
Skill-guided Perl testing patterns, not a generic Jest playbook that ignores prove and Test2::V0 idioms.
Common Questions / FAQ
Who is perl-testing for?
Solo builders and small teams writing or extending Perl modules, CLIs, or web backends who need repeatable unit tests.
When should I use perl-testing?
In Build when implementing features with TDD, and in Ship before release—writing suites, raising coverage with Devel::Cover, or debugging failing prove output.
Is perl-testing safe to install?
It describes test patterns only; review the Security Audits panel on this Prism page and treat test code like production code when it touches fixtures or external services.
SKILL.md
READMESKILL.md - Perl Testing
# Perl Testing Patterns Comprehensive testing strategies for Perl applications using Test2::V0, Test::More, prove, and TDD methodology. ## When to Activate - Writing new Perl code (follow TDD: red, green, refactor) - Designing test suites for Perl modules or applications - Reviewing Perl test coverage - Setting up Perl testing infrastructure - Migrating tests from Test::More to Test2::V0 - Debugging failing Perl tests ## TDD Workflow Always follow the RED-GREEN-REFACTOR cycle. ```perl # Step 1: RED — Write a failing test # t/unit/calculator.t use v5.36; use Test2::V0; use lib 'lib'; use Calculator; subtest 'addition' => sub { my $calc = Calculator->new; is($calc->add(2, 3), 5, 'adds two numbers'); is($calc->add(-1, 1), 0, 'handles negatives'); }; done_testing; # Step 2: GREEN — Write minimal implementation # lib/Calculator.pm package Calculator; use v5.36; use Moo; sub add($self, $a, $b) { return $a + $b; } 1; # Step 3: REFACTOR — Improve while tests stay green # Run: prove -lv t/unit/calculator.t ``` ## Test::More Fundamentals The standard Perl testing module — widely used, ships with core. ### Basic Assertions ```perl use v5.36; use Test::More; # Plan upfront or use done_testing # plan tests => 5; # Fixed plan (optional) # Equality is($result, 42, 'returns correct value'); isnt($result, 0, 'not zero'); # Boolean ok($user->is_active, 'user is active'); ok(!$user->is_banned, 'user is not banned'); # Deep comparison is_deeply( $got, { name => 'Alice', roles => ['admin'] }, 'returns expected structure' ); # Pattern matching like($error, qr/not found/i, 'error mentions not found'); unlike($output, qr/password/, 'output hides password'); # Type check isa_ok($obj, 'MyApp::User'); can_ok($obj, 'save', 'delete'); done_testing; ``` ### SKIP and TODO ```perl use v5.36; use Test::More; # Skip tests conditionally SKIP: { skip 'No database configured', 2 unless $ENV{TEST_DB}; my $db = connect_db(); ok($db->ping, 'database is reachable'); is($db->version, '15', 'correct PostgreSQL version'); } # Mark expected failures TODO: { local $TODO = 'Caching not yet implemented'; is($cache->get('key'), 'value', 'cache returns value'); } done_testing; ``` ## Test2::V0 Modern Framework Test2::V0 is the modern replacement for Test::More — richer assertions, better diagnostics, and extensible. ### Why Test2? - Superior deep comparison with hash/array builders - Better diagnostic output on failures - Subtests with cleaner scoping - Extensible via Test2::Tools::* plugins - Backward-compatible with Test::More tests ### Deep Comparison with Builders ```perl use v5.36; use Test2::V0; # Hash builder — check partial structure is( $user->to_hash, hash { field name => 'Alice'; field email => match(qr/\@example\.com$/); field age => validator(sub { $_ >= 18 }); # Ignore other fields etc(); }, 'user has expected fields' ); # Array builder is( $result, array { item 'first'; item match(qr/^second/); item DNE(); # Does Not Exist — verify no extra items }, 'result matches expected list' ); # Bag — order-independent comparison is( $tags, bag { item 'perl'; item 'testing'; item 'tdd'; }, 'has all required tags regardless of order' ); ``` ### Subtests ```perl use v5.36; use Test2::V0; subtest 'User creation' => sub { my $user = User->new(name => 'Alice', email => 'alice@example.com'); ok($user, 'user object created'); is($user->name, 'Alice', 'name is set'); is($user->email, 'alice@example.com', 'email is set'); }; subtest 'User validation' => sub { my $warnings = warns { User->new(name => '', email => 'bad'); }; ok($warnings, 'war