[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71FR99CYENA0HWCWHSYV5Y0":3,"skill-same:01M71FR99CYENA0HWCWHSYV5Y0":100},{"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":22,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":50,"commitSha":51,"skillDirectory":52,"forksCount":53,"repositoryHtmlUrl":54,"repositoryHomepageUrl":6,"ownerHtmlUrl":55,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":56,"install":57,"resources":70},"01M71FR99CYENA0HWCWHSYV5Y0","testing-patterns",null,"Cross-language testing strategies and patterns. Triggers on: test pyramid, unit test, integration test, e2e test, TDD, BDD, test coverage, mocking strategy, test doubles, test isolation.","JSGforever\u002Fskillguard","JSGforever","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F85541948?v=4","01M71FQD3E132VMR5F4TAYX3YS","01M71FQD4DYW0XJ4XQ4YQH75Y9",2,"GPL-3.0","https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__0xdarkmatter--testing-patterns\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"testing","patterns","testing patterns","test isolation","test","references","strategies","Bash","framework-specific","e2e","strategy","testing strategies","mocking","triggers","bdd","integration test","e2e test","unit","unit test","coverage","2026-11-10 10:12:30",false,"---\nname: testing-patterns\ndescription: \"Cross-language testing strategies and patterns. Triggers on: test pyramid, unit test, integration test, e2e test, TDD, BDD, test coverage, mocking strategy, test doubles, test isolation.\"\ncompatibility: \"Language-agnostic patterns. Framework-specific details in references.\"\nallowed-tools: \"Read Write Bash\"\n---\n\n# Testing Patterns\n\nUniversal testing strategies and patterns applicable across languages.\n\n## The Test Pyramid\n\n```\n        \u002F\\\n       \u002F  \\     E2E Tests (few, slow, expensive)\n      \u002F    \\    - Full system tests\n     \u002F------\\   - Real browser\u002FAPI calls\n    \u002F        \\\n   \u002F  Integ   \\ Integration Tests (some)\n  \u002F   Tests    \\ - Service boundaries\n \u002F--------------\\ - Database, APIs\n\u002F                \\\n\u002F   Unit Tests    \\ Unit Tests (many, fast, cheap)\n------------------  - Single function\u002Fclass\n                    - Mocked dependencies\n```\n\n## Test Types\n\n### Unit Tests\n```\nScope:      Single function\u002Fmethod\u002Fclass\nSpeed:      Milliseconds\nDependencies: All mocked\nWhen:       Every code change\nCoverage:   80%+ of codebase\n```\n\n### Integration Tests\n```\nScope:      Multiple components together\nSpeed:      Seconds\nDependencies: Real databases, mocked external APIs\nWhen:       PR\u002Fmerge, critical paths\nCoverage:   Key integration points\n```\n\n### End-to-End Tests\n```\nScope:      Full user journey\nSpeed:      Minutes\nDependencies: Real system (or staging)\nWhen:       Pre-deploy, nightly\nCoverage:   Critical user flows only\n```\n\n## Test Naming Convention\n\n```\ntest_\u003Cunit>_\u003Cscenario>_\u003Cexpected>\n\nExamples:\n- test_calculate_total_with_discount_returns_reduced_price\n- test_user_login_with_invalid_password_returns_401\n- test_order_submit_when_out_of_stock_raises_error\n```\n\n## Arrange-Act-Assert (AAA)\n\n```python\ndef test_calculate_discount():\n    # Arrange - Set up test data and dependencies\n    cart = Cart()\n    cart.add_item(Item(price=100))\n    discount = Discount(percent=10)\n\n    # Act - Execute the code under test\n    total = cart.calculate_total(discount)\n\n    # Assert - Verify the results\n    assert total == 90\n```\n\n## Test Doubles\n\n| Type | Purpose | Example |\n|------|---------|---------|\n| **Stub** | Returns canned data | `stub.get_user.returns(fake_user)` |\n| **Mock** | Verifies interactions | `mock.send_email.assert_called_once()` |\n| **Spy** | Records calls, uses real impl | `spy.on(service, 'save')` |\n| **Fake** | Working simplified impl | `FakeDatabase()` instead of real DB |\n| **Dummy** | Placeholder, never used | `null` object for required param |\n\n## Test Isolation Strategies\n\n### Database Isolation\n```\nOption 1: Transaction rollback (fast)\n- Start transaction before test\n- Rollback after test\n\nOption 2: Truncate tables (medium)\n- Clear all data between tests\n\nOption 3: Separate database (slow)\n- Each test gets fresh database\n```\n\n### External Service Isolation\n```\nOption 1: Mock at boundary\n- Replace HTTP client with mock\n\nOption 2: Fake server\n- WireMock, MSW, VCR cassettes\n\nOption 3: Contract testing\n- Pact, consumer-driven contracts\n```\n\n## What to Test\n\n### MUST Test\n- Business logic and calculations\n- Input validation and error handling\n- Security-sensitive code (auth, permissions)\n- Edge cases and boundary conditions\n\n### SHOULD Test\n- Integration points (DB, APIs)\n- State transitions\n- Configuration handling\n\n### AVOID Testing\n- Framework internals\n- Third-party library behavior\n- Simple getters\u002Fsetters\n- Private implementation details\n\n## Test Quality Checklist\n\n- [ ] Tests are independent (no order dependency)\n- [ ] Tests are deterministic (no flaky tests)\n- [ ] Tests are fast (unit \u003C 100ms, integration \u003C 5s)\n- [ ] Tests have clear names describing behavior\n- [ ] Tests cover happy path AND error cases\n- [ ] Tests don't repeat production logic\n- [ ] Mocks are minimal (only external boundaries)\n\n## Additional Resources\n\n- `.\u002Freferences\u002Ftdd-workflow.md` - Test-Driven Development cycle\n- `.\u002Freferences\u002Fmocking-strategies.md` - When and how to mock\n- `.\u002Freferences\u002Ftest-data-patterns.md` - Fixtures, factories, builders\n- `.\u002Freferences\u002Fci-testing.md` - Testing in CI\u002FCD pipelines\n\n## Scripts\n\n- `.\u002Fscripts\u002Fcoverage-check.sh` - Run coverage and fail if below threshold\n","# Testing Patterns\n\nUniversal testing strategies and patterns applicable across languages.\n\n## The Test Pyramid\n\n```\n        \u002F\\\n       \u002F  \\     E2E Tests (few, slow, expensive)\n      \u002F    \\    - Full system tests\n     \u002F------\\   - Real browser\u002FAPI calls\n    \u002F        \\\n   \u002F  Integ   \\ Integration Tests (some)\n  \u002F   Tests    \\ - Service boundaries\n \u002F--------------\\ - Database, APIs\n\u002F                \\\n\u002F   Unit Tests    \\ Unit Tests (many, fast, cheap)\n------------------  - Single function\u002Fclass\n                    - Mocked dependencies\n```\n\n## Test Types\n\n### Unit Tests\n```\nScope:      Single function\u002Fmethod\u002Fclass\nSpeed:      Milliseconds\nDependencies: All mocked\nWhen:       Every code change\nCoverage:   80%+ of codebase\n```\n\n### Integration Tests\n```\nScope:      Multiple components together\nSpeed:      Seconds\nDependencies: Real databases, mocked external APIs\nWhen:       PR\u002Fmerge, critical paths\nCoverage:   Key integration points\n```\n\n### End-to-End Tests\n```\nScope:      Full user journey\nSpeed:      Minutes\nDependencies: Real system (or staging)\nWhen:       Pre-deploy, nightly\nCoverage:   Critical user flows only\n```\n\n## Test Naming Convention\n\n```\ntest_\u003Cunit>_\u003Cscenario>_\u003Cexpected>\n\nExamples:\n- test_calculate_total_with_discount_returns_reduced_price\n- test_user_login_with_invalid_password_returns_401\n- test_order_submit_when_out_of_stock_raises_error\n```\n\n## Arrange-Act-Assert (AAA)\n\n```python\ndef test_calculate_discount():\n    # Arrange - Set up test data and dependencies\n    cart = Cart()\n    cart.add_item(Item(price=100))\n    discount = Discount(percent=10)\n\n    # Act - Execute the code under test\n    total = cart.calculate_total(discount)\n\n    # Assert - Verify the results\n    assert total == 90\n```\n\n## Test Doubles\n\n| Type | Purpose | Example |\n|------|---------|---------|\n| **Stub** | Returns canned data | `stub.get_user.returns(fake_user)` |\n| **Mock** | Verifies interactions | `mock.send_email.assert_called_once()` |\n| **Spy** | Records calls, uses real impl | `spy.on(service, 'save')` |\n| **Fake** | Working simplified impl | `FakeDatabase()` instead of real DB |\n| **Dummy** | Placeholder, never used | `null` object for required param |\n\n## Test Isolation Strategies\n\n### Database Isolation\n```\nOption 1: Transaction rollback (fast)\n- Start transaction before test\n- Rollback after test\n\nOption 2: Truncate tables (medium)\n- Clear all data between tests\n\nOption 3: Separate database (slow)\n- Each test gets fresh database\n```\n\n### External Service Isolation\n```\nOption 1: Mock at boundary\n- Replace HTTP client with mock\n\nOption 2: Fake server\n- WireMock, MSW, VCR cassettes\n\nOption 3: Contract testing\n- Pact, consumer-driven contracts\n```\n\n## What to Test\n\n### MUST Test\n- Business logic and calculations\n- Input validation and error handling\n- Security-sensitive code (auth, permissions)\n- Edge cases and boundary conditions\n\n### SHOULD Test\n- Integration points (DB, APIs)\n- State transitions\n- Configuration handling\n\n### AVOID Testing\n- Framework internals\n- Third-party library behavior\n- Simple getters\u002Fsetters\n- Private implementation details\n\n## Test Quality Checklist\n\n- [ ] Tests are independent (no order dependency)\n- [ ] Tests are deterministic (no flaky tests)\n- [ ] Tests are fast (unit \u003C 100ms, integration \u003C 5s)\n- [ ] Tests have clear names describing behavior\n- [ ] Tests cover happy path AND error cases\n- [ ] Tests don't repeat production logic\n- [ ] Mocks are minimal (only external boundaries)\n\n## Additional Resources\n\n- `.\u002Freferences\u002Ftdd-workflow.md` - Test-Driven Development cycle\n- `.\u002Freferences\u002Fmocking-strategies.md` - When and how to mock\n- `.\u002Freferences\u002Ftest-data-patterns.md` - Fixtures, factories, builders\n- `.\u002Freferences\u002Fci-testing.md` - Testing in CI\u002FCD pipelines\n\n## Scripts\n\n- `.\u002Fscripts\u002Fcoverage-check.sh` - Run coverage and fail if below threshold\n",{"name":5,"description":7,"allowed-tools":48,"compatibility":49},"Read Write Bash","Language-agnostic patterns. Framework-specific details in references.","main","f2ec4b3b9133d34eeaf9b38e4b0a97e8e5705a7f","benchmarks\u002Ffinal\u002Fskills\u002Fasset1__0xdarkmatter--testing-patterns",0,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard","https:\u002F\u002Fgithub.com\u002FJSGforever","2026-08-29 18:27:56",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add JSGforever\u002Fskillguard --skill testing-patterns",{"tool":63,"command":64},"bunx","bunx skills add JSGforever\u002Fskillguard --skill testing-patterns",{"tool":66,"command":67},"pnpm","pnpm dlx skills add JSGforever\u002Fskillguard --skill testing-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__0xdarkmatter--testing-patterns\u002FSKILL.md",true,[71,76,82,86,90,94],{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":53,"sourceHtmlUrl":75},"assets\u002F.gitkeep","ASSET","资产文件","https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__0xdarkmatter--testing-patterns\u002Fassets\u002F.gitkeep",{"path":77,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":80,"sourceHtmlUrl":81},"references\u002Fci-testing.md","REFERENCE","参考文档",7038,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__0xdarkmatter--testing-patterns\u002Freferences\u002Fci-testing.md",{"path":83,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Fmocking-strategies.md",7196,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__0xdarkmatter--testing-patterns\u002Freferences\u002Fmocking-strategies.md",{"path":87,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":88,"sourceHtmlUrl":89},"references\u002Ftdd-workflow.md",5292,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__0xdarkmatter--testing-patterns\u002Freferences\u002Ftdd-workflow.md",{"path":91,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":92,"sourceHtmlUrl":93},"references\u002Ftest-data-patterns.md",6600,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__0xdarkmatter--testing-patterns\u002Freferences\u002Ftest-data-patterns.md",{"path":95,"resourceType":96,"resourceTypeDesc":97,"sizeBytes":98,"sourceHtmlUrl":99},"scripts\u002Fcoverage-check.sh","SCRIPT","脚本",762,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__0xdarkmatter--testing-patterns\u002Fscripts\u002Fcoverage-check.sh",[101,131,147,173,194,215],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":110,"publishedAt":43},"01M71HY2SNXBA9Q00WZDTZQ31Z","skillguard-codex-scanner","Hybrid deterministic+LLM agent-skill security scanner. Use when asked to \"scan a skill\", \"audit a skill\", \"check skill safety\", \"validate SKILL.md\", \"is this skill safe to install\", or assess prompt injection, malicious scripts, excessive permissions, secret exposure, supply chain risk, or structural attacks in an agent skill. Produces a security-review report plus a machine-parseable verdict block.","https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fsrc\u002Fskillguard\u002Fstatic_scanner\u002Fskillguard-codex-scanner\u002FSKILL.md",[107],{"categoryNo":108,"categoryName":109,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",[111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130],"scanner","skillguard codex scanner","skillguard","codex","chain","skill security","security-review","review report","structural","secret","prompt injection","security scanner","when","review","malicious","permissions","exposure","audit","scripts","safe",{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":135,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":143,"publishedAt":43},"01M71HY0SPKTT3S27BC2HPAC5M","data-exfiltrator","Analyzes data files","MIT","https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Fsmoke-one-skill\u002Fasset1__cisco-ai-defense--data-exfiltrator\u002FSKILL.md",[138],{"categoryNo":139,"categoryName":140,"taxonomyType":141,"taxonomyTypeDesc":142},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[144,145,146],"data","data exfiltrator","files",{"skillNo":148,"name":149,"nameZh":6,"description":150,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":151,"categories":152,"keywords":153,"publishedAt":43},"01M71HXVS9EMN44BGDW215FZ72","real-time-collaboration-engine","Build real-time collaborative editing with WebSockets, OT\u002FCRDT conflict resolution, and presence awareness. Implements cursor tracking, optimistic updates, and offline sync. Use for collaborative editors, whiteboards, video editing. Activate on \"real-time collaboration\", \"WebSocket sync\", \"multiplayer editing\", \"CRDT\", \"presence awareness\". NOT for simple chat, request-response APIs, or single-user apps.","https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__curiositech--real-time-collaboration-engine\u002FSKILL.md",[],[154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,30,169,170,171,172],"time","real time collaboration engine","real time collaboration","collaboration","engine","real time","Video","reliability","video editing","performance","conflict resolution","presence","access","apps","updates","activate","optimizer","react","streaming",{"skillNo":174,"name":175,"nameZh":6,"description":176,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":177,"categories":178,"keywords":182,"publishedAt":43},"01M71HXP6CTY4KFN0QVMMN0V7J","react-performance-optimizer","Optimize React apps for 60fps performance. Implements memoization, virtualization, code splitting, bundle optimization. Use for slow renders, large lists, bundle bloat. Activate on \"React performance\", \"slow render\", \"useMemo\", \"bundle size\", \"virtualization\". NOT for backend optimization, non-React frameworks, or premature optimization.","https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__curiositech--react-performance-optimizer\u002FSKILL.md",[179],{"categoryNo":180,"categoryName":181,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000009","前端开发",[163,183,170,171,184,185,186,187,188,189,154,190,191,167,30,192,169,172,193,29],"react performance optimizer","react performance","performance optimizer","app","nextjs","expert","re","render","2025","code","router",{"skillNo":195,"name":196,"nameZh":6,"description":197,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":198,"categories":199,"keywords":201,"publishedAt":43},"01M71HXH7QXSQB4QTDZ7SP7YXQ","llm-streaming-response-handler","Build production LLM streaming UIs with Server-Sent Events, real-time token display, cancellation, error recovery. Handles OpenAI\u002FAnthropic\u002FClaude streaming APIs. Use for chatbots, AI assistants, real-time text generation. Activate on \"LLM streaming\", \"SSE\", \"token stream\", \"chat UI\", \"real-time AI\". NOT for batch processing, non-streaming APIs, or WebSocket bidirectional chat.","https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__curiositech--llm-streaming-response-handler\u002FSKILL.md",[200],{"categoryNo":180,"categoryName":181,"taxonomyType":20,"taxonomyTypeDesc":21},[202,172,203,204,205,206,163,154,207,208,209,30,169,170,210,171,211,212,213,214],"llm streaming response handler","handler","error","processing","retry","chat ui","error recovery","critical","batch","display","text","server","read",{"skillNo":216,"name":217,"nameZh":6,"description":218,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":219,"categories":220,"keywords":226,"publishedAt":43},"01M71HXCB0E1YRKYW1Y8T0Y106","github-actions-pipeline-builder","Build production CI\u002FCD pipelines with GitHub Actions. Implements matrix builds, caching, deployments, testing, security scanning. Use for automated testing, deployments, release workflows. Activate on \"GitHub Actions\", \"CI\u002FCD\", \"workflow\", \"deployment pipeline\", \"automated testing\". NOT for Jenkins\u002FCircleCI, manual deployments, or non-GitHub repositories.","https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__curiositech--github-actions-pipeline-builder\u002FSKILL.md",[221,222,225],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":223,"categoryName":224,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000011","运维与部署",{"categoryNo":108,"categoryName":109,"taxonomyType":20,"taxonomyTypeDesc":21},[227,228,229,230,231,232,233,161,188,23,234,235,169,29,236,214,237,238,239,240],"github actions pipeline builder","actions","github actions","pipeline builder","github","builder","pipeline","ci","workflows","run","release","write","edit","git"]