[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71SBND2R71J6BX7YB65BQGG":3,"skill-same:01M71SBND2R71J6BX7YB65BQGG":66},{"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":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":14,"repositoryHtmlUrl":48,"repositoryHomepageUrl":6,"ownerHtmlUrl":49,"ownerBlogUrl":6,"ownerDescription":50,"updatedAt":51,"install":52,"resources":65},"01M71SBND2R71J6BX7YB65BQGG","pytest-coverage",null,"Write pytest tests with coverage focus. Use when: adding tests, writing unit tests, writing integration tests, negative tests, edge cases, bug hunting, improving coverage, pytest, test suite.","mariotaddeucci\u002Fagent-skill-router","mariotaddeucci","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F8824036?v=4","01M71SBK9QE3NQWRNNACW7HXZV","Mario Taddeucci","01M71SBKAHZD4QRNGEA50Q3ZBM",0,"MIT","https:\u002F\u002Fgithub.com\u002Fmariotaddeucci\u002Fagent-skill-router\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fpytest-coverage\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"pytest coverage","pytest","coverage","module","edge","tests","test suite","write pytest","integration tests","suite","bug","write","src","hunting","focus","server","router","when","writing","unit","2026-11-10 13:02:02",false,"---\nname: pytest-coverage\ndescription: \"Write pytest tests with coverage focus. Use when: adding tests, writing unit tests, writing integration tests, negative tests, edge cases, bug hunting, improving coverage, pytest, test suite.\"\nargument-hint: \"module, function, or file to test (e.g. src\u002Fagent_skill_router\u002Fserver.py)\"\n---\n\n# Pytest Coverage Skill\n\n## Philosophy\n\nTwo layers, different responsibilities:\n\n| Layer | Goal | Volume | Focus |\n|-------|------|--------|-------|\n| **Unit** | Find unmapped bugs | Many | Negative paths, edge cases, invalid inputs |\n| **Integration** | Verify real user behavior | Few | Happy paths with high scenario coverage |\n\nUnit tests hunt for bugs. Integration tests prove features work end-to-end.\n\n---\n\n## Step 1 — Explore the target\n\nBefore writing any test, read the target module:\n\n1. Identify every **public function\u002Fmethod\u002Fclass** — these are test targets.\n2. For each target, list its **branches**: `if`, `elif`, `else`, `try\u002Fexcept`, early returns, guard clauses.\n3. Note **type boundaries**: what happens at `None`, `\"\"`, `0`, negative numbers, empty collections, max values.\n4. Check if the module already has tests — read them to avoid duplication and understand existing patterns.\n\n---\n\n## Step 2 — Plan unit tests (negative \u002F edge cases)\n\nUnit tests go in `tests\u002F` (not `tests\u002Fintegration\u002F`). Each test is a **standalone function** — never a class, unless the existing file uses classes (follow the file's pattern).\n\nFor every branch and boundary found in Step 1, create a test that triggers the **unexpected path**:\n\n### Checklist for unit test coverage\n\n- [ ] `None` passed where an object is expected\n- [ ] Empty string \u002F empty list \u002F empty dict\n- [ ] Negative numbers \u002F zero where positive is expected\n- [ ] Invalid type (e.g. `int` where `Path` expected)\n- [ ] Path that does not exist (use `tmp_path \u002F \"nonexistent\"`)\n- [ ] Duplicate entries \u002F duplicate names\n- [ ] Boundary values (first item, last item, single item)\n- [ ] Boolean flags: `True` vs `False` for every flag\n- [ ] Combinations of flags that produce conflicting state\n- [ ] Exceptions: verify the right exception type AND message fragment\n\n### Naming convention\n\n```python\ndef test_\u003Cfunction>_\u003Ccondition>_\u003Cexpected_outcome>():\n    ...\n```\n\nExamples:\n- `test_resolve_roots_nonexistent_paths_excluded`\n- `test_build_mcp_raises_when_settings_invalid`\n- `test_discover_returns_empty_list_on_missing_dir`\n\n### Key fixtures to use (project-specific)\n\n- `all_disabled_settings` — baseline with every provider disabled; always start here when testing a single provider\n- `tmp_path` — isolated temp directory; never use real home or workspace dirs\n- `monkeypatch` — patch `Path.home()` via `monkeypatch.setattr(Path, \"home\", staticmethod(lambda: fake_home))`\n- `_PROVIDER_ROOTS` — monkey-patch directly: `srv._PROVIDER_ROOTS = patched  # type: ignore[assignment]`\n\n### Do NOT\n\n- Add `@pytest.mark.asyncio` — `asyncio_mode = \"auto\"` is already set\n- Use `from __future__ import annotations`\n- Use relative imports\n\n---\n\n## Step 3 — Plan integration tests (user-behavior focused)\n\nIntegration tests go in `tests\u002Fintegration\u002F`. They test **scenarios a real user would trigger**, not internal branches.\n\n### Integration test rules\n\n1. **One scenario per test** — simulate a single coherent user action.\n2. **Use real filesystem via `tmp_path`** — create actual files\u002Fdirs, not mocks.\n3. **Assert on observable outputs** — returned lists, file contents, MCP resource names; not internal state.\n4. **Cover the full flow** — from input to final output (e.g. settings → `build_mcp()` → `Client` query → resource list).\n5. **Keep count low** — 3–6 tests per module, each covering a distinct scenario.\n\n### Integration scenario template\n\n```python\nasync def test_\u003Cfeature>_\u003Cscenario>(tmp_path, monkeypatch):\n    # Arrange: set up realistic file structure\n    skill_dir = tmp_path \u002F \"my-skill\"\n    skill_dir.mkdir()\n    (skill_dir \u002F \"SKILL.md\").write_text(\"---\\ndescription: x\\n---\\n# x\\n\")\n\n    # Act: invoke via public API (build_mcp, discover, install, etc.)\n    from fastmcp import Client\n    mcp = build_mcp(settings)\n    async with Client(mcp) as client:\n        resources = await client.list_resources()\n\n    # Assert: observable user-facing result\n    uris = [str(r.uri) for r in resources]\n    assert any(\"my-skill\" in u for u in uris)\n```\n\n---\n\n## Step 4 — Write the tests\n\nWrite all tests at once. Follow these rules:\n\n- **Imports at top** of file, not inside functions (unless testing a lazy-import behavior).\n- **One assertion per logical concern** — multiple `assert` lines are fine when they check the same thing.\n- **No magic values** — use named variables for expected strings, paths, counts.\n- **No sleep\u002Fwait** — use `asyncio_mode = \"auto\"` + `async def test_` for async code.\n- **Parametrize repetitive cases**:\n\n```python\n@pytest.mark.parametrize(\"value\", [None, \"\", [], {}])\ndef test_fn_rejects_empty_input(value):\n    with pytest.raises(ValueError):\n        fn(value)\n```\n\n---\n\n## Step 5 — Run and validate coverage\n\n```bash\nuv run pytest --cov --cov-report=term-missing\n```\n\nReview the `MISS` column. For every uncovered line:\n\n1. Determine if it's a branch, exception handler, or edge case.\n2. Add a unit test specifically targeting that line.\n3. Re-run until coverage target is met (aim ≥ 90% for new code).\n\nTo run only the new tests first:\n\n```bash\nuv run pytest tests\u002Ftest_\u003Cmodule>.py -v\nuv run pytest tests\u002Fintegration\u002F -v\n```\n\n---\n\n## Step 6 — Lint and type-check\n\n```bash\nuv run ruff check src\u002F tests\u002F\nuv run pyrefly check\n```\n\nFix any errors before finalizing. Common issues:\n- Missing type annotations in `src\u002F` (`ANN` rules)\n- Imports that should be inside `TYPE_CHECKING` blocks (`TCH` rules)\n- Commented-out code (`ERA001`)\n\n---\n\n## Completion Checklist\n\n- [ ] Every public function has at least one negative test\n- [ ] All boolean flags tested in both states\n- [ ] All `except` blocks have a test that triggers them\n- [ ] Integration tests cover distinct user scenarios (not just repeats of unit tests)\n- [ ] Coverage ≥ 90% on new\u002Fchanged code\n- [ ] `ruff check` passes with no errors\n- [ ] `pyrefly check` passes with no errors\n","# Pytest Coverage Skill\n\n## Philosophy\n\nTwo layers, different responsibilities:\n\n| Layer | Goal | Volume | Focus |\n|-------|------|--------|-------|\n| **Unit** | Find unmapped bugs | Many | Negative paths, edge cases, invalid inputs |\n| **Integration** | Verify real user behavior | Few | Happy paths with high scenario coverage |\n\nUnit tests hunt for bugs. Integration tests prove features work end-to-end.\n\n---\n\n## Step 1 — Explore the target\n\nBefore writing any test, read the target module:\n\n1. Identify every **public function\u002Fmethod\u002Fclass** — these are test targets.\n2. For each target, list its **branches**: `if`, `elif`, `else`, `try\u002Fexcept`, early returns, guard clauses.\n3. Note **type boundaries**: what happens at `None`, `\"\"`, `0`, negative numbers, empty collections, max values.\n4. Check if the module already has tests — read them to avoid duplication and understand existing patterns.\n\n---\n\n## Step 2 — Plan unit tests (negative \u002F edge cases)\n\nUnit tests go in `tests\u002F` (not `tests\u002Fintegration\u002F`). Each test is a **standalone function** — never a class, unless the existing file uses classes (follow the file's pattern).\n\nFor every branch and boundary found in Step 1, create a test that triggers the **unexpected path**:\n\n### Checklist for unit test coverage\n\n- [ ] `None` passed where an object is expected\n- [ ] Empty string \u002F empty list \u002F empty dict\n- [ ] Negative numbers \u002F zero where positive is expected\n- [ ] Invalid type (e.g. `int` where `Path` expected)\n- [ ] Path that does not exist (use `tmp_path \u002F \"nonexistent\"`)\n- [ ] Duplicate entries \u002F duplicate names\n- [ ] Boundary values (first item, last item, single item)\n- [ ] Boolean flags: `True` vs `False` for every flag\n- [ ] Combinations of flags that produce conflicting state\n- [ ] Exceptions: verify the right exception type AND message fragment\n\n### Naming convention\n\n```python\ndef test_\u003Cfunction>_\u003Ccondition>_\u003Cexpected_outcome>():\n    ...\n```\n\nExamples:\n- `test_resolve_roots_nonexistent_paths_excluded`\n- `test_build_mcp_raises_when_settings_invalid`\n- `test_discover_returns_empty_list_on_missing_dir`\n\n### Key fixtures to use (project-specific)\n\n- `all_disabled_settings` — baseline with every provider disabled; always start here when testing a single provider\n- `tmp_path` — isolated temp directory; never use real home or workspace dirs\n- `monkeypatch` — patch `Path.home()` via `monkeypatch.setattr(Path, \"home\", staticmethod(lambda: fake_home))`\n- `_PROVIDER_ROOTS` — monkey-patch directly: `srv._PROVIDER_ROOTS = patched  # type: ignore[assignment]`\n\n### Do NOT\n\n- Add `@pytest.mark.asyncio` — `asyncio_mode = \"auto\"` is already set\n- Use `from __future__ import annotations`\n- Use relative imports\n\n---\n\n## Step 3 — Plan integration tests (user-behavior focused)\n\nIntegration tests go in `tests\u002Fintegration\u002F`. They test **scenarios a real user would trigger**, not internal branches.\n\n### Integration test rules\n\n1. **One scenario per test** — simulate a single coherent user action.\n2. **Use real filesystem via `tmp_path`** — create actual files\u002Fdirs, not mocks.\n3. **Assert on observable outputs** — returned lists, file contents, MCP resource names; not internal state.\n4. **Cover the full flow** — from input to final output (e.g. settings → `build_mcp()` → `Client` query → resource list).\n5. **Keep count low** — 3–6 tests per module, each covering a distinct scenario.\n\n### Integration scenario template\n\n```python\nasync def test_\u003Cfeature>_\u003Cscenario>(tmp_path, monkeypatch):\n    # Arrange: set up realistic file structure\n    skill_dir = tmp_path \u002F \"my-skill\"\n    skill_dir.mkdir()\n    (skill_dir \u002F \"SKILL.md\").write_text(\"---\\ndescription: x\\n---\\n# x\\n\")\n\n    # Act: invoke via public API (build_mcp, discover, install, etc.)\n    from fastmcp import Client\n    mcp = build_mcp(settings)\n    async with Client(mcp) as client:\n        resources = await client.list_resources()\n\n    # Assert: observable user-facing result\n    uris = [str(r.uri) for r in resources]\n    assert any(\"my-skill\" in u for u in uris)\n```\n\n---\n\n## Step 4 — Write the tests\n\nWrite all tests at once. Follow these rules:\n\n- **Imports at top** of file, not inside functions (unless testing a lazy-import behavior).\n- **One assertion per logical concern** — multiple `assert` lines are fine when they check the same thing.\n- **No magic values** — use named variables for expected strings, paths, counts.\n- **No sleep\u002Fwait** — use `asyncio_mode = \"auto\"` + `async def test_` for async code.\n- **Parametrize repetitive cases**:\n\n```python\n@pytest.mark.parametrize(\"value\", [None, \"\", [], {}])\ndef test_fn_rejects_empty_input(value):\n    with pytest.raises(ValueError):\n        fn(value)\n```\n\n---\n\n## Step 5 — Run and validate coverage\n\n```bash\nuv run pytest --cov --cov-report=term-missing\n```\n\nReview the `MISS` column. For every uncovered line:\n\n1. Determine if it's a branch, exception handler, or edge case.\n2. Add a unit test specifically targeting that line.\n3. Re-run until coverage target is met (aim ≥ 90% for new code).\n\nTo run only the new tests first:\n\n```bash\nuv run pytest tests\u002Ftest_\u003Cmodule>.py -v\nuv run pytest tests\u002Fintegration\u002F -v\n```\n\n---\n\n## Step 6 — Lint and type-check\n\n```bash\nuv run ruff check src\u002F tests\u002F\nuv run pyrefly check\n```\n\nFix any errors before finalizing. Common issues:\n- Missing type annotations in `src\u002F` (`ANN` rules)\n- Imports that should be inside `TYPE_CHECKING` blocks (`TCH` rules)\n- Commented-out code (`ERA001`)\n\n---\n\n## Completion Checklist\n\n- [ ] Every public function has at least one negative test\n- [ ] All boolean flags tested in both states\n- [ ] All `except` blocks have a test that triggers them\n- [ ] Integration tests cover distinct user scenarios (not just repeats of unit tests)\n- [ ] Coverage ≥ 90% on new\u002Fchanged code\n- [ ] `ruff check` passes with no errors\n- [ ] `pyrefly check` passes with no errors\n",{"name":5,"description":7,"argument-hint":44},"module, function, or file to test (e.g. src\u002Fagent_skill_router\u002Fserver.py)","main","705df7f470db2b747c818526dfc33647a98bf8f0",".github\u002Fskills\u002Fpytest-coverage","https:\u002F\u002Fgithub.com\u002Fmariotaddeucci\u002Fagent-skill-router","https:\u002F\u002Fgithub.com\u002Fmariotaddeucci","Data Engineer","2026-05-02 20:00:09",{"source":8,"skillName":5,"commands":53,"prompt":63,"zipAvailable":64},[54,57,60],{"tool":55,"command":56},"npx","npx skills add mariotaddeucci\u002Fagent-skill-router --skill pytest-coverage",{"tool":58,"command":59},"bunx","bunx skills add mariotaddeucci\u002Fagent-skill-router --skill pytest-coverage",{"tool":61,"command":62},"pnpm","pnpm dlx skills add mariotaddeucci\u002Fagent-skill-router --skill pytest-coverage","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmariotaddeucci\u002Fagent-skill-router\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fpytest-coverage\u002FSKILL.md",true,[],[67,76,92],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":39},"01M71SBYQG20BYSCK6EKFCJFZX","write-tests","When asked to write unit or integration tests","https:\u002F\u002Fgithub.com\u002Fmariotaddeucci\u002Fagent-skill-router\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fworkspace\u002F.agents\u002Fskills\u002Fwrite-tests\u002FSKILL.md",[],[74,24,30,38,27,36,75],"write tests","integration",{"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":39},"01M71SBXA5XJST0HNXS6E68CGY","code-review","When asked to review code quality and find bugs","https:\u002F\u002Fgithub.com\u002Fmariotaddeucci\u002Fagent-skill-router\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fworkspace\u002F.agents\u002Fskills\u002Fcode-review\u002FSKILL.md",[],[83,84,85,86,87,88,36,89,90,91],"code","code review","review","review code","quality","find","bugs","code quality","find bugs",{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":39},"01M71SBS703K4WA5MDG1028CMY","skill-creator","Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.","https:\u002F\u002Fgithub.com\u002Fmariotaddeucci\u002Fagent-skill-router\u002Fblob\u002Fmain\u002Fsrc\u002Fagent_skill_router\u002Fskills\u002Fskill-creator\u002FSKILL.md",[],[99,100,101,102,103,104,105,36,106,107,108,109,110,111,112,113,114,115,116,117],"creator","skill creator","variance analysis","performance","improve","run evals","new","analysis","create","optimize","accuracy","run","edit","benchmark","a skill","existing skill","evals","modify","for"]