google-adk
Skill35 starsChanged 6 months agoMITView on GitHub
Google ADK (Agent Development Kit) Python skill. Use when building AI agents with google-adk, Gemini models, SequentialAgent, ParallelAgent, LoopAgent, FunctionTool, McpToolset, session management, memory services, artifact storage, callbacks, or FastAPI integration for ADK agents.
- Reads credentials
4 other projects use a version of this.
Adopted by
Most recently taken up by
- Mindrally/skillstheir own version, first seen Oct 8, 2026
- sheikh-mohammad/agent-factory-claude-skillstheir own version, first seen Aug 4, 2026
- milistu/agent-skillstheir own version, first seen Mar 2, 2026
- prakhar1989/adk-skilltheir own version, first seen Jan 16, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- Mindrally/skills★ 275same name
- milistu/agent-skills★ 8same name
- sheikh-mohammad/agent-factory-claude-skills★ 6same name
- prakhar1989/adk-skill★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository157 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- a2ui-angularSkill
- accessibility-auditSkill
- adk-deploy-guideSkill
- adk-dev-guideSkill
- adk-eval-guideSkill
- adk-observability-guideSkill
- agentic-ai-coding-standardSkill
- agentic-ai-devSkill
- ai-auditSkill
- ai-chatSkill
- ai-decision-recordSkill
- ai-incident-responseSkill
- ai-launch-checkSkill
- ai-playbookSkill
- angular-best-practicesSkill
- angularSkill
- angular-spaSkill
- angular-ui-patternsSkill
- api-design-principlesSkill
- app-store-optimizationSkill
- architect-reviewSkill
- architecture-decision-recordsSkill
- architecture-designSkill
- asc-cli-usageSkill
- asc-crash-triageSkill
- asc-id-resolverSkill
- asc-release-flowSkill
- asc-signing-setupSkill
- asc-submission-healthSkill
- asc-testflight-orchestrationSkill
- browser-testingSkill
- changelog-generatorSkill
- claude-actions-auditorSkill
- clean-codeSkill
- codebase-onboardingSkill
- code-explainerSkill
- code-reviewerSkill
- code-simplifierSkill
- comment-analyzerSkill
- database-schema-designerSkill
- ddd-architectSkill
- decision-frameworksSkill
- dedup-code-agentSkill
- deployment-ci-cdSkill
- design-systemSkill
- dockerSkill
- documentation-generationSkill
- domain-finderSkill
- error-detectiveSkill
- eval-guideSkill
- feature-forgeSkill
- firebase-basicsSkill
- firebase-hosting-basicsSkill
- fixing-accessibilitySkill
- fixing-motion-performanceSkill
- flutter-animationsSkill
- flutter-genuiSkill
- flutter-mobileSkill
- flutter-security-expertSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 6 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
NEVER call the real Gemini API in unit tests: Always use InMemoryRunner for tests.
- Very specific: line 21
NEVER connect to external services from a FunctionTool: All external I/O (HTTP, DB, vector DB, cloud APIs) belongs in MCPTools accessed via …
- Distinctive: line 92
Before writing any tool, apply this binary test:
- Very specific: line 101
ToolContext exception: If a tool needs BOTH external data AND ToolContext session state, it MUST be a FunctionTool — only in-process tools …
- Distinctive: line 107
Write golden test cases BEFORE writing agent code.
- Distinctive: line 111
Write at minimum: one happy-path case, one error-path case, one edge-case
- Distinctive: line 113
Run eval skeleton to confirm test infrastructure works
- Distinctive: line 210
All error paths must:
- Distinctive: line 217
After implementing any ADK agent feature:
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Google ADK Development Skill — Python + Gemini + FastAPI
Iron Law
NEVER call the real Gemini API in unit tests. Always use InMemoryRunner for tests. Production agents use Runner with real session services. Mixing these means real API costs, flaky tests, and non-deterministic CI.
NEVER connect to external services from a FunctionTool. All external I/O (HTTP, DB, vector DB, cloud APIs) belongs in MCPTools accessed via McpToolset. FunctionTools contain ONLY pure logic or session state access.
ALWAYS use McpToolset for MCP connections — never instantiate McpToolset(connection_params=...) directly in agent code; use the factory provided by your project. Rules:
tool_filteris MANDATORY and non-empty in everyMcpToolsetcall — limits which MCP tools the LLM can call; empty list raisesValueErrorat startup- NEVER bypass McpToolset with direct
httpx/requestscalls — all external I/O routes through the MCP server via McpToolset
Quick Scaffold (Two Options)
Option A: agent-starter-pack (Recommended for production)
uvx agent-starter-pack create my-agent --agent adk --prototype --agent-guidance-filename CLAUDE.md -y
# Templates: adk (default), adk_a2a (A2A protocol), agentic_rag (RAG)Generates project with Terraform, Dockerfile, CI/CD, eval harness. Use enhance to add deployment later.
Option B: Manual setup (Simpler, no deployment scaffold)
uv init my-adk-service && cd my-adk-service
uv add google-adk "google-genai>=1.0.0" "fastapi>=0.135.2" "uvicorn[standard]" pydantic pydantic-settings structlog
uv add --dev pytest pytest-asyncio httpx ruff mypyOption C: Enhance existing project (add deployment to scaffolded project)
uvx agent-starter-pack enhance .Choose deployment target when prompted: cloud_run or agent_engine.
Process
- Write DESIGN_SPEC.md — Before any code, write a spec covering: purpose, example use cases, required tools, safety constraints, success criteria, edge cases. Save as
DESIGN_SPEC.mdin the project root. This is your contract — all implementation must align with it. - Scaffold —
uv init+ installgoogle-adk+google-genai; confirmuv add "google-adk>=1.28.0"resolves without error - Configure —
.envwithGOOGLE_API_KEY/GOOGLE_CLOUD_PROJECT; load viapydantic-settingsBaseSettings; never hardcode keys - Define Agent —
Agent(name, model, instruction, tools)usingmodel="gemini-3.1-flash"; write docstrings on every tool function - Compose Agents — use
SequentialAgent,ParallelAgent, orLoopAgentfor multi-step workflows; setoutput_keyon each sub-agent that passes state downstream - Define Tools — plain Python functions with type hints and docstrings; use
pydantic.BaseModelfor complex inputs; accepttool_context: ToolContextto read/write session state - Add Callbacks —
before_model_callback,after_model_callback,before_tool_callback,after_tool_callback,on_model_error_callback,on_tool_error_callbackfor rate limiting, logging, and structured error handling - Session Management —
InMemorySessionService()for dev/test;VertexAiSessionService(project_id, location)for production; always callcreate_sessionbefore firstrunner.run - Add Memory —
InMemoryMemoryServicefor dev; passmemory_servicetoRunner; addload_memorybuilt-in tool to agents that need long-term recall - Expose API — FastAPI routes using
runner.run_async()withStreamingResponsefor SSE; oneRunnerinstance per app lifecycle - Write Tests —
InMemoryRunnerfor unit tests;pytest-asynciofor async tests; test tools in isolation, then agent routing end-to-end - Deploy — Docker +
uvicorn; injectGOOGLE_API_KEYas env var; useGOOGLE_CLOUD_PROJECT+GOOGLE_CLOUD_LOCATIONfor Vertex AI session service in prod
Key Patterns
| Pattern | Implementation | Reference |
| Single Agent | Agent(name, model, instruction, tools) | adk-core-patterns.md |
| Sequential Pipeline | SequentialAgent(sub_agents=[a, b, c]) + output_key per agent | adk-agent-types.md |
| Parallel Analysis | ParallelAgent(sub_agents=[...]) + output_key per agent | adk-agent-types.md |
| Iterative Refinement | LoopAgent(sub_agents=[...], max_iterations=N) + exit_loop | adk-agent-types.md |
| Agent Handoff | transfer_to_agent built-in + sub_agents=[...] on root | adk-agent-handoff.md |
| Custom Tools | Plain function with docstring + ToolContext for state | adk-tools-basic.md |
| MCP Integration | McpToolset(connection_params=StdioConnectionParams(...)) | adk-tools-basic.md |
| Structured Output | output_schema=PydanticModel + output_key="key" | adk-core-patterns.md |
| Callbacks | before_model_callback, after_model_callback, before_tool_callback | adk-tools-callbacks.md |
| Session State | tool_context.state["key"] read/write | adk-core-patterns.md |
| Memory | InMemoryMemoryService + load_memory tool | adk-memory-artifacts.md |
| Testing | InMemoryRunner + pytest-asyncio | adk-testing.md |
| FastAPI SSE | runner.run_async() + StreamingResponse | adk-fastapi-integration.md |
| Evaluation | adk eval + evalset schema + LLM-as-judge | See Google ADK docs |
| Deployment | Agent Engine, Cloud Run, CI/CD | See Google ADK docs |
| Observability | Cloud Trace, prompt logging, agent analytics | See Google ADK docs |
R1/R2 Tool Placement Rule
Before writing any tool, apply this binary test:
"Does this tool perform I/O outside the agent process (DB, HTTP, vector DB, cloud APIs)?"
| Answer | Tool type | Location |
| YES | R1 — MCPTool | MCP server — agent accesses via McpToolset |
| NO | R2 — FunctionTool | Agent tools directory — pure logic only |
ToolContext exception: If a tool needs BOTH external data AND ToolContext session state, it MUST be a FunctionTool — only in-process tools can access ToolContext. The FunctionTool reads data from session state previously populated by an MCPTool.
NEVER put import httpx, import sqlalchemy, or import requests in FunctionTool files.
Eval-First Development
Write golden test cases BEFORE writing agent code. This prevents writing code that passes no evaluation criteria.
Order of operations:
- Define
tests/golden/agents/<agent_name>/directory - Write at minimum: one happy-path case, one error-path case, one edge-case
- Each case: input → expected output with
confidence_min,contains_keywords, orpattern_*assertions - Run eval skeleton to confirm test infrastructure works
- THEN implement the agent
- Iterate until all golden cases pass
Eval Skeleton (generate this first, before implementing the agent)
AGENT=my_agent # replace with your agent name
mkdir -p tests/golden/agents/$AGENT tests/evals
# Placeholder evalset
cat > tests/evals/$AGENT.evalset.json << 'JSON'
[
{
"name": "happy_path_1",
"input": { "query": "your test input here" },
"expected_tool_use": [{ "tool_name": "your_tool_name" }],
"expected_final_response": { "contains": "expected keyword" }
}
]
JSON
# Eval config with accuracy threshold
cat > tests/evals/eval_config.json << 'JSON'
{
"criteria": [
{ "type": "tool_trajectory_avg_score", "config": { "match_type": "IN_ORDER" } },
{ "type": "final_response_match_v2", "config": { "threshold": 0.8 } }
]
}
JSONCode Preservation Rules
- NEVER change the model in existing code unless explicitly asked — changing
gemini-3.1-flashto another model is a breaking change - NEVER rewrite working agent code — if the agent works, refactor incrementally
- NEVER remove tools from an agent without explicit approval — tools are part of the agent's contract
- NEVER rename output_key values — downstream agents reference them by name
Documentation Sources
| Source | URL / Tool | Purpose |
| Google ADK Python | https://context7.com/google/adk-python/llms.txt | Official ADK API reference |
| Google GenAI types | Context7 MCP — resolve google-genai | types.Part, types.Content, GenerateContentConfig |
| Pydantic v2 | Context7 MCP — resolve pydantic | BaseModel, Field, validators |
| ADK Docs MCP | adk-docs MCP server (installed) | Live ADK documentation |
Reference Files
| File | Contents |
reference/adk-core-patterns.md | Agent config, Runner patterns (sync/async), App class, session management |
reference/adk-structured-output.md | Session state access, structured output schemas, UserContent construction |
reference/adk-agent-types.md | SequentialAgent, ParallelAgent, LoopAgent, composition patterns |
reference/adk-agent-handoff.md | Agent handoff via transfer_to_agent, output_key state passing rules |
reference/adk-tools-basic.md | FunctionTool, ToolContext, async tools, Pydantic inputs, McpToolset (all 4 connection modes) |
reference/adk-tools-callbacks.md | Callbacks: before/after model, on_model_error, before/after tool, on_tool_error |
reference/adk-memory-artifacts.md | Memory services, load_memory tool, artifact storage, semantic search |
reference/adk-fastapi-integration.md | FastAPI + StreamingResponse SSE, lifespan runner setup, request/response models |
reference/adk-testing.md | InMemoryRunner unit tests, pytest-asyncio patterns, tool isolation, agent routing |
reference/adk-project-config.md | pyproject.toml, .env setup, directory structure, Dockerfile, logging, commands |
reference/adk-gemini-prompt-templates.md | Gemini-specific LlmAgent instruction templates — base structure, RAG with citations, constitutional AI (2-agent SequentialAgent), Tree-of-Thoughts, multi-step analysis, model selection guide (Flash vs Pro) |
Common Commands
# Run dev server via ADK web UI
adk web
# Run FastAPI app with uvicorn
uvicorn src.main:app --reload --port 8000
# Run tests
uv run pytest tests/ -v
# Type check
uv run mypy src/
# Lint + format
uv run ruff check src/ && uv run ruff format src/
# Install all deps from lockfile
uv syncError Handling
ADK-specific error handling rules:
- Provider errors — wrap
runner.run()/runner.run_async()in try/except; catchgoogle.api_core.exceptions.GoogleAPICallError; log with full context (user_id, session_id, model); rethrow or return structured error response — never swallow - Tool errors — use
on_tool_error_callbackto intercept and log; return a descriptive error string from tools (ADK surfaces it to the model); never return empty string orNonesilently - Loop limits —
LoopAgentstops atmax_iterations; ensureexit_loopis called by the agent's instruction before the limit; log when loop exits by limit vs. by tool call - Callback abort — returning a non-None value from
before_model_callbackskips the model call; document this explicitly in the callback with a comment - Session not found — always call
session_service.get_session()beforerunner.run(); ifNone, callcreate_session()first
All error paths must:
- Log with structured logger (structlog) including
user_id,session_id,agent_name - Either rethrow or return an error state — no silent empty returns
- Surface the failure to the user (API error response, SSE error event)
Post-Code Review
After implementing any ADK agent feature:
- Dispatch
agentic-ai-revieweragent — pass the agent graph structure and tool implementations - Dispatch
security-reviewer— flag any tool that calls external APIs or handles user PII - Confirm: no hardcoded API keys, all inputs validated, all error paths logged
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

