# Generate Python Runnability Test

Generates a lightweight `tests/test_runnability.py` for a Python recipe.

- Repository: https://github.com/google/adk-recipes (10565 stars)
- Category: Testing
- License: Apache-2.0
- Last updated: 2026-11-01
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add google/adk-recipes --skill generate-python-runnability-test -g -a claude-code -y`
Codex: `npx skills add google/adk-recipes --skill generate-python-runnability-test -g -a codex -y`
Cursor: `npx skills add google/adk-recipes --skill generate-python-runnability-test -g -a cursor -y`
Gemini CLI: `npx skills add google/adk-recipes --skill generate-python-runnability-test -g -a gemini-cli -y`

## Description

Generates a lightweight `tests/test_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`.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Generate Python Runnability Test

Use this skill to create the `tests/test_runnability.py` file that every Python recipe under `core/python/`, `contrib/python/`, or `plugins/<vertical>/<solution>/` 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.

---

## What This Skill Does

Runs `scripts/generate_runnability_test.py` against a recipe directory. Steps:

1. **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.

The rest: https://github.com/google/adk-recipes/blob/HEAD/.agents/skills/generate-python-runnability-test/SKILL.md
