[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73GC3Y1JF0PV2HR0AC5FR94":3,"skill-same:01M73GC3Y1JF0PV2HR0AC5FR94":67},{"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":43,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":48,"ownerHtmlUrl":49,"ownerBlogUrl":50,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M73GC3Y1JF0PV2HR0AC5FR94","testing-strategy",null,"Testing strategy — unit\u002Fintegration\u002Fe2e pyramid, TDD workflow, mocking best practices, test isolation, coverage targets","Horonomos-laps\u002FYana-AI","Horonomos-laps","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F355299122?v=4","01M76B3QPXE88ET2SQPDPVATZT"," Horonomos-laps","01M72ZQRJPCYPSSWT4D00VJR2A",13,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Ftesting-strategy\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: testing-strategy\ndescription: Testing strategy — unit\u002Fintegration\u002Fe2e pyramid, TDD workflow, mocking best practices, test isolation, coverage targets\ntriggers:\n  - testing strategy\n  - test pyramid\n  - tdd workflow\n  - unit test best practice\n  - mock best practice\n  - test isolation\n  - integration test\n  - test coverage target\n  - pytest best practice\n  - vitest jest best practice\ndo_not_use_for:\n  - LLM evaluation — use ragas\u002Fdeepeval\n  - e2e browser testing — use playwright patterns\n  - writing tests for specific code — use tdd-guide\nsee_also:\n  - ai-code-maintainability\n  - error-handling-patterns\n  - type-safety-patterns\n---\n\n# Testing Strategy\n\n## Test Pyramid\n\n```\n         [E2E]           ← few, slow, expensive, test real flows\n       [Integration]     ← some, medium speed, real DB\u002FAPI\n     [Unit]              ← many, fast, isolated, mock externals\n```\n\nTarget ratios: 70% unit, 20% integration, 10% e2e\nCoverage targets: new code ≥ 80%, overall project ≥ 60%\n\n## Python: pytest Best Practices\n\n```python\n# conftest.py — shared fixtures\nimport pytest\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import Session\n\n@pytest.fixture(scope=\"session\")\ndef engine():\n    return create_engine(\"sqlite:\u002F\u002F\u002F:memory:\")   # test DB\n\n@pytest.fixture\ndef db(engine) -> Session:\n    Base.metadata.create_all(engine)\n    with Session(engine) as session:\n        yield session\n        session.rollback()   # clean up after each test\n\n@pytest.fixture\ndef user(db: Session) -> User:\n    u = User(name=\"Test User\", email=\"test@example.com\")\n    db.add(u)\n    db.flush()\n    return u\n```\n\n```python\n# test_user_service.py — unit test with mock\nimport pytest\nfrom unittest.mock import AsyncMock, patch, MagicMock\nfrom my_app.user_service import UserService, EmailSender\n\nclass TestUserService:\n    def test_create_user_sends_welcome_email(self):\n        # Arrange\n        mock_sender = MagicMock(spec=EmailSender)\n        mock_repo = MagicMock()\n        mock_repo.save.return_value = User(id=\"u-1\", name=\"Alice\", email=\"a@b.com\")\n        service = UserService(repo=mock_repo, sender=mock_sender)\n\n        # Act\n        result = service.create_user(\"Alice\", \"a@b.com\")\n\n        # Assert\n        assert result.name == \"Alice\"\n        mock_sender.send.assert_called_once_with(\n            to=\"a@b.com\",\n            subject=\"Welcome!\",\n        )\n\n    @pytest.mark.asyncio\n    async def test_async_method(self):\n        mock_api = AsyncMock()\n        mock_api.fetch.return_value = {\"status\": \"ok\"}\n        service = MyService(api=mock_api)\n        result = await service.do_thing()\n        assert result == \"ok\"\n```\n\n## TypeScript: Vitest Best Practices\n\n```typescript\n\u002F\u002F user.service.test.ts\nimport { describe, it, expect, vi, beforeEach } from \"vitest\";\nimport { UserService } from \".\u002Fuser.service\";\n\n\u002F\u002F Mock at module level\nvi.mock(\".\u002Femail.service\", () => ({\n  EmailService: vi.fn().mockImplementation(() => ({\n    send: vi.fn().mockResolvedValue(undefined),\n  })),\n}));\n\ndescribe(\"UserService\", () => {\n  let service: UserService;\n  let mockEmailService: { send: ReturnType\u003Ctypeof vi.fn> };\n\n  beforeEach(() => {\n    mockEmailService = { send: vi.fn().mockResolvedValue(undefined) };\n    service = new UserService({ emailService: mockEmailService });\n  });\n\n  it(\"sends welcome email on user creation\", async () => {\n    const user = await service.createUser({ name: \"Alice\", email: \"a@b.com\" });\n\n    expect(user.name).toBe(\"Alice\");\n    expect(mockEmailService.send).toHaveBeenCalledOnce();\n    expect(mockEmailService.send).toHaveBeenCalledWith(\n      expect.objectContaining({ to: \"a@b.com\" })\n    );\n  });\n\n  it(\"throws on duplicate email\", async () => {\n    await service.createUser({ name: \"Alice\", email: \"dup@b.com\" });\n    await expect(\n      service.createUser({ name: \"Bob\", email: \"dup@b.com\" })\n    ).rejects.toThrow(\"email already exists\");\n  });\n});\n```\n\n## Integration Test Pattern\n\n```python\n# test_order_api.py — integration: real DB, real HTTP\nimport pytest\nimport httpx\nfrom fastapi.testclient import TestClient\n\n@pytest.fixture(scope=\"module\")\ndef client() -> TestClient:\n    from my_app.main import app\n    return TestClient(app)\n\ndef test_create_order_full_flow(client: TestClient, db: Session):\n    # Create user\n    user_resp = client.post(\"\u002Fusers\", json={\"name\": \"Alice\", \"email\": \"a@b.com\"})\n    assert user_resp.status_code == 201\n    user_id = user_resp.json()[\"id\"]\n\n    # Create order\n    order_resp = client.post(\"\u002Forders\", json={\"user_id\": user_id, \"items\": [{\"sku\": \"A\", \"qty\": 2}]})\n    assert order_resp.status_code == 201\n    order = order_resp.json()\n    assert order[\"status\"] == \"pending\"\n    assert order[\"user_id\"] == user_id\n```\n\n## TDD Workflow\n\n```bash\n# RED: write failing test first\npytest tests\u002Ftest_feature.py::test_new_behavior -v\n# → FAILED (expected)\n\n# GREEN: minimal implementation to pass\n# Write only enough code to make the test pass\n\npytest tests\u002Ftest_feature.py::test_new_behavior -v\n# → PASSED\n\n# REFACTOR: clean up without breaking tests\npytest tests\u002Ftest_feature.py -v\n# → All PASSED\n```\n\n## What NOT to Mock\n\n```python\n# ✅ Mock external I\u002FO (network, DB, file system, time)\n# ✅ Mock slow operations (sleep, large computations)\n# ✅ Mock non-deterministic values (random, uuid, datetime.now)\n\n# ❌ Don't mock your own domain logic\n# ❌ Don't mock data transformations — test them directly\n# ❌ Don't mock to avoid test complexity — fix the design instead\n\n# ❌ Over-mocking — this test proves nothing\ndef test_user_service_create():\n    service = MagicMock(spec=UserService)\n    service.create.return_value = User(id=\"1\")\n    result = service.create(...)\n    assert result.id == \"1\"  # testing the mock\n```\n\n## Anti-Fake-Pass Checks\n\n- Test that fails before implementation = TDD red phase — skip this = untested code\n- `assert_called_once_with()` is strict — `assert_called_with()` only checks the last call\n- `scope=\"session\"` fixtures are shared across tests — don't mutate them in individual tests\n- `asyncio` tests need `@pytest.mark.asyncio` or `asyncio_mode = \"auto\"` in `pytest.ini`\n- Integration tests hitting real DB need cleanup — use `session.rollback()` or transaction per test\n- Coverage ≥ 80% on new code — measure with `pytest --cov=src --cov-fail-under=80`\n","# Testing Strategy\n\n## Test Pyramid\n\n```\n         [E2E]           ← few, slow, expensive, test real flows\n       [Integration]     ← some, medium speed, real DB\u002FAPI\n     [Unit]              ← many, fast, isolated, mock externals\n```\n\nTarget ratios: 70% unit, 20% integration, 10% e2e\nCoverage targets: new code ≥ 80%, overall project ≥ 60%\n\n## Python: pytest Best Practices\n\n```python\n# conftest.py — shared fixtures\nimport pytest\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import Session\n\n@pytest.fixture(scope=\"session\")\ndef engine():\n    return create_engine(\"sqlite:\u002F\u002F\u002F:memory:\")   # test DB\n\n@pytest.fixture\ndef db(engine) -> Session:\n    Base.metadata.create_all(engine)\n    with Session(engine) as session:\n        yield session\n        session.rollback()   # clean up after each test\n\n@pytest.fixture\ndef user(db: Session) -> User:\n    u = User(name=\"Test User\", email=\"test@example.com\")\n    db.add(u)\n    db.flush()\n    return u\n```\n\n```python\n# test_user_service.py — unit test with mock\nimport pytest\nfrom unittest.mock import AsyncMock, patch, MagicMock\nfrom my_app.user_service import UserService, EmailSender\n\nclass TestUserService:\n    def test_create_user_sends_welcome_email(self):\n        # Arrange\n        mock_sender = MagicMock(spec=EmailSender)\n        mock_repo = MagicMock()\n        mock_repo.save.return_value = User(id=\"u-1\", name=\"Alice\", email=\"a@b.com\")\n        service = UserService(repo=mock_repo, sender=mock_sender)\n\n        # Act\n        result = service.create_user(\"Alice\", \"a@b.com\")\n\n        # Assert\n        assert result.name == \"Alice\"\n        mock_sender.send.assert_called_once_with(\n            to=\"a@b.com\",\n            subject=\"Welcome!\",\n        )\n\n    @pytest.mark.asyncio\n    async def test_async_method(self):\n        mock_api = AsyncMock()\n        mock_api.fetch.return_value = {\"status\": \"ok\"}\n        service = MyService(api=mock_api)\n        result = await service.do_thing()\n        assert result == \"ok\"\n```\n\n## TypeScript: Vitest Best Practices\n\n```typescript\n\u002F\u002F user.service.test.ts\nimport { describe, it, expect, vi, beforeEach } from \"vitest\";\nimport { UserService } from \".\u002Fuser.service\";\n\n\u002F\u002F Mock at module level\nvi.mock(\".\u002Femail.service\", () => ({\n  EmailService: vi.fn().mockImplementation(() => ({\n    send: vi.fn().mockResolvedValue(undefined),\n  })),\n}));\n\ndescribe(\"UserService\", () => {\n  let service: UserService;\n  let mockEmailService: { send: ReturnType\u003Ctypeof vi.fn> };\n\n  beforeEach(() => {\n    mockEmailService = { send: vi.fn().mockResolvedValue(undefined) };\n    service = new UserService({ emailService: mockEmailService });\n  });\n\n  it(\"sends welcome email on user creation\", async () => {\n    const user = await service.createUser({ name: \"Alice\", email: \"a@b.com\" });\n\n    expect(user.name).toBe(\"Alice\");\n    expect(mockEmailService.send).toHaveBeenCalledOnce();\n    expect(mockEmailService.send).toHaveBeenCalledWith(\n      expect.objectContaining({ to: \"a@b.com\" })\n    );\n  });\n\n  it(\"throws on duplicate email\", async () => {\n    await service.createUser({ name: \"Alice\", email: \"dup@b.com\" });\n    await expect(\n      service.createUser({ name: \"Bob\", email: \"dup@b.com\" })\n    ).rejects.toThrow(\"email already exists\");\n  });\n});\n```\n\n## Integration Test Pattern\n\n```python\n# test_order_api.py — integration: real DB, real HTTP\nimport pytest\nimport httpx\nfrom fastapi.testclient import TestClient\n\n@pytest.fixture(scope=\"module\")\ndef client() -> TestClient:\n    from my_app.main import app\n    return TestClient(app)\n\ndef test_create_order_full_flow(client: TestClient, db: Session):\n    # Create user\n    user_resp = client.post(\"\u002Fusers\", json={\"name\": \"Alice\", \"email\": \"a@b.com\"})\n    assert user_resp.status_code == 201\n    user_id = user_resp.json()[\"id\"]\n\n    # Create order\n    order_resp = client.post(\"\u002Forders\", json={\"user_id\": user_id, \"items\": [{\"sku\": \"A\", \"qty\": 2}]})\n    assert order_resp.status_code == 201\n    order = order_resp.json()\n    assert order[\"status\"] == \"pending\"\n    assert order[\"user_id\"] == user_id\n```\n\n## TDD Workflow\n\n```bash\n# RED: write failing test first\npytest tests\u002Ftest_feature.py::test_new_behavior -v\n# → FAILED (expected)\n\n# GREEN: minimal implementation to pass\n# Write only enough code to make the test pass\n\npytest tests\u002Ftest_feature.py::test_new_behavior -v\n# → PASSED\n\n# REFACTOR: clean up without breaking tests\npytest tests\u002Ftest_feature.py -v\n# → All PASSED\n```\n\n## What NOT to Mock\n\n```python\n# ✅ Mock external I\u002FO (network, DB, file system, time)\n# ✅ Mock slow operations (sleep, large computations)\n# ✅ Mock non-deterministic values (random, uuid, datetime.now)\n\n# ❌ Don't mock your own domain logic\n# ❌ Don't mock data transformations — test them directly\n# ❌ Don't mock to avoid test complexity — fix the design instead\n\n# ❌ Over-mocking — this test proves nothing\ndef test_user_service_create():\n    service = MagicMock(spec=UserService)\n    service.create.return_value = User(id=\"1\")\n    result = service.create(...)\n    assert result.id == \"1\"  # testing the mock\n```\n\n## Anti-Fake-Pass Checks\n\n- Test that fails before implementation = TDD red phase — skip this = untested code\n- `assert_called_once_with()` is strict — `assert_called_with()` only checks the last call\n- `scope=\"session\"` fixtures are shared across tests — don't mutate them in individual tests\n- `asyncio` tests need `@pytest.mark.asyncio` or `asyncio_mode = \"auto\"` in `pytest.ini`\n- Integration tests hitting real DB need cleanup — use `session.rollback()` or transaction per test\n- Coverage ≥ 80% on new code — measure with `pytest --cov=src --cov-fail-under=80`\n",{"name":5,"see_also":24,"triggers":28,"description":7,"do_not_use_for":39},[25,26,27],"ai-code-maintainability","error-handling-patterns","type-safety-patterns",[29,30,31,32,33,34,35,36,37,38],"testing strategy","test pyramid","tdd workflow","unit test best practice","mock best practice","test isolation","integration test","test coverage target","pytest best practice","vitest jest best practice",[40,41,42],"LLM evaluation — use ragas\u002Fdeepeval","e2e browser testing — use playwright patterns","writing tests for specific code — use tdd-guide","main","481dcd7dd2e288b9d627a2bd017db70e64e6c6fa","core\u002Fskills\u002Ftesting-strategy",2,"https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI","https:\u002F\u002Fyana.vutam.link\u002F","https:\u002F\u002Fgithub.com\u002FHoronomos-laps","https:\u002F\u002Fyana.vutam.link","An open-source governed runtime & execution environment for multi-agent AI systems.","2026-11-14 13:24:09",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add Horonomos-laps\u002FYana-AI --skill testing-strategy",{"tool":59,"command":60},"bunx","bunx skills add Horonomos-laps\u002FYana-AI --skill testing-strategy",{"tool":62,"command":63},"pnpm","pnpm dlx skills add Horonomos-laps\u002FYana-AI --skill testing-strategy","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Ftesting-strategy\u002FSKILL.md",true,[],[68,76,83,91,99,107],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":72,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M735GKET5YVYKAY62W2P5YXB","openai--sentry--sentry","Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.","MIT","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fopenai--sentry--sentry\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M73DCAP83T17HY7SMGK7MGFE","ito-basket-compare","Compare Itô prediction-market baskets against a user's knowledge base, portfolio notes, financial context, watchlist, or research thesis. Use for read-only basket comparison and gap analysis without investment advice or live trading.","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fito-basket-compare\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":87,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M734CYEMZFDR3KH6SW0JP8TD","implementing-network-traffic-baselining","Build network traffic baselines from NetFlow\u002FIPFIX data using Python pandas for statistical analysis, z-score anomaly detection, and hourly\u002Fdaily traffic pattern profiling","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":95,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M73ASZ6NJRJM44Z2P84NGQ3Q","detecting-evasion-techniques-in-endpoint-logs","Detects defense evasion techniques used by adversaries in endpoint logs including log tampering, timestomping, process injection, and security tool disabling. Use when investigating suspicious endpoint behavior, building detection rules for evasion tactics, or conducting threat hunting for stealthy adversary activity. Activates for requests involving evasion detection, defense evasion analysis, log tampering detection, or MITRE ATT&CK TA0005.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":103,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":19},"01M734AFNXD06Z78QRK0VKGT7Q","implementing-microsegmentation-with-guardicore","Implementing microsegmentation using Akamai Guardicore Segmentation to map application dependencies, create granular network policies, visualize east-west traffic flows, and enforce least-privilege communication between workloads across data centers and cloud.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M736TK27QMCXK0DVCH25SJN5","ramdisk-tmpfs-patterns","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Framdisk-tmpfs-patterns\u002FSKILL.md",[],[]]