[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AQ8YJRWSRSFQYGFGHPY61V":3,"skill-same:01M7AQ8YJRWSRSFQYGFGHPY61V":49},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":32,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M7AQ8YJRWSRSFQYGFGHPY61V","perl-testing",null,"Perl testing patterns using Test2::V0, Test::More, prove runner, mocking, coverage with Devel::Cover, and TDD methodology. Use when writing Perl tests with Test2::V0 or Test::More, or measuring coverage.","Cyrilthetecchieee\u002Fcyril-code-","Cyrilthetecchieee","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F219787998?v=4","01M7AF0MMMKRAA0H61XMJPV92H","Julian Cyril D ","01M7AF0MQ10AVG6QJQ1C2BC0F5",2,"MIT","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fskills\u002Fperl-testing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: perl-testing\ndescription: Perl testing patterns using Test2::V0, Test::More, prove runner, mocking, coverage with Devel::Cover, and TDD methodology. Use when writing Perl tests with Test2::V0 or Test::More, or measuring coverage.\nmetadata:\n  origin: ECC\n---\n\n# Perl Testing Patterns\n\nComprehensive testing strategies for Perl applications using Test2::V0, Test::More, prove, and TDD methodology.\n\n## When to Activate\n\n- Writing new Perl code (follow TDD: red, green, refactor)\n- Designing test suites for Perl modules or applications\n- Reviewing Perl test coverage\n- Setting up Perl testing infrastructure\n- Migrating tests from Test::More to Test2::V0\n- Debugging failing Perl tests\n\n## TDD Workflow\n\nAlways follow the RED-GREEN-REFACTOR cycle.\n\n```perl\n# Step 1: RED — Write a failing test\n# t\u002Funit\u002Fcalculator.t\nuse v5.36;\nuse Test2::V0;\n\nuse lib 'lib';\nuse Calculator;\n\nsubtest 'addition' => sub {\n    my $calc = Calculator->new;\n    is($calc->add(2, 3), 5, 'adds two numbers');\n    is($calc->add(-1, 1), 0, 'handles negatives');\n};\n\ndone_testing;\n\n# Step 2: GREEN — Write minimal implementation\n# lib\u002FCalculator.pm\npackage Calculator;\nuse v5.36;\nuse Moo;\n\nsub add($self, $a, $b) {\n    return $a + $b;\n}\n\n1;\n\n# Step 3: REFACTOR — Improve while tests stay green\n# Run: prove -lv t\u002Funit\u002Fcalculator.t\n```\n\n## Test::More Fundamentals\n\nThe standard Perl testing module — widely used, ships with core.\n\n### Basic Assertions\n\n```perl\nuse v5.36;\nuse Test::More;\n\n# Plan upfront or use done_testing\n# plan tests => 5;  # Fixed plan (optional)\n\n# Equality\nis($result, 42, 'returns correct value');\nisnt($result, 0, 'not zero');\n\n# Boolean\nok($user->is_active, 'user is active');\nok(!$user->is_banned, 'user is not banned');\n\n# Deep comparison\nis_deeply(\n    $got,\n    { name => 'Alice', roles => ['admin'] },\n    'returns expected structure'\n);\n\n# Pattern matching\nlike($error, qr\u002Fnot found\u002Fi, 'error mentions not found');\nunlike($output, qr\u002Fpassword\u002F, 'output hides password');\n\n# Type check\nisa_ok($obj, 'MyApp::User');\ncan_ok($obj, 'save', 'delete');\n\ndone_testing;\n```\n\n### SKIP and TODO\n\n```perl\nuse v5.36;\nuse Test::More;\n\n# Skip tests conditionally\nSKIP: {\n    skip 'No database configured', 2 unless $ENV{TEST_DB};\n\n    my $db = connect_db();\n    ok($db->ping, 'database is reachable');\n    is($db->version, '15', 'correct PostgreSQL version');\n}\n\n# Mark expected failures\nTODO: {\n    local $TODO = 'Caching not yet implemented';\n    is($cache->get('key'), 'value', 'cache returns value');\n}\n\ndone_testing;\n```\n\n## Test2::V0 Modern Framework\n\nTest2::V0 is the modern replacement for Test::More — richer assertions, better diagnostics, and extensible.\n\n### Why Test2?\n\n- Superior deep comparison with hash\u002Farray builders\n- Better diagnostic output on failures\n- Subtests with cleaner scoping\n- Extensible via Test2::Tools::* plugins\n- Backward-compatible with Test::More tests\n\n### Deep Comparison with Builders\n\n```perl\nuse v5.36;\nuse Test2::V0;\n\n# Hash builder — check partial structure\nis(\n    $user->to_hash,\n    hash {\n        field name  => 'Alice';\n        field email => match(qr\u002F\\@example\\.com$\u002F);\n        field age   => validator(sub { $_ >= 18 });\n        # Ignore other fields\n        etc();\n    },\n    'user has expected fields'\n);\n\n# Array builder\nis(\n    $result,\n    array {\n        item 'first';\n        item match(qr\u002F^second\u002F);\n        item DNE();  # Does Not Exist — verify no extra items\n    },\n    'result matches expected list'\n);\n\n# Bag — order-independent comparison\nis(\n    $tags,\n    bag {\n        item 'perl';\n        item 'testing';\n        item 'tdd';\n    },\n    'has all required tags regardless of order'\n);\n```\n\n### Subtests\n\n```perl\nuse v5.36;\nuse Test2::V0;\n\nsubtest 'User creation' => sub {\n    my $user = User->new(name => 'Alice', email => 'alice@example.com');\n    ok($user, 'user object created');\n    is($user->name, 'Alice', 'name is set');\n    is($user->email, 'alice@example.com', 'email is set');\n};\n\nsubtest 'User validation' => sub {\n    my $warnings = warns {\n        User->new(name => '', email => 'bad');\n    };\n    ok($warnings, 'warns on invalid data');\n};\n\ndone_testing;\n```\n\n### Exception Testing with Test2\n\n```perl\nuse v5.36;\nuse Test2::V0;\n\n# Test that code dies\nlike(\n    dies { divide(10, 0) },\n    qr\u002FDivision by zero\u002F,\n    'dies on division by zero'\n);\n\n# Test that code lives\nok(lives { divide(10, 2) }, 'division succeeds') or note($@);\n\n# Combined pattern\nsubtest 'error handling' => sub {\n    ok(lives { parse_config('valid.json') }, 'valid config parses');\n    like(\n        dies { parse_config('missing.json') },\n        qr\u002FCannot open\u002F,\n        'missing file dies with message'\n    );\n};\n\ndone_testing;\n```\n\n## Test Organization and prove\n\n### Directory Structure\n\n```text\nt\u002F\n├── 00-load.t              # Verify modules compile\n├── 01-basic.t             # Core functionality\n├── unit\u002F\n│   ├── config.t           # Unit tests by module\n│   ├── user.t\n│   └── util.t\n├── integration\u002F\n│   ├── database.t\n│   └── api.t\n├── lib\u002F\n│   └── TestHelper.pm      # Shared test utilities\n└── fixtures\u002F\n    ├── config.json        # Test data files\n    └── users.csv\n```\n\n### prove Commands\n\n```bash\n# Run all tests\nprove -l t\u002F\n\n# Verbose output\nprove -lv t\u002F\n\n# Run specific test\nprove -lv t\u002Funit\u002Fuser.t\n\n# Recursive search\nprove -lr t\u002F\n\n# Parallel execution (8 jobs)\nprove -lr -j8 t\u002F\n\n# Run only failing tests from last run\nprove -l --state=failed t\u002F\n\n# Colored output with timer\nprove -l --color --timer t\u002F\n\n# TAP output for CI\nprove -l --formatter TAP::Formatter::JUnit t\u002F > results.xml\n```\n\n### .proverc Configuration\n\n```text\n-l\n--color\n--timer\n-r\n-j4\n--state=save\n```\n\n## Fixtures and Setup\u002FTeardown\n\n### Subtest Isolation\n\n```perl\nuse v5.36;\nuse Test2::V0;\nuse File::Temp qw(tempdir);\nuse Path::Tiny;\n\nsubtest 'file processing' => sub {\n    # Setup\n    my $dir = tempdir(CLEANUP => 1);\n    my $file = path($dir, 'input.txt');\n    $file->spew_utf8(\"line1\\nline2\\nline3\\n\");\n\n    # Test\n    my $result = process_file(\"$file\");\n    is($result->{line_count}, 3, 'counts lines');\n\n    # Teardown happens automatically (CLEANUP => 1)\n};\n```\n\n### Shared Test Helpers\n\nPlace reusable helpers in `t\u002Flib\u002FTestHelper.pm` and load with `use lib 't\u002Flib'`. Export factory functions like `create_test_db()`, `create_temp_dir()`, and `fixture_path()` via `Exporter`.\n\n## Mocking\n\n### Test::MockModule\n\n```perl\nuse v5.36;\nuse Test2::V0;\nuse Test::MockModule;\n\nsubtest 'mock external API' => sub {\n    my $mock = Test::MockModule->new('MyApp::API');\n\n    # Good: Mock returns controlled data\n    $mock->mock(fetch_user => sub ($self, $id) {\n        return { id => $id, name => 'Mock User', email => 'mock@test.com' };\n    });\n\n    my $api = MyApp::API->new;\n    my $user = $api->fetch_user(42);\n    is($user->{name}, 'Mock User', 'returns mocked user');\n\n    # Verify call count\n    my $call_count = 0;\n    $mock->mock(fetch_user => sub { $call_count++; return {} });\n    $api->fetch_user(1);\n    $api->fetch_user(2);\n    is($call_count, 2, 'fetch_user called twice');\n\n    # Mock is automatically restored when $mock goes out of scope\n};\n\n# Bad: Monkey-patching without restoration\n# *MyApp::API::fetch_user = sub { ... };  # NEVER — leaks across tests\n```\n\nFor lightweight mock objects, use `Test::MockObject` to create injectable test doubles with `->mock()` and verify calls with `->called_ok()`.\n\n## Coverage with Devel::Cover\n\n### Running Coverage\n\n```bash\n# Basic coverage report\ncover -test\n\n# Or step by step\nperl -MDevel::Cover -Ilib t\u002Funit\u002Fuser.t\ncover\n\n# HTML report\ncover -report html\nopen cover_db\u002Fcoverage.html\n\n# Specific thresholds\ncover -test -report text | grep 'Total'\n\n# CI-friendly: fail under threshold\ncover -test && cover -report text -select '^lib\u002F' \\\n  | perl -ne 'if (\u002FTotal.*?(\\d+\\.\\d+)\u002F) { exit 1 if $1 \u003C 80 }'\n```\n\n### Integration Testing\n\nUse in-memory SQLite for database tests, mock HTTP::Tiny for API tests.\n\n```perl\nuse v5.36;\nuse Test2::V0;\nuse DBI;\n\nsubtest 'database integration' => sub {\n    my $dbh = DBI->connect('dbi:SQLite:dbname=:memory:', '', '', {\n        RaiseError => 1,\n    });\n    $dbh->do('CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)');\n\n    $dbh->prepare('INSERT INTO users (name) VALUES (?)')->execute('Alice');\n    my $row = $dbh->selectrow_hashref('SELECT * FROM users WHERE name = ?', undef, 'Alice');\n    is($row->{name}, 'Alice', 'inserted and retrieved user');\n};\n\ndone_testing;\n```\n\n## Best Practices\n\n### DO\n\n- **Follow TDD**: Write tests before implementation (red-green-refactor)\n- **Use Test2::V0**: Modern assertions, better diagnostics\n- **Use subtests**: Group related assertions, isolate state\n- **Mock external dependencies**: Network, database, file system\n- **Use `prove -l`**: Always include lib\u002F in `@INC`\n- **Name tests clearly**: `'user login with invalid password fails'`\n- **Test edge cases**: Empty strings, undef, zero, boundary values\n- **Aim for 80%+ coverage**: Focus on business logic paths\n- **Keep tests fast**: Mock I\u002FO, use in-memory databases\n\n### DON'T\n\n- **Don't test implementation**: Test behavior and output, not internals\n- **Don't share state between subtests**: Each subtest should be independent\n- **Don't skip `done_testing`**: Ensures all planned tests ran\n- **Don't over-mock**: Mock boundaries only, not the code under test\n- **Don't use `Test::More` for new projects**: Prefer Test2::V0\n- **Don't ignore test failures**: All tests must pass before merge\n- **Don't test CPAN modules**: Trust libraries to work correctly\n- **Don't write brittle tests**: Avoid over-specific string matching\n\n## Quick Reference\n\n| Task | Command \u002F Pattern |\n|---|---|\n| Run all tests | `prove -lr t\u002F` |\n| Run one test verbose | `prove -lv t\u002Funit\u002Fuser.t` |\n| Parallel test run | `prove -lr -j8 t\u002F` |\n| Coverage report | `cover -test && cover -report html` |\n| Test equality | `is($got, $expected, 'label')` |\n| Deep comparison | `is($got, hash { field k => 'v'; etc() }, 'label')` |\n| Test exception | `like(dies { ... }, qr\u002Fmsg\u002F, 'label')` |\n| Test no exception | `ok(lives { ... }, 'label')` |\n| Mock a method | `Test::MockModule->new('Pkg')->mock(m => sub { ... })` |\n| Skip tests | `SKIP: { skip 'reason', $count unless $cond; ... }` |\n| TODO tests | `TODO: { local $TODO = 'reason'; ... }` |\n\n## Common Pitfalls\n\n### Forgetting `done_testing`\n\n```perl\n# Bad: Test file runs but doesn't verify all tests executed\nuse Test2::V0;\nis(1, 1, 'works');\n# Missing done_testing — silent bugs if test code is skipped\n\n# Good: Always end with done_testing\nuse Test2::V0;\nis(1, 1, 'works');\ndone_testing;\n```\n\n### Missing `-l` Flag\n\n```bash\n# Bad: Modules in lib\u002F not found\nprove t\u002Funit\u002Fuser.t\n# Can't locate MyApp\u002FUser.pm in @INC\n\n# Good: Include lib\u002F in @INC\nprove -l t\u002Funit\u002Fuser.t\n```\n\n### Over-Mocking\n\nMock the *dependency*, not the code under test. If your test only verifies that a mock returns what you told it to, it tests nothing.\n\n### Test Pollution\n\nUse `my` variables inside subtests — never `our` — to prevent state leaking between tests.\n\n**Remember**: Tests are your safety net. Keep them fast, focused, and independent. Use Test2::V0 for new projects, prove for running, and Devel::Cover for accountability.\n","# Perl Testing Patterns\n\nComprehensive testing strategies for Perl applications using Test2::V0, Test::More, prove, and TDD methodology.\n\n## When to Activate\n\n- Writing new Perl code (follow TDD: red, green, refactor)\n- Designing test suites for Perl modules or applications\n- Reviewing Perl test coverage\n- Setting up Perl testing infrastructure\n- Migrating tests from Test::More to Test2::V0\n- Debugging failing Perl tests\n\n## TDD Workflow\n\nAlways follow the RED-GREEN-REFACTOR cycle.\n\n```perl\n# Step 1: RED — Write a failing test\n# t\u002Funit\u002Fcalculator.t\nuse v5.36;\nuse Test2::V0;\n\nuse lib 'lib';\nuse Calculator;\n\nsubtest 'addition' => sub {\n    my $calc = Calculator->new;\n    is($calc->add(2, 3), 5, 'adds two numbers');\n    is($calc->add(-1, 1), 0, 'handles negatives');\n};\n\ndone_testing;\n\n# Step 2: GREEN — Write minimal implementation\n# lib\u002FCalculator.pm\npackage Calculator;\nuse v5.36;\nuse Moo;\n\nsub add($self, $a, $b) {\n    return $a + $b;\n}\n\n1;\n\n# Step 3: REFACTOR — Improve while tests stay green\n# Run: prove -lv t\u002Funit\u002Fcalculator.t\n```\n\n## Test::More Fundamentals\n\nThe standard Perl testing module — widely used, ships with core.\n\n### Basic Assertions\n\n```perl\nuse v5.36;\nuse Test::More;\n\n# Plan upfront or use done_testing\n# plan tests => 5;  # Fixed plan (optional)\n\n# Equality\nis($result, 42, 'returns correct value');\nisnt($result, 0, 'not zero');\n\n# Boolean\nok($user->is_active, 'user is active');\nok(!$user->is_banned, 'user is not banned');\n\n# Deep comparison\nis_deeply(\n    $got,\n    { name => 'Alice', roles => ['admin'] },\n    'returns expected structure'\n);\n\n# Pattern matching\nlike($error, qr\u002Fnot found\u002Fi, 'error mentions not found');\nunlike($output, qr\u002Fpassword\u002F, 'output hides password');\n\n# Type check\nisa_ok($obj, 'MyApp::User');\ncan_ok($obj, 'save', 'delete');\n\ndone_testing;\n```\n\n### SKIP and TODO\n\n```perl\nuse v5.36;\nuse Test::More;\n\n# Skip tests conditionally\nSKIP: {\n    skip 'No database configured', 2 unless $ENV{TEST_DB};\n\n    my $db = connect_db();\n    ok($db->ping, 'database is reachable');\n    is($db->version, '15', 'correct PostgreSQL version');\n}\n\n# Mark expected failures\nTODO: {\n    local $TODO = 'Caching not yet implemented';\n    is($cache->get('key'), 'value', 'cache returns value');\n}\n\ndone_testing;\n```\n\n## Test2::V0 Modern Framework\n\nTest2::V0 is the modern replacement for Test::More — richer assertions, better diagnostics, and extensible.\n\n### Why Test2?\n\n- Superior deep comparison with hash\u002Farray builders\n- Better diagnostic output on failures\n- Subtests with cleaner scoping\n- Extensible via Test2::Tools::* plugins\n- Backward-compatible with Test::More tests\n\n### Deep Comparison with Builders\n\n```perl\nuse v5.36;\nuse Test2::V0;\n\n# Hash builder — check partial structure\nis(\n    $user->to_hash,\n    hash {\n        field name  => 'Alice';\n        field email => match(qr\u002F\\@example\\.com$\u002F);\n        field age   => validator(sub { $_ >= 18 });\n        # Ignore other fields\n        etc();\n    },\n    'user has expected fields'\n);\n\n# Array builder\nis(\n    $result,\n    array {\n        item 'first';\n        item match(qr\u002F^second\u002F);\n        item DNE();  # Does Not Exist — verify no extra items\n    },\n    'result matches expected list'\n);\n\n# Bag — order-independent comparison\nis(\n    $tags,\n    bag {\n        item 'perl';\n        item 'testing';\n        item 'tdd';\n    },\n    'has all required tags regardless of order'\n);\n```\n\n### Subtests\n\n```perl\nuse v5.36;\nuse Test2::V0;\n\nsubtest 'User creation' => sub {\n    my $user = User->new(name => 'Alice', email => 'alice@example.com');\n    ok($user, 'user object created');\n    is($user->name, 'Alice', 'name is set');\n    is($user->email, 'alice@example.com', 'email is set');\n};\n\nsubtest 'User validation' => sub {\n    my $warnings = warns {\n        User->new(name => '', email => 'bad');\n    };\n    ok($warnings, 'warns on invalid data');\n};\n\ndone_testing;\n```\n\n### Exception Testing with Test2\n\n```perl\nuse v5.36;\nuse Test2::V0;\n\n# Test that code dies\nlike(\n    dies { divide(10, 0) },\n    qr\u002FDivision by zero\u002F,\n    'dies on division by zero'\n);\n\n# Test that code lives\nok(lives { divide(10, 2) }, 'division succeeds') or note($@);\n\n# Combined pattern\nsubtest 'error handling' => sub {\n    ok(lives { parse_config('valid.json') }, 'valid config parses');\n    like(\n        dies { parse_config('missing.json') },\n        qr\u002FCannot open\u002F,\n        'missing file dies with message'\n    );\n};\n\ndone_testing;\n```\n\n## Test Organization and prove\n\n### Directory Structure\n\n```text\nt\u002F\n├── 00-load.t              # Verify modules compile\n├── 01-basic.t             # Core functionality\n├── unit\u002F\n│   ├── config.t           # Unit tests by module\n│   ├── user.t\n│   └── util.t\n├── integration\u002F\n│   ├── database.t\n│   └── api.t\n├── lib\u002F\n│   └── TestHelper.pm      # Shared test utilities\n└── fixtures\u002F\n    ├── config.json        # Test data files\n    └── users.csv\n```\n\n### prove Commands\n\n```bash\n# Run all tests\nprove -l t\u002F\n\n# Verbose output\nprove -lv t\u002F\n\n# Run specific test\nprove -lv t\u002Funit\u002Fuser.t\n\n# Recursive search\nprove -lr t\u002F\n\n# Parallel execution (8 jobs)\nprove -lr -j8 t\u002F\n\n# Run only failing tests from last run\nprove -l --state=failed t\u002F\n\n# Colored output with timer\nprove -l --color --timer t\u002F\n\n# TAP output for CI\nprove -l --formatter TAP::Formatter::JUnit t\u002F > results.xml\n```\n\n### .proverc Configuration\n\n```text\n-l\n--color\n--timer\n-r\n-j4\n--state=save\n```\n\n## Fixtures and Setup\u002FTeardown\n\n### Subtest Isolation\n\n```perl\nuse v5.36;\nuse Test2::V0;\nuse File::Temp qw(tempdir);\nuse Path::Tiny;\n\nsubtest 'file processing' => sub {\n    # Setup\n    my $dir = tempdir(CLEANUP => 1);\n    my $file = path($dir, 'input.txt');\n    $file->spew_utf8(\"line1\\nline2\\nline3\\n\");\n\n    # Test\n    my $result = process_file(\"$file\");\n    is($result->{line_count}, 3, 'counts lines');\n\n    # Teardown happens automatically (CLEANUP => 1)\n};\n```\n\n### Shared Test Helpers\n\nPlace reusable helpers in `t\u002Flib\u002FTestHelper.pm` and load with `use lib 't\u002Flib'`. Export factory functions like `create_test_db()`, `create_temp_dir()`, and `fixture_path()` via `Exporter`.\n\n## Mocking\n\n### Test::MockModule\n\n```perl\nuse v5.36;\nuse Test2::V0;\nuse Test::MockModule;\n\nsubtest 'mock external API' => sub {\n    my $mock = Test::MockModule->new('MyApp::API');\n\n    # Good: Mock returns controlled data\n    $mock->mock(fetch_user => sub ($self, $id) {\n        return { id => $id, name => 'Mock User', email => 'mock@test.com' };\n    });\n\n    my $api = MyApp::API->new;\n    my $user = $api->fetch_user(42);\n    is($user->{name}, 'Mock User', 'returns mocked user');\n\n    # Verify call count\n    my $call_count = 0;\n    $mock->mock(fetch_user => sub { $call_count++; return {} });\n    $api->fetch_user(1);\n    $api->fetch_user(2);\n    is($call_count, 2, 'fetch_user called twice');\n\n    # Mock is automatically restored when $mock goes out of scope\n};\n\n# Bad: Monkey-patching without restoration\n# *MyApp::API::fetch_user = sub { ... };  # NEVER — leaks across tests\n```\n\nFor lightweight mock objects, use `Test::MockObject` to create injectable test doubles with `->mock()` and verify calls with `->called_ok()`.\n\n## Coverage with Devel::Cover\n\n### Running Coverage\n\n```bash\n# Basic coverage report\ncover -test\n\n# Or step by step\nperl -MDevel::Cover -Ilib t\u002Funit\u002Fuser.t\ncover\n\n# HTML report\ncover -report html\nopen cover_db\u002Fcoverage.html\n\n# Specific thresholds\ncover -test -report text | grep 'Total'\n\n# CI-friendly: fail under threshold\ncover -test && cover -report text -select '^lib\u002F' \\\n  | perl -ne 'if (\u002FTotal.*?(\\d+\\.\\d+)\u002F) { exit 1 if $1 \u003C 80 }'\n```\n\n### Integration Testing\n\nUse in-memory SQLite for database tests, mock HTTP::Tiny for API tests.\n\n```perl\nuse v5.36;\nuse Test2::V0;\nuse DBI;\n\nsubtest 'database integration' => sub {\n    my $dbh = DBI->connect('dbi:SQLite:dbname=:memory:', '', '', {\n        RaiseError => 1,\n    });\n    $dbh->do('CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)');\n\n    $dbh->prepare('INSERT INTO users (name) VALUES (?)')->execute('Alice');\n    my $row = $dbh->selectrow_hashref('SELECT * FROM users WHERE name = ?', undef, 'Alice');\n    is($row->{name}, 'Alice', 'inserted and retrieved user');\n};\n\ndone_testing;\n```\n\n## Best Practices\n\n### DO\n\n- **Follow TDD**: Write tests before implementation (red-green-refactor)\n- **Use Test2::V0**: Modern assertions, better diagnostics\n- **Use subtests**: Group related assertions, isolate state\n- **Mock external dependencies**: Network, database, file system\n- **Use `prove -l`**: Always include lib\u002F in `@INC`\n- **Name tests clearly**: `'user login with invalid password fails'`\n- **Test edge cases**: Empty strings, undef, zero, boundary values\n- **Aim for 80%+ coverage**: Focus on business logic paths\n- **Keep tests fast**: Mock I\u002FO, use in-memory databases\n\n### DON'T\n\n- **Don't test implementation**: Test behavior and output, not internals\n- **Don't share state between subtests**: Each subtest should be independent\n- **Don't skip `done_testing`**: Ensures all planned tests ran\n- **Don't over-mock**: Mock boundaries only, not the code under test\n- **Don't use `Test::More` for new projects**: Prefer Test2::V0\n- **Don't ignore test failures**: All tests must pass before merge\n- **Don't test CPAN modules**: Trust libraries to work correctly\n- **Don't write brittle tests**: Avoid over-specific string matching\n\n## Quick Reference\n\n| Task | Command \u002F Pattern |\n|---|---|\n| Run all tests | `prove -lr t\u002F` |\n| Run one test verbose | `prove -lv t\u002Funit\u002Fuser.t` |\n| Parallel test run | `prove -lr -j8 t\u002F` |\n| Coverage report | `cover -test && cover -report html` |\n| Test equality | `is($got, $expected, 'label')` |\n| Deep comparison | `is($got, hash { field k => 'v'; etc() }, 'label')` |\n| Test exception | `like(dies { ... }, qr\u002Fmsg\u002F, 'label')` |\n| Test no exception | `ok(lives { ... }, 'label')` |\n| Mock a method | `Test::MockModule->new('Pkg')->mock(m => sub { ... })` |\n| Skip tests | `SKIP: { skip 'reason', $count unless $cond; ... }` |\n| TODO tests | `TODO: { local $TODO = 'reason'; ... }` |\n\n## Common Pitfalls\n\n### Forgetting `done_testing`\n\n```perl\n# Bad: Test file runs but doesn't verify all tests executed\nuse Test2::V0;\nis(1, 1, 'works');\n# Missing done_testing — silent bugs if test code is skipped\n\n# Good: Always end with done_testing\nuse Test2::V0;\nis(1, 1, 'works');\ndone_testing;\n```\n\n### Missing `-l` Flag\n\n```bash\n# Bad: Modules in lib\u002F not found\nprove t\u002Funit\u002Fuser.t\n# Can't locate MyApp\u002FUser.pm in @INC\n\n# Good: Include lib\u002F in @INC\nprove -l t\u002Funit\u002Fuser.t\n```\n\n### Over-Mocking\n\nMock the *dependency*, not the code under test. If your test only verifies that a mock returns what you told it to, it tests nothing.\n\n### Test Pollution\n\nUse `my` variables inside subtests — never `our` — to prevent state leaking between tests.\n\n**Remember**: Tests are your safety net. Keep them fast, focused, and independent. Use Test2::V0 for new projects, prove for running, and Devel::Cover for accountability.\n",{"name":5,"metadata":24,"description":7},{"origin":25},"ECC","main","57e7aa6b6e03bce1a7d7862ba9c2ec312f7f19b5","src\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fskills\u002Fperl-testing",0,"https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee","https:\u002F\u002Fwithcyril.me\u002F","Hi, I’m Julian Cyril D, a Computer Science and Business Systems student at PSNACET.\r\nI’m passionate about full-stack development, UI\u002FUX design, and building sma","2026-11-04 23:28:50",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add Cyrilthetecchieee\u002Fcyril-code- --skill perl-testing",{"tool":41,"command":42},"bunx","bunx skills add Cyrilthetecchieee\u002Fcyril-code- --skill perl-testing",{"tool":44,"command":45},"pnpm","pnpm dlx skills add Cyrilthetecchieee\u002Fcyril-code- --skill perl-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fskills\u002Fperl-testing\u002FSKILL.md",true,[],[50,59,66,74,81,88],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":54,"licenseFileUrl":55,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M7AQV6CYX8RMC78420V9WZ62","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7AQV2895N3S1MEX6K76G6G2","youtube-downloader","Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fvideo-downloader\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":54,"licenseFileUrl":70,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7AQTRNX62DNKVZ5GXEHRBKB","theme-factory","Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors\u002Ffonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftheme-factory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftheme-factory\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7AQTNNVHAAN9H6DA8T6ZVE0","template-skill","Replace with description of the skill and when Claude should use it.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftemplate-skill\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7AQTJ3MQ6AKX152MEX2MYCC","tailored-resume-generator","Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftailored-resume-generator\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":54,"licenseFileUrl":92,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M7AQTD7D5MYET2YWG7HG9WM3","slack-gif-creator","Toolkit for creating animated GIFs optimized for Slack, with validators for size constraints and composable animation primitives. This skill applies when users request animated GIFs or emoji animations for Slack from descriptions like \"make me a GIF for Slack of X doing Y\".","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fslack-gif-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fslack-gif-creator\u002FSKILL.md",[],[]]