[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M781C3PD37KW0344JJK499CV":3,"skill-same:01M781C3PD37KW0344JJK499CV":60},{"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":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M781C3PD37KW0344JJK499CV","bats-testing-patterns",null,"Master Bash Automated Testing System (Bats) for comprehensive shell script testing. Use when writing tests for shell scripts, CI\u002FCD pipelines, or requiring test-driven development of shell utilities.","filippolmt\u002Fskills","filippolmt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F61194571?v=4","01M7808VK1A8QF8ZXGT2DWTKHS","Filippo Merante Caparrotta","01M7808VKN74HC3EZMK8EV35KS",1,"MIT","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fbats-testing-patterns\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fbats-testing-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bats-testing-patterns\ndescription: Master Bash Automated Testing System (Bats) for comprehensive shell script testing. Use when writing tests for shell scripts, CI\u002FCD pipelines, or requiring test-driven development of shell utilities.\n---\n\n# Bats Testing Patterns\n\nComprehensive guidance for writing comprehensive unit tests for shell scripts using Bats (Bash Automated Testing System), including test patterns, fixtures, and best practices for production-grade shell testing.\n\n## When to Use This Skill\n\n- Writing unit tests for shell scripts\n- Implementing test-driven development (TDD) for scripts\n- Setting up automated testing in CI\u002FCD pipelines\n- Testing edge cases and error conditions\n- Validating behavior across different shell environments\n- Building maintainable test suites for scripts\n- Creating fixtures for complex test scenarios\n- Testing multiple shell dialects (bash, sh, dash)\n\n## Detailed patterns and worked examples\n\nDetailed pattern documentation lives in `references\u002Fdetails.md`. Read that file when the navigation tier above is insufficient.\n\n## Testing Error Conditions\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bats\n\n@test \"Function fails with missing file\" {\n    run my_function \"\u002Fnonexistent\u002Ffile.txt\"\n    [ \"$status\" -ne 0 ]\n    [[ \"$output\" == *\"not found\"* ]]\n}\n\n@test \"Function fails with invalid input\" {\n    run my_function \"\"\n    [ \"$status\" -ne 0 ]\n}\n\n@test \"Function fails with permission denied\" {\n    touch \"$TMPDIR\u002Freadonly.txt\"\n    chmod 000 \"$TMPDIR\u002Freadonly.txt\"\n    run my_function \"$TMPDIR\u002Freadonly.txt\"\n    [ \"$status\" -ne 0 ]\n    chmod 644 \"$TMPDIR\u002Freadonly.txt\"  # Cleanup\n}\n\n@test \"Function provides helpful error message\" {\n    run my_function --invalid-option\n    [ \"$status\" -ne 0 ]\n    [[ \"$output\" == *\"Usage:\"* ]]\n}\n```\n\n### Testing with Dependencies\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bats\n\nsetup() {\n    # Check for required tools\n    if ! command -v jq &>\u002Fdev\u002Fnull; then\n        skip \"jq is not installed\"\n    fi\n\n    export SCRIPT=\"${BATS_TEST_DIRNAME}\u002F..\u002Fbin\u002Fscript.sh\"\n}\n\n@test \"JSON parsing works\" {\n    skip_if ! command -v jq &>\u002Fdev\u002Fnull\n    run my_json_parser '{\"key\": \"value\"}'\n    [ \"$status\" -eq 0 ]\n}\n```\n\n### Testing Shell Compatibility\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bats\n\n@test \"Script works in bash\" {\n    bash \"${BATS_TEST_DIRNAME}\u002F..\u002Fbin\u002Fscript.sh\" arg1\n}\n\n@test \"Script works in sh (POSIX)\" {\n    sh \"${BATS_TEST_DIRNAME}\u002F..\u002Fbin\u002Fscript.sh\" arg1\n}\n\n@test \"Script works in dash\" {\n    if command -v dash &>\u002Fdev\u002Fnull; then\n        dash \"${BATS_TEST_DIRNAME}\u002F..\u002Fbin\u002Fscript.sh\" arg1\n    else\n        skip \"dash not installed\"\n    fi\n}\n```\n\n### Parallel Execution\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bats\n\n@test \"Multiple independent operations\" {\n    run bash -c 'for i in {1..10}; do\n        my_operation \"$i\" &\n    done\n    wait'\n    [ \"$status\" -eq 0 ]\n}\n\n@test \"Concurrent file operations\" {\n    for i in {1..5}; do\n        my_function \"$TMPDIR\u002Ffile$i\" &\n    done\n    wait\n    [ -f \"$TMPDIR\u002Ffile1\" ]\n    [ -f \"$TMPDIR\u002Ffile5\" ]\n}\n```\n\n## Test Helper Pattern\n\n### test_helper.sh\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bash\n\n# Source script under test\nexport SCRIPT_DIR=\"${BATS_TEST_DIRNAME%\u002F*}\u002Fbin\"\n\n# Common test utilities\nassert_file_exists() {\n    if [ ! -f \"$1\" ]; then\n        echo \"Expected file to exist: $1\"\n        return 1\n    fi\n}\n\nassert_file_equals() {\n    local file=\"$1\"\n    local expected=\"$2\"\n\n    if [ ! -f \"$file\" ]; then\n        echo \"File does not exist: $file\"\n        return 1\n    fi\n\n    local actual=$(cat \"$file\")\n    if [ \"$actual\" != \"$expected\" ]; then\n        echo \"File contents do not match\"\n        echo \"Expected: $expected\"\n        echo \"Actual: $actual\"\n        return 1\n    fi\n}\n\n# Create temporary test directory\nsetup_test_dir() {\n    export TEST_DIR=$(mktemp -d)\n}\n\ncleanup_test_dir() {\n    rm -rf \"$TEST_DIR\"\n}\n```\n\n## Integration with CI\u002FCD\n\n### GitHub Actions Workflow\n\n```yaml\nname: Tests\n\non: [push, pull_request]\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions\u002Fcheckout@v3\n\n      - name: Install Bats\n        run: |\n          npm install --global bats\n\n      - name: Run Tests\n        run: |\n          bats tests\u002F*.bats\n\n      - name: Run Tests with Tap Reporter\n        run: |\n          bats tests\u002F*.bats --tap | tee test_output.tap\n```\n\n### Makefile Integration\n\n```makefile\n.PHONY: test test-verbose test-tap\n\ntest:\n\tbats tests\u002F*.bats\n\ntest-verbose:\n\tbats tests\u002F*.bats --verbose\n\ntest-tap:\n\tbats tests\u002F*.bats --tap\n\ntest-parallel:\n\tbats tests\u002F*.bats --parallel 4\n\ncoverage: test\n\t# Optional: Generate coverage reports\n```\n\n## Best Practices\n\n1. **Test one thing per test** - Single responsibility principle\n2. **Use descriptive test names** - Clearly states what is being tested\n3. **Clean up after tests** - Always remove temporary files in teardown\n4. **Test both success and failure paths** - Don't just test happy path\n5. **Mock external dependencies** - Isolate unit under test\n6. **Use fixtures for complex data** - Makes tests more readable\n7. **Run tests in CI\u002FCD** - Catch regressions early\n8. **Test across shell dialects** - Ensure portability\n9. **Keep tests fast** - Run in parallel when possible\n10. **Document complex test setup** - Explain unusual patterns\n","# Bats Testing Patterns\n\nComprehensive guidance for writing comprehensive unit tests for shell scripts using Bats (Bash Automated Testing System), including test patterns, fixtures, and best practices for production-grade shell testing.\n\n## When to Use This Skill\n\n- Writing unit tests for shell scripts\n- Implementing test-driven development (TDD) for scripts\n- Setting up automated testing in CI\u002FCD pipelines\n- Testing edge cases and error conditions\n- Validating behavior across different shell environments\n- Building maintainable test suites for scripts\n- Creating fixtures for complex test scenarios\n- Testing multiple shell dialects (bash, sh, dash)\n\n## Detailed patterns and worked examples\n\nDetailed pattern documentation lives in `references\u002Fdetails.md`. Read that file when the navigation tier above is insufficient.\n\n## Testing Error Conditions\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bats\n\n@test \"Function fails with missing file\" {\n    run my_function \"\u002Fnonexistent\u002Ffile.txt\"\n    [ \"$status\" -ne 0 ]\n    [[ \"$output\" == *\"not found\"* ]]\n}\n\n@test \"Function fails with invalid input\" {\n    run my_function \"\"\n    [ \"$status\" -ne 0 ]\n}\n\n@test \"Function fails with permission denied\" {\n    touch \"$TMPDIR\u002Freadonly.txt\"\n    chmod 000 \"$TMPDIR\u002Freadonly.txt\"\n    run my_function \"$TMPDIR\u002Freadonly.txt\"\n    [ \"$status\" -ne 0 ]\n    chmod 644 \"$TMPDIR\u002Freadonly.txt\"  # Cleanup\n}\n\n@test \"Function provides helpful error message\" {\n    run my_function --invalid-option\n    [ \"$status\" -ne 0 ]\n    [[ \"$output\" == *\"Usage:\"* ]]\n}\n```\n\n### Testing with Dependencies\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bats\n\nsetup() {\n    # Check for required tools\n    if ! command -v jq &>\u002Fdev\u002Fnull; then\n        skip \"jq is not installed\"\n    fi\n\n    export SCRIPT=\"${BATS_TEST_DIRNAME}\u002F..\u002Fbin\u002Fscript.sh\"\n}\n\n@test \"JSON parsing works\" {\n    skip_if ! command -v jq &>\u002Fdev\u002Fnull\n    run my_json_parser '{\"key\": \"value\"}'\n    [ \"$status\" -eq 0 ]\n}\n```\n\n### Testing Shell Compatibility\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bats\n\n@test \"Script works in bash\" {\n    bash \"${BATS_TEST_DIRNAME}\u002F..\u002Fbin\u002Fscript.sh\" arg1\n}\n\n@test \"Script works in sh (POSIX)\" {\n    sh \"${BATS_TEST_DIRNAME}\u002F..\u002Fbin\u002Fscript.sh\" arg1\n}\n\n@test \"Script works in dash\" {\n    if command -v dash &>\u002Fdev\u002Fnull; then\n        dash \"${BATS_TEST_DIRNAME}\u002F..\u002Fbin\u002Fscript.sh\" arg1\n    else\n        skip \"dash not installed\"\n    fi\n}\n```\n\n### Parallel Execution\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bats\n\n@test \"Multiple independent operations\" {\n    run bash -c 'for i in {1..10}; do\n        my_operation \"$i\" &\n    done\n    wait'\n    [ \"$status\" -eq 0 ]\n}\n\n@test \"Concurrent file operations\" {\n    for i in {1..5}; do\n        my_function \"$TMPDIR\u002Ffile$i\" &\n    done\n    wait\n    [ -f \"$TMPDIR\u002Ffile1\" ]\n    [ -f \"$TMPDIR\u002Ffile5\" ]\n}\n```\n\n## Test Helper Pattern\n\n### test_helper.sh\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bash\n\n# Source script under test\nexport SCRIPT_DIR=\"${BATS_TEST_DIRNAME%\u002F*}\u002Fbin\"\n\n# Common test utilities\nassert_file_exists() {\n    if [ ! -f \"$1\" ]; then\n        echo \"Expected file to exist: $1\"\n        return 1\n    fi\n}\n\nassert_file_equals() {\n    local file=\"$1\"\n    local expected=\"$2\"\n\n    if [ ! -f \"$file\" ]; then\n        echo \"File does not exist: $file\"\n        return 1\n    fi\n\n    local actual=$(cat \"$file\")\n    if [ \"$actual\" != \"$expected\" ]; then\n        echo \"File contents do not match\"\n        echo \"Expected: $expected\"\n        echo \"Actual: $actual\"\n        return 1\n    fi\n}\n\n# Create temporary test directory\nsetup_test_dir() {\n    export TEST_DIR=$(mktemp -d)\n}\n\ncleanup_test_dir() {\n    rm -rf \"$TEST_DIR\"\n}\n```\n\n## Integration with CI\u002FCD\n\n### GitHub Actions Workflow\n\n```yaml\nname: Tests\n\non: [push, pull_request]\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions\u002Fcheckout@v3\n\n      - name: Install Bats\n        run: |\n          npm install --global bats\n\n      - name: Run Tests\n        run: |\n          bats tests\u002F*.bats\n\n      - name: Run Tests with Tap Reporter\n        run: |\n          bats tests\u002F*.bats --tap | tee test_output.tap\n```\n\n### Makefile Integration\n\n```makefile\n.PHONY: test test-verbose test-tap\n\ntest:\n\tbats tests\u002F*.bats\n\ntest-verbose:\n\tbats tests\u002F*.bats --verbose\n\ntest-tap:\n\tbats tests\u002F*.bats --tap\n\ntest-parallel:\n\tbats tests\u002F*.bats --parallel 4\n\ncoverage: test\n\t# Optional: Generate coverage reports\n```\n\n## Best Practices\n\n1. **Test one thing per test** - Single responsibility principle\n2. **Use descriptive test names** - Clearly states what is being tested\n3. **Clean up after tests** - Always remove temporary files in teardown\n4. **Test both success and failure paths** - Don't just test happy path\n5. **Mock external dependencies** - Isolate unit under test\n6. **Use fixtures for complex data** - Makes tests more readable\n7. **Run tests in CI\u002FCD** - Catch regressions early\n8. **Test across shell dialects** - Ensure portability\n9. **Keep tests fast** - Run in parallel when possible\n10. **Document complex test setup** - Explain unusual patterns\n",{"name":5,"description":7},"main","e63612d78f9099c1970584ea3faef109f42d20bb","skills\u002Fbats-testing-patterns",0,"https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills","https:\u002F\u002Fgithub.com\u002Ffilippolmt","2026-11-14 22:46:00",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add filippolmt\u002Fskills --skill bats-testing-patterns",{"tool":38,"command":39},"bunx","bunx skills add filippolmt\u002Fskills --skill bats-testing-patterns",{"tool":41,"command":42},"pnpm","pnpm dlx skills add filippolmt\u002Fskills --skill bats-testing-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fbats-testing-patterns\u002FSKILL.md",true,[46,50,56],{"path":47,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":16},"LICENSE","许可证",1068,{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fdetails.md","REFERENCE","参考文档",7275,"https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fbats-testing-patterns\u002Freferences\u002Fdetails.md",{"path":57,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":58,"sourceHtmlUrl":59},"SOURCE.md",430,"https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fbats-testing-patterns\u002FSOURCE.md",[61,69,78,86,94,102],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":65,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":20},"01M781ZJN9KDK0YY8EAQ8WXPRQ","writing-for-agents","Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-for-agents\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-for-agents\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":74,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":20},"01M781ZDZ8CQ30GRY5XNT1RF91","wrangler","Run or troubleshoot Wrangler CLI commands in projects that have a wrangler.jsonc, wrangler.json, or wrangler.toml file, including local development, Previews, deployment, and resource management. For new projects and projects without a Wrangler configuration file, use the cf CLI instead.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwrangler\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwrangler\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":82,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":20},"01M781ZA1MB7E7T1R1TE0BTTJS","workers-profiling","Profile or debug CPU usage and memory allocation in deployed Cloudflare Workers and Durable Objects. Then use this information to optimize your code.","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fworkers-profiling\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fworkers-profiling\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":90,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":20},"01M781Z52Q7PBMDA2YBC3SCTYM","workers-development","Run, inspect, and debug Cloudflare Workers during local development with cf dev, wrangler dev, or the Cloudflare Vite plugin, using Local Explorer to read and seed binding data and query local traces and logs. Also routes production debugging to Workers observability. Use for debugging requests whether or not the project uses Wrangler.","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fworkers-development\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fworkers-development\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":98,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":20},"01M781Z193MG7SHF4DSD1WK583","workers-best-practices","Cloudflare Workers best practices for production applications. Use when writing, reviewing, or configuring Workers.","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fworkers-best-practices\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fworkers-best-practices\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":106,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":20},"01M781YT0JB3GVA1HTFZ9QJHM7","wordpress-pro","Develops custom WordPress themes and plugins, creates and registers Gutenberg blocks and block patterns, configures WooCommerce stores, implements WordPress REST API endpoints, applies security hardening (nonces, sanitization, escaping, capability checks), and optimizes performance through caching and query tuning. Use when building WordPress themes, writing plugins, customizing Gutenberg blocks, extending WooCommerce, working with ACF, using the WordPress REST API, applying hooks and filters, or improving WordPress performance and security.","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwordpress-pro\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Ffilippolmt\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwordpress-pro\u002FSKILL.md",[],[]]