[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M699092NZA1D05RG5CRXA7EN":3,"skill-same:01M699092NZA1D05RG5CRXA7EN":97},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":51,"linkOnly":52,"markdownContent":53,"markdownBody":54,"frontMatter":55,"refName":59,"commitSha":60,"skillDirectory":61,"forksCount":62,"repositoryHtmlUrl":63,"repositoryHomepageUrl":64,"ownerHtmlUrl":65,"ownerBlogUrl":66,"ownerDescription":67,"updatedAt":68,"install":69,"resources":82},"01M699092NZA1D05RG5CRXA7EN","generate-python-runnability-test","Python 可运行性测试生成","Generates a lightweight `tests\u002Ftest_runnability.py` for a Python recipe. The test just imports the recipe's agent module and asserts that `root_agent is not None` (and `app is not None` if the module defines one). The skill parses agent.py with `ast` to figure out which import-time side effects need mocking (`vertexai.init`, `google.auth.default`) and which env vars need setting (`GOOGLE_CLOUD_PROJECT`, `INTEGRATION_TEST`), and only emits the boilerplate the recipe actually needs. Runs in dry-run (report + preview) and apply (write to disk) modes. Use when the user wants to \"add a runnability test\", \"generate test_runnability.py\", \"create a smoke test for the recipe\", or fix the missing-required-file failure from `python-validate-recipe.yml`.","为 Python recipe 生成一个轻量的 `tests\u002Ftest_runnability.py` 测试。该测试仅导入 recipe 的 agent 模块并断言 `root_agent is not None`（若模块定义了 `app`，则还断言 `app is not None`）。该技能使用 `ast` 解析 agent.py，以判断哪些导入时的副作用需要 mock（`vertexai.init`、`google.auth.default`）以及需要设置哪些环境变量（`GOOGLE_CLOUD_PROJECT`、`INTEGRATION_TEST`），只生成该 recipe 实际需要的样板代码。支持 dry-run（报告+预览）和 apply（写入磁盘）两种模式。当用户想要“添加可运行性测试”、“生成 test_runnability.py”、“为 recipe 创建冒烟测试”，或修复 `python-validate-recipe.yml` 中缺失必需文件的失败时使用。","google\u002Fadk-recipes","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M6990124CWS5627VKGSKJXRD",10626,"Apache-2.0",null,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fadk-recipes\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fgenerate-python-runnability-test\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障","SCENARIO","使用场景",[31,32,33,34,35,10,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"python","generate python runnability test","test","generate","when","effects","which","recipe","dry","app","project","time","preview","default","only","fix","disk","create","init","auth","2026-11-10 10:12:30",false,"---\nname: generate-python-runnability-test\ndescription: >\n  Generates a lightweight `tests\u002Ftest_runnability.py` for a Python recipe.\n  The test just imports the recipe's agent module and asserts that\n  `root_agent is not None` (and `app is not None` if the module defines\n  one). The skill parses agent.py with `ast` to figure out which import-time\n  side effects need mocking (`vertexai.init`, `google.auth.default`) and\n  which env vars need setting (`GOOGLE_CLOUD_PROJECT`, `INTEGRATION_TEST`),\n  and only emits the boilerplate the recipe actually needs. Runs in\n  dry-run (report + preview) and apply (write to disk) modes. Use when the\n  user wants to \"add a runnability test\", \"generate test_runnability.py\",\n  \"create a smoke test for the recipe\", or fix the missing-required-file\n  failure from `python-validate-recipe.yml`.\nmetadata:\n  author: Google\n  license: Apache-2.0\n  version: 1.1.0\n---\n\n# Generate Python Runnability Test\n\nUse this skill to create the `tests\u002Ftest_runnability.py` file that every Python recipe under `core\u002Fpython\u002F`, `contrib\u002Fpython\u002F`, or `plugins\u002F\u003Cvertical>\u002F\u003Csolution>\u002F` must ship (see `python-validate-recipe.yml` Check 4). The generated test is deliberately minimal — it just verifies the agent module imports and defines the expected globals. Business-logic testing lives elsewhere.\n\n---\n\n## What This Skill Does\n\nRuns `scripts\u002Fgenerate_runnability_test.py` against a recipe directory. Steps:\n\n1. **Locate `agent.py`.** Walks the recipe safely (excludes `.venv`, `venv`, `env`, `build`, `dist`, `__pycache__`, `node_modules`, `tests`, `*.egg-info`, and dot-directories) and picks the shallowest `agent.py` match. If none is found, errors out and suggests `--agent-file`. Only one file is generated per invocation.\n\n2. **Parse `agent.py` AND every ancestor package `__init__.py` with `ast`** to detect:\n   - **Top-level assignments** (agent.py only, per convention) — is `root_agent = ...` present? Is `app = ...` present?\n   - **Import-time calls** (agent.py + every ancestor `__init__.py`) — does `vertexai.init(...)` fire at module load? Does `google.auth.default()`? Every ancestor `__init__.py` is checked because Python runs each of them in order when the test does `import a.b.agent` (`a\u002F__init__.py`, then `a\u002Fb\u002F__init__.py`, then the module), so a side effect in any of them matters as much as one in `agent.py`. Historical bug closed by this: cross-session-memory has `_, project_id = google.auth.default()` in `__init__.py`; before, the scanner missed it and the generated test crashed in CI without ADC. Detection uses `ast.walk` (any depth), so it is intentionally broad — a call nested in a function body still flags the recipe; the resulting patch is a harmless no-op if it never fires at import time, whereas a missed import-time call would crash the generated test.\n   - **Env-var access** (agent.py + every ancestor `__init__.py`) — does the code *read* `GOOGLE_CLOUD_PROJECT` via `os.getenv` \u002F `os.environ.get` \u002F `os.environ[\"…\"]`? Only reads count: an `os.environ[\"…\"] = value` write means the recipe sets its own value and doesn't depend on the test providing one, so it's ignored.\n\n3. **Scan all source `.py` files** in the recipe directory tree (same safe walker) for `INTEGRATION_TEST` env-var reads. This is a per-package convention: `agent.py` often calls a helper (e.g. `retrievers.create_search_tool`) at module load, and THAT helper — which may live anywhere in the recipe tree, not necessarily beside `agent.py` — is what reads `INTEGRATION_TEST`. Restricting the scan to `agent.py` would miss it.\n\n4. **Emit the test.** Two shapes:\n   - **Minimal** (no side effects detected) — module-level `import \u003Cmodule>` + `assert root_agent is not None` (and `app is not None` if present).\n   - **Guarded** (any side effect detected) — env-var `setdefault` calls at the top of the test function; a `with patch(...):` block around the import listing every patch needed (`patch(\"vertexai.init\")` when vertexai is used, `patch(\"google.auth.default\", return_value=(MagicMock(), \"test-project\"))` when the recipe touches `google.auth`); and assertions **outside** the `with` block (the patches are only needed during import; keeping them active around assertions would be misleading).\n\n   The `google.auth.default` patch is what makes the test survive a recipe that calls `google.auth.default()` unconditionally at import time (like cross-session-memory's `__init__.py`). Just setting `GOOGLE_CLOUD_PROJECT` isn't enough for that pattern — the call still fires and still needs valid ADC — hence the patch.\n\n   Emission is post-processed through `ruff format` when available, so multi-patch `with (...):` blocks come out already wrapped per the repo's ruff config.\n\n5. **Check that the import can actually resolve.** The generated test does `import \u003Cmodule_name>`, which only works if the RECIPE ROOT is on `sys.path`. That is not automatic — under pytest's default `prepend` import mode only the test file's own directory (`\u003Crecipe>\u002Ftests`) is inserted. The recipe root gets there in one of these ways, reported as `import_support`:\n\n   | `import_support` | Meaning |\n   |---|---|\n   | `installable` | `pyproject.toml` declares a `[build-system]`, so `uv sync` installs the project and the package is importable. |\n   | `pythonpath-ini` | `[tool.pytest.ini_options].pythonpath` includes `\".\"`. |\n   | `existing-conftest` | A `conftest.py` sits at the recipe root (sufficient whatever it contains — pytest puts each conftest's own directory on `sys.path`, and for that one it IS the recipe root), or a `tests\u002Fconftest.py` that demonstrably extends `sys.path`. |\n   | `generated-conftest` | None of the above held, so the skill wrote `tests\u002Fconftest.py` with a path shim. |\n\n   A `tests\u002Fconftest.py` is judged by AST, not text search: it counts only if it really touches `sys.path`, so a comment or docstring that merely *mentions* `sys.path` cannot wrongly certify it.\n\n   **Historical bug closed by this:** the recipe root being importable was assumed rather than checked. A recipe with no `[build-system]` — common for vertical plugins under `plugins\u002F`, where code lives in a plain `scripts\u002F` directory rather than an installed package — got a test that always died with `ModuleNotFoundError`, while `prepare-python-recipe`'s `py_compile` verification still reported success.\n\n   Adding a `[build-system]` is the better fix; the generated conftest says so and tells the maintainer to delete it once they do.\n\n6. **Write it** to `\u003Crecipe-dir>\u002Ftests\u002Ftest_runnability.py` (creating `tests\u002F` if needed), plus `tests\u002Fconftest.py` when step 5 called for it. Refuses to clobber an existing file unless `--overwrite` is passed.\n\n### Edit safety\n\n- No files outside the target recipe directory are read (beyond the recipe's own `.py` files) or written.\n- Existing `tests\u002Ftest_runnability.py` is never silently overwritten. The user must explicitly opt in with `--overwrite`.\n- An existing `tests\u002Fconftest.py` is **never** overwritten, not even with `--overwrite` — the skill reports `conftest_action: skipped` and warns instead. A conftest it did not write may do something clobbering would break.\n- `tests\u002F` directory is created if missing (`mkdir -p` equivalent). No other directory or file is added.\n- Ruff-clean by construction — the generated file passes `ruff check` and `ruff format --check` under the root config.\n\n---\n\n## Rules for the Agent\n\n1. **Always use the script — never hand-write `tests\u002Ftest_runnability.py` yourself.** The skill exists to keep the boilerplate consistent across recipes.\n\n2. **Ask for the recipe directory** if the user hasn't given one. Recipe roots live under `core\u002Fpython\u002F\u003Cname>\u002F`, `contrib\u002Fpython\u002F\u003Cname>\u002F`, or `plugins\u002F\u003Cvertical>\u002F\u003Csolution>\u002F`.\n\n3. **Always start with `--dry-run`** unless the user has explicitly said \"apply\", \"generate it\", \"just do it\", or equivalent. Show them what would land before writing.\n\n4. **Report only what matters.** Render a compact 3-column Markdown table (Rule \u002F Status \u002F Details) summarising the action plus the detections. Do NOT dump the raw JSON or the raw generated Python. Include the generated file's content as a fenced code block below the table so the user can review before deciding.\n\n5. **If action is `refused_overwrite`**, tell the user the file already exists and offer to re-run with `--overwrite`. Don't do it silently.\n\n6. **If action is `error`**, surface the message verbatim and stop. Common cases: no `agent.py` found (suggest `--agent-file`), parse error in `agent.py`.\n\n7. **Offer to apply** after a dry-run. Do NOT paste the raw command as a copy-and-paste snippet for the user; ask something like \"Want me to write this file?\" and if they agree, run apply yourself.\n\n8. **After apply mode succeeds**, remind the user to run the test locally to confirm it passes:\n\n   ```\n   cd \u003CRECIPE_DIR> && uv run pytest tests\u002Ftest_runnability.py -v\n   ```\n\n9. **Do not commit any changes.** Show the diff or file contents; let the user commit.\n\n---\n\n## Input\n\n| Field | Required | Description |\n|---|---|---|\n| `--recipe-dir` | Yes | Path to the recipe root (e.g. `core\u002Fpython\u002Fcross-session-memory`, `contrib\u002Fpython\u002Fmy-recipe`, `plugins\u002Fretail\u002Fstore-ops`). |\n| `--dry-run` | No | Print the JSON report (with the generated content in `test_content`) without writing any file. |\n| `--overwrite` | No | Overwrite an existing `tests\u002Ftest_runnability.py`. Default: refuse and exit 1. |\n| `--agent-file` | No | Override auto-detection of the entry-point file. Path is relative to `--recipe-dir` (or absolute). Use when the recipe uses a non-standard layout (rare — \u003C2% of recipes). |\n\n---\n\n## Run\n\n### Dry-run (start here)\n\n```bash\nuv run --no-project python3 .agents\u002Fskills\u002Fgenerate-python-runnability-test\u002Fscripts\u002Fgenerate_runnability_test.py \\\n  --recipe-dir \u003CRECIPE_DIR> --dry-run\n```\n\nOutput on stdout: JSON with `agent_file`, `module_name`, `detections`, `import_support`, `conftest_path`, `conftest_action` (`would_write` \u002F `wrote` \u002F `skipped` \u002F `null`), `test_content`, `action` (`would_write` \u002F `refused_overwrite` \u002F `error`), `message`, and `warnings` (a list — surface every entry to the user). Exit code `0`.\n\nNote: no `--with` flags are needed — the script only uses Python's stdlib (`ast`, `argparse`, `json`, `pathlib`, `dataclasses`, `os`, `sys`, `subprocess`, `textwrap`). `uv run --no-project python3` is used (rather than a bare `python3`) to guarantee a modern managed interpreter, consistent with the other Python recipe skills; the system `python3` on macOS can still be an old version. Dry-runs remain cheap and side-effect-free.\n\n### Apply\n\n```bash\nuv run --no-project python3 .agents\u002Fskills\u002Fgenerate-python-runnability-test\u002Fscripts\u002Fgenerate_runnability_test.py \\\n  --recipe-dir \u003CRECIPE_DIR>\n```\n\nWrites `\u003CRECIPE_DIR>\u002Ftests\u002Ftest_runnability.py`. Refuses if the file exists (exit `1`).\n\n### Apply with overwrite\n\n```bash\nuv run --no-project python3 .agents\u002Fskills\u002Fgenerate-python-runnability-test\u002Fscripts\u002Fgenerate_runnability_test.py \\\n  --recipe-dir \u003CRECIPE_DIR> --overwrite\n```\n\n### Override the entry-point file (rare)\n\n```bash\nuv run --no-project python3 .agents\u002Fskills\u002Fgenerate-python-runnability-test\u002Fscripts\u002Fgenerate_runnability_test.py \\\n  --recipe-dir \u003CRECIPE_DIR> --agent-file some\u002Fother\u002Fentry.py --dry-run\n```\n\nPath is relative to `--recipe-dir` or absolute. The generated import uses the module path derived from the relative location (e.g. `some\u002Fother\u002Fentry.py` → `import some.other.entry`).\n\n---\n\n## Respond\n\nDo not dump raw JSON. Render a compact table summarising the action and the detections, then include the generated file's content as a fenced code block below.\n\n### Table shape\n\n| Rule | Status | Details |\n|---|---|---|\n\n- **Rule** — a short label for what's being reported: `agent-file`, `module`, `detections`, `write`. Use backticks for clarity.\n- **Status** — `ok` \u002F `would_write` \u002F `wrote` \u002F `refused_overwrite` \u002F `error`. No emoji unless the user has asked.\n- **Details** — compact prose. For `detections`, list only what was found (e.g. \"root_agent, app, needs vertexai patch + GCP project env + INTEGRATION_TEST env\"). Don't list what was NOT found.\n\n### After the table\n\n- Show the generated `test_content` as a fenced Python code block so the user can review it before deciding.\n\n### Closing action\n\n- **`would_write`** (dry-run) — **offer to apply** yourself. Do NOT paste the raw command. Ask \"Want me to write this file?\" If the user agrees, run the apply command yourself and render the resulting report as another compact confirmation. If they decline, stop.\n- **`refused_overwrite`** — tell the user the file already exists and offer to re-run with `--overwrite`. Do NOT overwrite silently. If they agree, run with `--overwrite`.\n- **`error`** — surface the message verbatim and stop. Do not attempt to work around it.\n- **`wrote`** (apply) — end with:\n\n  ```\n  Next steps:\n    cd \u003CRECIPE_DIR> && uv run pytest tests\u002Ftest_runnability.py -v\n    git diff                                                          # review before committing\n  ```\n\nThen stop. Do not commit. Do not run any further tools. End your turn.\n","# Generate Python Runnability Test\n\nUse this skill to create the `tests\u002Ftest_runnability.py` file that every Python recipe under `core\u002Fpython\u002F`, `contrib\u002Fpython\u002F`, or `plugins\u002F\u003Cvertical>\u002F\u003Csolution>\u002F` must ship (see `python-validate-recipe.yml` Check 4). The generated test is deliberately minimal — it just verifies the agent module imports and defines the expected globals. Business-logic testing lives elsewhere.\n\n---\n\n## What This Skill Does\n\nRuns `scripts\u002Fgenerate_runnability_test.py` against a recipe directory. Steps:\n\n1. **Locate `agent.py`.** Walks the recipe safely (excludes `.venv`, `venv`, `env`, `build`, `dist`, `__pycache__`, `node_modules`, `tests`, `*.egg-info`, and dot-directories) and picks the shallowest `agent.py` match. If none is found, errors out and suggests `--agent-file`. Only one file is generated per invocation.\n\n2. **Parse `agent.py` AND every ancestor package `__init__.py` with `ast`** to detect:\n   - **Top-level assignments** (agent.py only, per convention) — is `root_agent = ...` present? Is `app = ...` present?\n   - **Import-time calls** (agent.py + every ancestor `__init__.py`) — does `vertexai.init(...)` fire at module load? Does `google.auth.default()`? Every ancestor `__init__.py` is checked because Python runs each of them in order when the test does `import a.b.agent` (`a\u002F__init__.py`, then `a\u002Fb\u002F__init__.py`, then the module), so a side effect in any of them matters as much as one in `agent.py`. Historical bug closed by this: cross-session-memory has `_, project_id = google.auth.default()` in `__init__.py`; before, the scanner missed it and the generated test crashed in CI without ADC. Detection uses `ast.walk` (any depth), so it is intentionally broad — a call nested in a function body still flags the recipe; the resulting patch is a harmless no-op if it never fires at import time, whereas a missed import-time call would crash the generated test.\n   - **Env-var access** (agent.py + every ancestor `__init__.py`) — does the code *read* `GOOGLE_CLOUD_PROJECT` via `os.getenv` \u002F `os.environ.get` \u002F `os.environ[\"…\"]`? Only reads count: an `os.environ[\"…\"] = value` write means the recipe sets its own value and doesn't depend on the test providing one, so it's ignored.\n\n3. **Scan all source `.py` files** in the recipe directory tree (same safe walker) for `INTEGRATION_TEST` env-var reads. This is a per-package convention: `agent.py` often calls a helper (e.g. `retrievers.create_search_tool`) at module load, and THAT helper — which may live anywhere in the recipe tree, not necessarily beside `agent.py` — is what reads `INTEGRATION_TEST`. Restricting the scan to `agent.py` would miss it.\n\n4. **Emit the test.** Two shapes:\n   - **Minimal** (no side effects detected) — module-level `import \u003Cmodule>` + `assert root_agent is not None` (and `app is not None` if present).\n   - **Guarded** (any side effect detected) — env-var `setdefault` calls at the top of the test function; a `with patch(...):` block around the import listing every patch needed (`patch(\"vertexai.init\")` when vertexai is used, `patch(\"google.auth.default\", return_value=(MagicMock(), \"test-project\"))` when the recipe touches `google.auth`); and assertions **outside** the `with` block (the patches are only needed during import; keeping them active around assertions would be misleading).\n\n   The `google.auth.default` patch is what makes the test survive a recipe that calls `google.auth.default()` unconditionally at import time (like cross-session-memory's `__init__.py`). Just setting `GOOGLE_CLOUD_PROJECT` isn't enough for that pattern — the call still fires and still needs valid ADC — hence the patch.\n\n   Emission is post-processed through `ruff format` when available, so multi-patch `with (...):` blocks come out already wrapped per the repo's ruff config.\n\n5. **Check that the import can actually resolve.** The generated test does `import \u003Cmodule_name>`, which only works if the RECIPE ROOT is on `sys.path`. That is not automatic — under pytest's default `prepend` import mode only the test file's own directory (`\u003Crecipe>\u002Ftests`) is inserted. The recipe root gets there in one of these ways, reported as `import_support`:\n\n   | `import_support` | Meaning |\n   |---|---|\n   | `installable` | `pyproject.toml` declares a `[build-system]`, so `uv sync` installs the project and the package is importable. |\n   | `pythonpath-ini` | `[tool.pytest.ini_options].pythonpath` includes `\".\"`. |\n   | `existing-conftest` | A `conftest.py` sits at the recipe root (sufficient whatever it contains — pytest puts each conftest's own directory on `sys.path`, and for that one it IS the recipe root), or a `tests\u002Fconftest.py` that demonstrably extends `sys.path`. |\n   | `generated-conftest` | None of the above held, so the skill wrote `tests\u002Fconftest.py` with a path shim. |\n\n   A `tests\u002Fconftest.py` is judged by AST, not text search: it counts only if it really touches `sys.path`, so a comment or docstring that merely *mentions* `sys.path` cannot wrongly certify it.\n\n   **Historical bug closed by this:** the recipe root being importable was assumed rather than checked. A recipe with no `[build-system]` — common for vertical plugins under `plugins\u002F`, where code lives in a plain `scripts\u002F` directory rather than an installed package — got a test that always died with `ModuleNotFoundError`, while `prepare-python-recipe`'s `py_compile` verification still reported success.\n\n   Adding a `[build-system]` is the better fix; the generated conftest says so and tells the maintainer to delete it once they do.\n\n6. **Write it** to `\u003Crecipe-dir>\u002Ftests\u002Ftest_runnability.py` (creating `tests\u002F` if needed), plus `tests\u002Fconftest.py` when step 5 called for it. Refuses to clobber an existing file unless `--overwrite` is passed.\n\n### Edit safety\n\n- No files outside the target recipe directory are read (beyond the recipe's own `.py` files) or written.\n- Existing `tests\u002Ftest_runnability.py` is never silently overwritten. The user must explicitly opt in with `--overwrite`.\n- An existing `tests\u002Fconftest.py` is **never** overwritten, not even with `--overwrite` — the skill reports `conftest_action: skipped` and warns instead. A conftest it did not write may do something clobbering would break.\n- `tests\u002F` directory is created if missing (`mkdir -p` equivalent). No other directory or file is added.\n- Ruff-clean by construction — the generated file passes `ruff check` and `ruff format --check` under the root config.\n\n---\n\n## Rules for the Agent\n\n1. **Always use the script — never hand-write `tests\u002Ftest_runnability.py` yourself.** The skill exists to keep the boilerplate consistent across recipes.\n\n2. **Ask for the recipe directory** if the user hasn't given one. Recipe roots live under `core\u002Fpython\u002F\u003Cname>\u002F`, `contrib\u002Fpython\u002F\u003Cname>\u002F`, or `plugins\u002F\u003Cvertical>\u002F\u003Csolution>\u002F`.\n\n3. **Always start with `--dry-run`** unless the user has explicitly said \"apply\", \"generate it\", \"just do it\", or equivalent. Show them what would land before writing.\n\n4. **Report only what matters.** Render a compact 3-column Markdown table (Rule \u002F Status \u002F Details) summarising the action plus the detections. Do NOT dump the raw JSON or the raw generated Python. Include the generated file's content as a fenced code block below the table so the user can review before deciding.\n\n5. **If action is `refused_overwrite`**, tell the user the file already exists and offer to re-run with `--overwrite`. Don't do it silently.\n\n6. **If action is `error`**, surface the message verbatim and stop. Common cases: no `agent.py` found (suggest `--agent-file`), parse error in `agent.py`.\n\n7. **Offer to apply** after a dry-run. Do NOT paste the raw command as a copy-and-paste snippet for the user; ask something like \"Want me to write this file?\" and if they agree, run apply yourself.\n\n8. **After apply mode succeeds**, remind the user to run the test locally to confirm it passes:\n\n   ```\n   cd \u003CRECIPE_DIR> && uv run pytest tests\u002Ftest_runnability.py -v\n   ```\n\n9. **Do not commit any changes.** Show the diff or file contents; let the user commit.\n\n---\n\n## Input\n\n| Field | Required | Description |\n|---|---|---|\n| `--recipe-dir` | Yes | Path to the recipe root (e.g. `core\u002Fpython\u002Fcross-session-memory`, `contrib\u002Fpython\u002Fmy-recipe`, `plugins\u002Fretail\u002Fstore-ops`). |\n| `--dry-run` | No | Print the JSON report (with the generated content in `test_content`) without writing any file. |\n| `--overwrite` | No | Overwrite an existing `tests\u002Ftest_runnability.py`. Default: refuse and exit 1. |\n| `--agent-file` | No | Override auto-detection of the entry-point file. Path is relative to `--recipe-dir` (or absolute). Use when the recipe uses a non-standard layout (rare — \u003C2% of recipes). |\n\n---\n\n## Run\n\n### Dry-run (start here)\n\n```bash\nuv run --no-project python3 .agents\u002Fskills\u002Fgenerate-python-runnability-test\u002Fscripts\u002Fgenerate_runnability_test.py \\\n  --recipe-dir \u003CRECIPE_DIR> --dry-run\n```\n\nOutput on stdout: JSON with `agent_file`, `module_name`, `detections`, `import_support`, `conftest_path`, `conftest_action` (`would_write` \u002F `wrote` \u002F `skipped` \u002F `null`), `test_content`, `action` (`would_write` \u002F `refused_overwrite` \u002F `error`), `message`, and `warnings` (a list — surface every entry to the user). Exit code `0`.\n\nNote: no `--with` flags are needed — the script only uses Python's stdlib (`ast`, `argparse`, `json`, `pathlib`, `dataclasses`, `os`, `sys`, `subprocess`, `textwrap`). `uv run --no-project python3` is used (rather than a bare `python3`) to guarantee a modern managed interpreter, consistent with the other Python recipe skills; the system `python3` on macOS can still be an old version. Dry-runs remain cheap and side-effect-free.\n\n### Apply\n\n```bash\nuv run --no-project python3 .agents\u002Fskills\u002Fgenerate-python-runnability-test\u002Fscripts\u002Fgenerate_runnability_test.py \\\n  --recipe-dir \u003CRECIPE_DIR>\n```\n\nWrites `\u003CRECIPE_DIR>\u002Ftests\u002Ftest_runnability.py`. Refuses if the file exists (exit `1`).\n\n### Apply with overwrite\n\n```bash\nuv run --no-project python3 .agents\u002Fskills\u002Fgenerate-python-runnability-test\u002Fscripts\u002Fgenerate_runnability_test.py \\\n  --recipe-dir \u003CRECIPE_DIR> --overwrite\n```\n\n### Override the entry-point file (rare)\n\n```bash\nuv run --no-project python3 .agents\u002Fskills\u002Fgenerate-python-runnability-test\u002Fscripts\u002Fgenerate_runnability_test.py \\\n  --recipe-dir \u003CRECIPE_DIR> --agent-file some\u002Fother\u002Fentry.py --dry-run\n```\n\nPath is relative to `--recipe-dir` or absolute. The generated import uses the module path derived from the relative location (e.g. `some\u002Fother\u002Fentry.py` → `import some.other.entry`).\n\n---\n\n## Respond\n\nDo not dump raw JSON. Render a compact table summarising the action and the detections, then include the generated file's content as a fenced code block below.\n\n### Table shape\n\n| Rule | Status | Details |\n|---|---|---|\n\n- **Rule** — a short label for what's being reported: `agent-file`, `module`, `detections`, `write`. Use backticks for clarity.\n- **Status** — `ok` \u002F `would_write` \u002F `wrote` \u002F `refused_overwrite` \u002F `error`. No emoji unless the user has asked.\n- **Details** — compact prose. For `detections`, list only what was found (e.g. \"root_agent, app, needs vertexai patch + GCP project env + INTEGRATION_TEST env\"). Don't list what was NOT found.\n\n### After the table\n\n- Show the generated `test_content` as a fenced Python code block so the user can review it before deciding.\n\n### Closing action\n\n- **`would_write`** (dry-run) — **offer to apply** yourself. Do NOT paste the raw command. Ask \"Want me to write this file?\" If the user agrees, run the apply command yourself and render the resulting report as another compact confirmation. If they decline, stop.\n- **`refused_overwrite`** — tell the user the file already exists and offer to re-run with `--overwrite`. Do NOT overwrite silently. If they agree, run with `--overwrite`.\n- **`error`** — surface the message verbatim and stop. Do not attempt to work around it.\n- **`wrote`** (apply) — end with:\n\n  ```\n  Next steps:\n    cd \u003CRECIPE_DIR> && uv run pytest tests\u002Ftest_runnability.py -v\n    git diff                                                          # review before committing\n  ```\n\nThen stop. Do not commit. Do not run any further tools. End your turn.\n",{"name":5,"metadata":56,"description":58},{"author":13,"license":16,"version":57},"1.1.0","Generates a lightweight `tests\u002Ftest_runnability.py` for a Python recipe. The test just imports the recipe's agent module and asserts that `root_agent is not None` (and `app is not None` if the module defines one). The skill parses agent.py with `ast` to figure out which import-time side effects need mocking (`vertexai.init`, `google.auth.default`) and which env vars need setting (`GOOGLE_CLOUD_PROJECT`, `INTEGRATION_TEST`), and only emits the boilerplate the recipe actually needs. Runs in dry-run (report + preview) and apply (write to disk) modes. Use when the user wants to \"add a runnability test\", \"generate test_runnability.py\", \"create a smoke test for the recipe\", or fix the missing-required-file failure from `python-validate-recipe.yml`.\n","main","665f7b2a181686f2ba3c6c942e9b30a084b12ec3",".agents\u002Fskills\u002Fgenerate-python-runnability-test",2962,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fadk-recipes","https:\u002F\u002Fadk.dev","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-14 04:01:32",{"source":9,"skillName":5,"commands":70,"prompt":80,"zipAvailable":81},[71,74,77],{"tool":72,"command":73},"npx","npx skills add google\u002Fadk-recipes --skill generate-python-runnability-test",{"tool":75,"command":76},"bunx","bunx skills add google\u002Fadk-recipes --skill generate-python-runnability-test",{"tool":78,"command":79},"pnpm","pnpm dlx skills add google\u002Fadk-recipes --skill generate-python-runnability-test","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fadk-recipes\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fgenerate-python-runnability-test\u002FSKILL.md",true,[83,89,93],{"path":84,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":87,"sourceHtmlUrl":88},"scripts\u002Fgenerate_runnability_test.py","SCRIPT","脚本",39732,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fadk-recipes\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fgenerate-python-runnability-test\u002Fscripts\u002Fgenerate_runnability_test.py",{"path":90,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":91,"sourceHtmlUrl":92},"tests\u002Fconftest.py",919,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fadk-recipes\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fgenerate-python-runnability-test\u002Ftests\u002Fconftest.py",{"path":94,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":95,"sourceHtmlUrl":96},"tests\u002Ftest_generate_runnability_test.py",6709,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fadk-recipes\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fgenerate-python-runnability-test\u002Ftests\u002Ftest_generate_runnability_test.py",[98,121,148,178,203,232],{"skillNo":99,"name":100,"nameZh":101,"description":102,"descriptionZh":103,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":104,"categories":105,"keywords":112,"publishedAt":51},"01M6991EKEG8XEM3VWW4VGV0ZQ","retail-virtual-tryon","零售虚拟试穿智能体开发","Creates virtual try-on agents supporting image and video (catwalk animation) try-ons on Google Cloud (Gemini image models and Veo on Gemini Enterprise Agent Platform). Handles resource setup, user photo uploading, image\u002Fvideo generation pipelines, local testing, and evaluation.","创建虚拟试穿智能体，在 Google Cloud 上支持图片和视频（走秀动画）试穿（使用 Gemini 图像模型和 Gemini Enterprise Agent Platform 上的 Veo）。负责资源设置、用户照片上传、图片\u002F视频生成流水线、本地测试和评估。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fadk-recipes\u002Fblob\u002Fmain\u002Fplugins\u002Fretail\u002Fskills\u002Fvirtual-tryon\u002FSKILL.md",[106,109],{"categoryNo":107,"categoryName":108,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师",{"categoryNo":110,"categoryName":111,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BSAA4FBTWZP6X98STEHG99","智能体开发",[113,114,115,10,116,117,118,119,120],"retail virtual tryon","google cloud","image","testing","gemini","genai","adk","gemini enterprise agent platform",{"skillNo":122,"name":123,"nameZh":124,"description":125,"descriptionZh":126,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":127,"categories":128,"keywords":131,"publishedAt":51},"01M6991ABTZW7FCPREXY8GD4RG","retail-product-search","零售产品搜索智能体构建","Creates product search agents with semantic search and RAG on Google Cloud (Vector Search on Gemini Enterprise Agent Platform, BigQuery, embeddings). Use when the user wants to \"build a product search agent\", \"create an e-commerce search\", \"make a shopping assistant\", \"set up semantic catalog discovery\", \"ingest products into Vector Search\", or \"deploy a retail RAG agent\". Handles the full pipeline: catalog data ingestion to BigQuery, Gemini Enterprise Agent Platform Vector Search collection setup, ADK agent scaffolding, evaluation, and Cloud Run deployment.","在 Google Cloud 上创建具备语义搜索和 RAG 能力的产品搜索智能体（基于 Gemini Enterprise Agent Platform 上的 Vector Search、BigQuery 和 embeddings）。当用户想要“构建产品搜索智能体”“创建电商搜索”“制作购物助手”“搭建语义化目录发现”“将产品导入 Vector Search”或“部署零售 RAG 智能体”时使用。涵盖完整流程：目录数据导入 BigQuery、Gemini Enterprise Agent Platform 的 Vector Search 集合配置、ADK 智能体脚手架搭建、评估以及 Cloud Run 部署。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fadk-recipes\u002Fblob\u002Fmain\u002Fplugins\u002Fretail\u002Fskills\u002Fproduct-search\u002FSKILL.md",[129,130],{"categoryNo":107,"categoryName":108,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":110,"categoryName":111,"taxonomyType":28,"taxonomyTypeDesc":29},[132,133,134,120,119,117,135,10,114,136,35,137,138,139,140,141,142,143,144,145,146,48,147],"retail product search","product","search","assistant","pipeline","commerce","scaffolding","shopping","up","ingestion","collection","SET","vector","apache","run","rag",{"skillNo":149,"name":150,"nameZh":151,"description":152,"descriptionZh":153,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":154,"categories":155,"keywords":162,"publishedAt":51},"01M69918HZCYZHD7K9Y9ZSD287","routines","定时例行任务管理","Use for a recurring unattended task (cron; pull data, open a PR, post a digest), or to test\u002Fdry-run a routine first. Explains authoring and testing via the routine tool.","用于周期性、无人值守的任务（cron；如拉取数据、创建 PR、发布摘要），或先对某个例行程序进行测试／试运行。介绍如何通过 routine 工具编写和测试例行任务。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fadk-recipes\u002Fblob\u002Fmain\u002Fcore\u002Fpython\u002Flong-horizon-harness\u002Fhorizon\u002Fbuiltin_skills\u002Froutines\u002FSKILL.md",[156,159],{"categoryNo":157,"categoryName":158,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师",{"categoryNo":160,"categoryName":161,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BSFHC0DJXKNN0QBZDDS4K9","定时任务与自动化编排",[150,39,163,164,165,166,167,168,169,170,171,172,173,174,175,176,146,33,116,177],"routine","for","post","via","authoring","digest","task","use","recurring","pr","tool","open","first","pull","data",{"skillNo":179,"name":180,"nameZh":181,"description":182,"descriptionZh":183,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":184,"categories":185,"keywords":192,"publishedAt":51},"01M699178ZDFDXEZ11DG1Y9CTF","policy","工具权限策略检查","Inspect the per-workspace tool-policy overlay (.lha\u002Fpolicies.jsonl) that gates destructive or sensitive tool calls, and tell the user what to change if they want a rule added or removed.","检查按工作区划分的工具策略覆盖层（.lha\u002Fpolicies.jsonl），该覆盖层用于对破坏性或敏感的工具调用进行门控，并告知用户若想新增或删除规则应修改哪些内容。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fadk-recipes\u002Fblob\u002Fmain\u002Fcore\u002Fpython\u002Flong-horizon-harness\u002Fhorizon\u002Fbuiltin_skills\u002Fpolicy\u002FSKILL.md",[186,189],{"categoryNo":187,"categoryName":188,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BR4MYFKGCC4WCWVJ50KJ2C","安全工程师",{"categoryNo":190,"categoryName":191,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRN0CV1NMDZ5TEJX1GVM29","插件与技能管理",[180,193,194,195,196,197,198,199,200,201,173,202],"gates","overlay","tool calls","inspect","calls","jsonl","rule","user","workspace","change",{"skillNo":204,"name":205,"nameZh":206,"description":207,"descriptionZh":208,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":209,"categories":210,"keywords":217,"publishedAt":51},"01M69915F8591SQBA1ZHK6NDA7","google-workspace","Google Workspace 办公套件操作","Read\u002Fwrite Google Drive, Docs, Sheets, Gmail, Calendar, Chat, Tasks, Slides via the `gws` CLI. Needs an OAuth client or service account configured first. Use for any Google Workspace task.","通过 `gws` 命令行工具读写 Google Drive、Docs、Sheets、Gmail、Calendar、Chat、Tasks、Slides。需先配置 OAuth 客户端或服务账号。适用于任何 Google Workspace 任务。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fadk-recipes\u002Fblob\u002Fmain\u002Fcore\u002Fpython\u002Flong-horizon-harness\u002Fhorizon\u002Fbuiltin_skills\u002Fgoogle-workspace\u002FSKILL.md",[211,214],{"categoryNo":212,"categoryName":213,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TPH3VQWKQZXV7EPF8VZ","办公行政人员",{"categoryNo":215,"categoryName":216,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQGD3WKAZKP84N22M6Q0DM","办公管理与协作",[201,218,10,219,170,220,221,222,175,223,224,225,226,227,169,164,228,229,166,230,231],"google workspace","calendar","write","read","slides","OAuth","tasks","docs","cli","gmail","sheets","client","chat","gws",{"skillNo":233,"name":234,"nameZh":235,"description":236,"descriptionZh":237,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":238,"categories":239,"keywords":242,"publishedAt":51},"01M69914416KTZ6Z0WD425YYJ0","find-skills","智能体技能发现与安装","Discover\u002Finstall NEW agent skills from external sources (skills.sh). Use for capabilities you lack, e.g. \"find a skill for X\". Do NOT use to list skills you already have; see `\u003Cavailable_skills>`.","从外部来源（skills.sh）发现并安装全新的智能体技能。用于弥补自身缺失的能力，例如“找一个能做 X 的技能”。不要用于列出你已有的技能；请参阅 `\u003Cavailable_skills>`。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fadk-recipes\u002Fblob\u002Fmain\u002Fcore\u002Fpython\u002Flong-horizon-harness\u002Fhorizon\u002Fbuiltin_skills\u002Ffind-skills\u002FSKILL.md",[240,241],{"categoryNo":190,"categoryName":191,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":107,"categoryName":108,"taxonomyType":23,"taxonomyTypeDesc":24},[243,244,164,245,246,247,248,249,170,250,251,252,253],"find skills","find","you","sources","discover","new agent","do","install","list","list skills","capabilities"]