adk-sql-agent-engineering
Skill9 starsChanged 17 days agoMITView on GitHub
Build, adapt, test or troubleshoot Google ADK SQL agents using reviewed templates, selective schemas and controlled read-only execution. Use for natural-language analytics, SQL routing, generated-query reliability, or the agent's BigQuery/Gemini identity, setup and cleanup. Do not activate for ordinary SQL tuning, general database administration, RAG, memory or a user's scoped history reads (adk-memory-architecture), general response-schema design (adk-model-and-output-contracts) or unrelated cloud hosting.
In this repository25 other files it gives its agents.
- adk-agent-evaluationSkill
- adk-agent-instructionsSkill
- adk-agent-interoperabilitySkill
- adk-agent-observabilitySkill
- adk-agent-securitySkill
- adk-discoverySkill
- adk-engineerSkill
- adk-fastapi-backendSkill
- adk-frontend-integrationSkill
- adk-governance-packSkill
- adk-memory-architectureSkill
- adk-model-and-output-contractsSkill
- adk-operational-guardrailsSkill
- adk-portability-planningSkill
- adk-presenterSkill
- adk-release-engineeringSkill
- adk-system-designerSkill
- adk-tool-auth-and-secretsSkill
- adk-tool-interface-designSkill
- adk-workflow-designSkill
- deploy-adk-on-google-cloudSkill
- optimise-adk-on-google-cloudSkill
- practice-profileSkill
- protect-adk-sensitive-dataSkill
- safe-api-tool-callsSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
Read the target's contributor instructions, dependency declarations and lockfiles, configuration loader, entry point, routing/context/SQL …
- Distinctive: line 39
Read references/compatibility.md before version-sensitive ADK changes.
- Distinctive: line 41
Inspection is complete: when the change can name its existing integration points and tests, or identify the specific missing decision.
- Distinctive: line 59
Before broad edits, give a short plan naming the path, files, preserved contracts and tests.
- Distinctive: line 77
Keep four boundaries explicit:
- Distinctive: line 99
Use a bounded campaign for approved live tests.
- Distinctive: line 103
Read references/validation.md for the changed paths.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ADK SQL agent engineering
Deliver an SQL-agent change, an evidence-based review, an implementable architecture plan or a verified runtime recovery. Preserve the target application's conventions and business definitions. The skill is self-contained; the book and companion repository are optional provenance, not runtime dependencies.
1. Inspect the project
Read the target's contributor instructions, dependency declarations and lockfiles, configuration loader, entry point, routing/context/SQL modules and relevant tests. Inspect before importing application modules: imports can load secrets, construct clients or start work.
Use scripts/inspect_project.py for a bounded, read-only inventory. Invoke it with the target's existing Python interpreter and --project set to its root; --help documents the options. Its static findings are leads for inspection, not proof that a control is enforced. Inspect skipped or unsupported manifests manually without exposing values.
Record these facts before choosing a change:
- Python, ADK, GenAI SDK, Pydantic, database client and parser versions, separating declared constraints, resolved locks and the selected interpreter's installed packages.
- Model backend, actual configuration precedence, resource/quota project distinction, database location and authentication method. Report presence and identifiers only where needed; keep secret values out of output.
- Current query path: who selects metadata, who authors SQL, who can execute it, and where caller access is enforced.
- Repeated intents, metric definitions, row grain, joins, date semantics, approved data surface and existing assertions.
Read references/compatibility.md before version-sensitive ADK changes. Preserve existing pins and package management. An unknown or different version requires a compatibility check, not an automatic upgrade or downgrade. If a required API is absent, report the exact incompatibility and continue only with independent work.
Inspection is complete when the change can name its existing integration points and tests, or identify the specific missing decision. Ask only for business meaning, target selection or authorisation that cannot be inferred safely.
2. Select the mode and query path
| Mode | Use when | Deliverable |
| Implement or adapt | The user wants working behaviour | Small coherent changes integrated into existing modules and tests |
| Review or diagnose | The user wants findings or a failure explained | Reproduced evidence, severity, correction and validation plan; edit only within the requested scope |
| Plan or select | Code, business rules or a provider contract are missing | Concrete architecture, interfaces, prerequisites and acceptance cases; avoid speculative scaffolding |
| Prepare or recover runtime | The SQL agent needs identity, fixture setup, project migration or owned cleanup | Read-only diagnosis, reproducible local procedure and bounded execution within explicit approval |
Within one application, combine these paths as needed:
- Reviewed template: the full metric, grain, filter, ranking and period contract matches an approved query. Validate typed values and run the template without custom SQL authoring.
- Generated query: supported business question with enough approved context. Select a bounded semantic domain, retrieve relevant metadata in application code, then use a tool-free SQL author.
- Clarify or refuse: missing meaning, ambiguous categorical values, unavailable metadata or unsupported relationships. Stop before SQL authoring or execution where possible.
- Managed/specialist integration: a separately evaluated option when that service owns the required semantics. Establish its execution and permission boundary before connecting it; see references/implementation.md, and when MCP Toolbox for Databases or a managed data agent is the executor, the branch checklists in acceptance and extensions.
Before broad edits, give a short plan naming the path, files, preserved contracts and tests. Read references/implementation.md for implementation or architectural selection. In a review, read only its relevant boundary.
Load deeper guidance only for the work at hand:
| Work | Read next |
| Define metrics, joins, values or selected context | Semantic contracts; for a semantic map kept in reviewed files and its CI check, implementation |
| Save successful queries as templates or few-shot examples | Troubleshooting, step 6 of turning a trace into a reviewed template |
| Wire ADK models, callbacks, events or credentials | ADK runtime; its bundled offline contract asset preserves the real framework and SDK |
| Provision, resume or clean up BigQuery/Vertex resources | Lifecycle runbook; the tested serving surface was local ADK Web, not a deployed cloud frontend |
| Investigate a wrong answer, refusal, SDK failure or misleading PASS | Troubleshooting |
| MCP Toolbox for Databases or a managed data agent is the executor | Acceptance and extensions, section 6: the Toolbox branch checklist (read-only at the source, flags, parameters, secure tenant ids, bypass fixtures) and the DataAgentToolset facts |
| Test the public app, add telemetry, follow-ups or a managed branch | Acceptance and extensions |
3. Implement and enforce the boundaries
For every executable route, read references/execution-safety.md. A prompt, schema or successful dry run cannot substitute for application and database enforcement.
Keep four boundaries explicit:
- Meaning: reviewed metrics, grain, joins and reporting windows determine what a correct answer means.
- Context: trusted code validates the selected domain, resolves values and retrieves only authorised relevant schemas. A metadata failure stops authoring.
- Execution: a model proposes a candidate; trusted code checks SQL, parameters, actual references and resource limits before using a least-privilege database identity.
- Evidence: deterministic checks establish expected answers and absence of forbidden operations. Output and telemetry distinguish query completion, completeness and source freshness.
Reuse project modules rather than replacing the project with a sample application. For greenfield work, implement one useful vertical slice and its refusal path before generalising. Additional caller policy, cumulative deadlines, result completeness, repair or follow-up behaviour needs its own implementation and tests; companion evidence does not certify those extensions.
4. Obtain approval at the consequential boundary
<!-- shared:consequential-operations-brief -->Inspection is read-only, and code generation authorises no deployment, paid call or live test. Before any consequential operation (an API, billing or quota change, a billable resource, a secret, IAM, a data migration, a deployment, a deletion, or a paid or destructive test), read consequential operations, present the exact scope and limits, obtain explicit approval and end the turn to wait for it. Cleanup is a separate confirmed operation on resources this workflow created.
<!-- /shared:consequential-operations-brief -->Use a bounded campaign for approved live tests. Detailed procedures are in the lifecycle runbook; apply the boundaries in execution safety.
5. Validate and report
Read references/validation.md for the changed paths. Use the project's existing environment, formatter, static checks and test runner. Start with deterministic tests; mark provider doubles and SQLite substitutes as offline evidence. Exercise the public workflow, not only isolated helper functions.
At minimum, an implementation needs a correct supported answer, invalid/unsupported input with zero execution, selected-schema-only retrieval, a rejected write, and a second invocation without unwanted duplicate effects. Test required schema fields through actual framework-to-SDK serialisation when changing structured output. Do not execute a paid call to compensate for a failed local assertion.
scripts/check_results.py compares sanitised fixture aggregates using explicit aliases and exact finite decimals. Its --dry-run checks shapes only. It does not establish routing, authorisation, live connectivity, ranking order or SQL safety; assert those at the application boundary.
Complete the report with files changed, commands and exit results, exact environment, assertions passed/failed, manual prerequisites and unverified behaviour. A production principle stated but not exercised is guidance. Do not generalise a small sample to an SLA or universal SQL correctness. The skill's tested versions are in references/compatibility.md.
<!-- shared:evidence-labels-brief -->Label each result with its tier (offline, local, live or release) and
outcome (pass, fail, blocked or not run) as
evidence labels defines them;
earlier, vendor and documentation-only results are historical,
vendor-measured or guidance, never this session's evidence.
<!-- /shared:evidence-labels-brief -->This is an independent community project and is not affiliated with or endorsed by Google.
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.

