[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75FS41A3TT2P2S9P2A72W10":3,"skill-same:01M75FS41A3TT2P2S9P2A72W10":50},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M75FS41A3TT2P2S9P2A72W10","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.","RudyCity\u002Fsuperagent","RudyCity","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F82188919?v=4","01M75FP5X8AW8ACBH0SH34WS7M","01M75FP5YAHJK8M1Q52BWXB82K",70,"MIT","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fbats-testing-patterns\u002FSKILL.md",[],[],"2026-11-12 13:55:43",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","62c7af5ced2c21355d148c243edb6d5921cca1a6",".agents\u002Fskills\u002Fbats-testing-patterns",8,"https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent","https:\u002F\u002Fgithub.com\u002FRudyCity","2026-11-14 22:58:49",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add RudyCity\u002Fsuperagent --skill bats-testing-patterns",{"tool":36,"command":37},"bunx","bunx skills add RudyCity\u002Fsuperagent --skill bats-testing-patterns",{"tool":39,"command":40},"pnpm","pnpm dlx skills add RudyCity\u002Fsuperagent --skill bats-testing-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fbats-testing-patterns\u002FSKILL.md",true,[44],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"references\u002Fdetails.md","REFERENCE","参考文档",7275,"https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fbats-testing-patterns\u002Freferences\u002Fdetails.md",[51,58,65,72,79,86],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":18},"01M75GP28CM6QCSXSHKFF3NNKS","telegram_bot","Use Telegram Bot when the user asks for Telegram Bot or this provider's API.","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002Fmuse-bridge-kit\u002Fskills\u002Ftelegram-bot\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":18},"01M75GNZGZYM7NWDV6MBP3HS14","superagent-bridge","Operate the Muse\u003C->superagent Telegram bridge: poll the private group for task_request\u002Ftask_result envelopes, validate senders, and reply with task_batch\u002Ftask_done as Muse (the remote brain).","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002Fmuse-bridge-kit\u002Fskills\u002Fsuperagent-bridge\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":18},"01M75GNHN19HJWZ7NAPM5E5JCV","Writing Skills","TDD for process documentation - test with subagents before writing, iterate until bulletproof","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwriting-skills\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M75GNCQEKVRA4FH161NZPZNB","writing-shape","Take a markdown file of raw material and shape it into an article through a conversational session — drafting candidate openings, growing the piece paragraph by paragraph, arguing about format (lists, tables, callouts, quotes) at each step. Use when the user has a pile of notes, fragments, or a rough draft and wants help turning it into something publishable.","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwriting-shape\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":18},"01M75GNAF9NAYCSTBDZDGMK0DZ","Writing Plans","Create detailed implementation plans with bite-sized tasks for engineers with zero codebase context","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":18},"01M75GN72EV0V5NQAW9CSPFRFH","writing-guidelines","Review docs\u002Fprose for Writing Guidelines compliance. Use when asked to \"review my docs\", \"check writing style\", \"audit prose\", \"review docs voice and tone\", or \"check this page against the writing handbook\".","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwriting-guidelines\u002FSKILL.md",[],[]]