Installation
copilot plugin marketplace add samueltauil/skills-hub
copilot plugin install retrieving-developer-knowledge@skills-hub
Works with GitHub Copilot CLI and VS Code (enable chat.plugins.enabled).
Plugin retrieving-developer-knowledge v1.0.0 follows the Agent Plugins spec.
gh skills-hub install retrieving-developer-knowledge Don't have the extension? Run gh extension install samueltauil/skills-hub first.
Download and extract to your repository:
.github/skills/retrieving-developer-knowledge/ Extract the ZIP to .github/skills/ in your repo. The folder name must match retrieving-developer-knowledge for Copilot to auto-discover it.
Skill Files (5)
SKILL.md 8.2 KB
---
name: retrieving-developer-knowledge
metadata:
version: "1.0.2"
category: CloudInfrastructureAndServices
description: >-
Searches, retrieves, and synthesizes official Google developer documentation across Google Cloud,
AI/Gemini, Android, Chrome, Web, Flutter, Go, Firebase, and other Google developer platforms.
Integrates with the Developer Knowledge MCP server (search_documents, get_documents, answer_query)
or the Developer Knowledge REST API fallback. Use when searching for gcloud CLI commands, API syntax,
IAM permissions, official documentation, architectural comparisons, or product choice overviews.
Don't use for local filesystem lookups or non-Google documentation.
---
# Google Developer Knowledge
The Developer Knowledge skill provides access to official Google developer documentation across Google Cloud, AI/ML (ai.google.dev, ADK, TensorFlow), Android, Chrome, Web, Flutter, Go, Firebase, and other Google developer platforms via the Developer Knowledge MCP server or REST API fallback.
## Usage Attribution
Before executing any `gcloud`, REST API, or MCP command with this skill, follow
the instructions in [Usage Attribution](references/attribution.md).
## Workflow
1. **Direct Retrieval**: When answering a technical question, execute a single documentation lookup directly within your current conversation context (do not delegate retrieval to subagents):
- **If MCP tools are present in your environment**: Call `answer_query` (for conceptual guides/workflows) or `search_documents` (for CLI flags/syntax).
- **If MCP tools are not present**: Execute a REST API request via `curl` against `https://developerknowledge.googleapis.com/v1`.
- **A declared server is not always a connected server.** Some clients cannot complete the MCP handshake with this server and expose no `answer_query`, `search_documents` or `get_documents` tool at all, even though the plugin declares one. Treat their absence as normal and use the REST fallback below.
2. **Confirm the lookup succeeded before using it**: A response that arrives is not automatically an answer. `PERMISSION_DENIED`, `UNAUTHENTICATED`, HTTP 401 or 403, an empty result set, or any error payload is a FAILED lookup even when the tool itself reported no error. On a failed lookup, do not answer as though it had succeeded.
- **Rate Limits (HTTP 429 / Out of Quota)**: If calling `answer_query` or the REST `:answerQuery` endpoint returns an HTTP 429 (`RESOURCE_EXHAUSTED` / out of quota error), this indicates server-side generative QA quota exhaustion. Do not treat this as an unrecoverable failure or fall back to ungrounded memory; immediately retry using the search endpoint (`search_documents` for MCP, or `documents:searchDocumentChunks` for REST) with 2–5 focused keywords from the query.
- **Persistent Failures**: Try the other transport once, and if that also fails, state plainly in your reply to the user that you could not reach Developer Knowledge and are answering without it. Presenting recalled documentation as a retrieved result is the worst available outcome, because nothing in the reply distinguishes it from a real lookup.
3. **Immediate & Complete Solution Output**: Immediately upon receiving the documentation response, output the complete, self-contained, and executable technical solution (commands with all required flags and placeholders, YAML/JSON configurations, or code snippets) directly in your response text.
## Tool Selection & Usage
Choose the appropriate tool based on availability in your runtime environment:
### 1. Developer Knowledge MCP Tools (Preferred)
When MCP tools are present in your active tool definitions:
- **`answer_query(query="...")`**: Use for conceptual guides, architectural comparisons, product choice overviews, and multi-step workflows. This tool has limited quota. If you get a 429 out of quota error, use `search_documents` instead.
- **`search_documents(query="...")`**: Use for granular CLI flags, exact syntax, parameter names, and IAM permissions (`service.resource.verb`). Use 2–5 focused keywords (e.g., `cloud run filestore nfs mount gcloud`) rather than full conversational sentences.
- **`get_documents(names=["documents/{uri_without_scheme}"])`**: Fetch full documentation pages by resource name (e.g. `names: ["documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run"]`).
### 2. REST API Fallback
When the MCP tools are absent, query the Developer Knowledge REST API
(`https://developerknowledge.googleapis.com/v1`) with `curl`. Two credentials
work, and you should try them in this order.
**An existing Google credential, preferred.** If `gcloud` is authenticated,
pass a bearer token and your quota project. Nothing needs to be installed or
configured:
```bash
curl -s -X POST "https://developerknowledge.googleapis.com/v1:answerQuery" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "X-Goog-User-Project: $(gcloud config get-value project 2>/dev/null)" \
-H "Content-Type: application/json" \
-d "{\"query\": \"How do I configure public read access on Cloud Storage?\"}"
```
If that fails to authenticate, on a 401, a 403, or any other credential error,
the account has a token the API will not accept. Substitute
`gcloud auth application-default print-access-token` for
`gcloud auth print-access-token` in the command above and try again. Which
credential the API accepts depends on how the environment was authenticated, so
treat an auth error here as a reason to try the application-default credential
rather than as a failed lookup.
**An API key, if one is configured.** Where `DEVELOPERKNOWLEDGE_API_KEY` is set
in the environment, pass it as a `key` query parameter instead of an
`Authorization` header. If neither credential is available, an API key is the
supported path for this client: enable the API and create one by following the
[Developer Knowledge quickstart](https://developers.google.com/knowledge/quickstart),
then export it as `DEVELOPERKNOWLEDGE_API_KEY`. Say that you need a credential
rather than answering without a lookup. The remaining examples in this section
use that form:
- **Answer Query**:
```bash
curl -s -X POST "https://developerknowledge.googleapis.com/v1:answerQuery?key=${DEVELOPERKNOWLEDGE_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"query": "How do I configure public read access on Cloud Storage?"}'
```
This endpoint has limited quota. If you get a 429 out of quota error, use `documents:searchDocumentChunks` instead.
- **Search Document Chunks** (use 2–5 focused keywords):
```bash
curl -s "https://developerknowledge.googleapis.com/v1/documents:searchDocumentChunks?query=gcloud+logging+metrics+create&key=${DEVELOPERKNOWLEDGE_API_KEY}"
```
- **Get Document**:
```bash
curl -s "https://developerknowledge.googleapis.com/v1/documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run?key=${DEVELOPERKNOWLEDGE_API_KEY}"
```
- **Batch Get Documents** (a `GET`, with one `names` parameter per document and no
request body; up to 20 per call):
```bash
curl -s -G "https://developerknowledge.googleapis.com/v1/documents:batchGet" \
--data-urlencode "names=documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run" \
--data-urlencode "names=documents/docs.cloud.google.com/storage/docs/creating-buckets" \
--data-urlencode "key=${DEVELOPERKNOWLEDGE_API_KEY}"
```
## Synthesis & Output Guidelines
1. **Grounding in Official Documentation**: Ground all solutions directly in retrieved documentation. Official documentation conventions have absolute precedence over memorized defaults.
2. **Exact Parameter Formatting**: Format CLI flags, composite keys (e.g. `location=IP:PATH`), and IAM permission strings according to official Google specifications.
3. **Complete Solutions in Final Response**: Always output the full, self-contained, executable technical solution (commands, configurations, or code snippets) with clear standard placeholders (e.g. `PROJECT_ID`, `SERVICE_NAME`, `REGION`) directly in your final message, even if previously referenced during internal planning.
## References
- [Usage Attribution](references/attribution.md)
- [MCP Usage & Tool Details](references/mcp-usage.md)
- [REST API Fallback Guide](references/api-fallback.md)
- [Supported Domains & Scoping](references/supported-domains.md)
api-fallback.md 6.5 KB
# Developer Knowledge REST API Fallback Guide
When the Developer Knowledge MCP server tools (`search_documents`, `get_documents`, `answer_query`) are not declared or available in your runtime environment, you MUST use the Developer Knowledge REST API to search and retrieve official documentation. Do NOT guess commands or rely on unverified pretraining memory.
## Service Overview
- **Base URL**: `https://developerknowledge.googleapis.com`
- **API Versions**: `v1` (GA) and `v1alpha`
- **Output Format**: JSON (with Markdown content chunks)
## Authentication Protocol
Before issuing REST requests, resolve authentication credentials using one of the following methods in order of precedence:
1. **OAuth 2.0 Access Token (Recommended)**:
If `gcloud` or ambient Google Cloud credentials are present, nothing needs to be installed or configured.
- Obtain access token: `ACCESS_TOKEN=$(gcloud auth print-access-token)`
- Pass via header: `-H "Authorization: Bearer ${ACCESS_TOKEN}"`
- Also pass your quota project: `-H "X-Goog-User-Project: $(gcloud config get-value project 2>/dev/null)"`
- If this fails to authenticate, on a 401, a 403, or any other credential error, the account has a token the API will not accept. Substitute `gcloud auth application-default print-access-token` and retry; which credential the API accepts depends on how the environment was authenticated.
2. **API Key**:
If a key is already provisioned, check the environment for `DEVELOPERKNOWLEDGE_API_KEY` or `GOOGLE_API_KEY`.
- Pass via query parameter: `?key=${DEVELOPERKNOWLEDGE_API_KEY}`
- Or pass via header: `-H "X-Goog-Api-Key: ${DEVELOPERKNOWLEDGE_API_KEY}"`
- If no key is set and no Google credential is available, an API key is the supported path for this client. Enable the API and create a key by following the [Developer Knowledge quickstart](https://developers.google.com/knowledge/quickstart), then export it as `DEVELOPERKNOWLEDGE_API_KEY`. Report that you need a credential rather than answering from memory.
---
## Endpoints & Operations
Include the `User-Agent` attribution header specified in
[Usage Attribution](attribution.md) on every direct REST request below.
### 1. `answerQuery` (Broad Conceptual Q&A & Multi-Step Guides)
Use for conceptual guides, architectural comparisons, product overviews, and how-to workflows.
- **Method & Path**: `POST https://developerknowledge.googleapis.com/v1:answerQuery`
- **Headers**:
- `Content-Type: application/json`
- `X-Goog-Api-Key: ${DEVELOPERKNOWLEDGE_API_KEY}` (or query param `?key=...`)
- **Request Body**:
```json
{
"query": "How do I configure public read access on a Cloud Storage bucket?"
}
```
- **Example `curl`**:
```bash
curl -s -X POST "https://developerknowledge.googleapis.com/v1:answerQuery?key=${DEVELOPERKNOWLEDGE_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"query": "How do I create a custom metric in Cloud Logging?"}'
```
- **Rate Limits & Fallback**: This endpoint has limited synthesis quota. If you receive an HTTP 429 (`RESOURCE_EXHAUSTED` / out of quota error) from `:answerQuery`, do not abandon documentation retrieval or answer from unverified memory. Fall back to calling `documents:searchDocumentChunks` instead using 2–5 focused keywords.
---
### 2. `searchDocumentChunks` (Exact Syntax, IAM Permissions & Flags)
Use to find specific CLI flags, IAM permissions (`service.resource.verb`), API parameter names, or code snippets.
- **Method & Path**: `GET https://developerknowledge.googleapis.com/v1/documents:searchDocumentChunks`
- **Query Parameters**:
- `query`: URL-encoded search term (e.g., `gcloud+logging+metrics+create`).
- `filter` (optional): Filter by domain (e.g., `data_source = "docs.cloud.google.com"`).
- `pageSize` (optional): Maximum number of chunks to return (default: 10).
- `key`: API Key.
- **Example `curl`**:
```bash
curl -s "https://developerknowledge.googleapis.com/v1/documents:searchDocumentChunks?query=gcloud+logging+metrics+create&key=${DEVELOPERKNOWLEDGE_API_KEY}"
```
---
### 3. `get` Document (Full Document Retrieval)
Use to retrieve the full Markdown content of a specific documentation page when you have its parent resource name or known URI.
- **Method & Path**: `GET https://developerknowledge.googleapis.com/v1/documents/{URI_WITHOUT_SCHEME}`
- **Resource Name Format**: `documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run` (stripped of `https://`).
- **Example `curl`**:
```bash
curl -s "https://developerknowledge.googleapis.com/v1/documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run?key=${DEVELOPERKNOWLEDGE_API_KEY}"
```
---
### 4. `batchGet` Documents (Multiple Document Retrieval)
Use to retrieve multiple documentation pages in a single roundtrip.
- **Method & Path**: `GET https://developerknowledge.googleapis.com/v1/documents:batchGet`
- **No request body.** The names travel in the query string. A `POST` with a JSON
`names` array is not a defined method on this service and returns a 404 from the
Google frontend.
- **Query Parameters**:
- `names` (required): repeat once per document, up to 20 per call. Format
`documents/{uri_without_scheme}`, each value 500 characters or fewer. Documents
are returned in the order requested.
- `view` (optional): `DOCUMENT_VIEW_BASIC`, `DOCUMENT_VIEW_CONTENT`, or
`DOCUMENT_VIEW_FULL`. Defaults to `DOCUMENT_VIEW_CONTENT`. Use
`DOCUMENT_VIEW_BASIC` when you need only titles and URIs, since full Markdown
content is large.
- `key`: API Key.
- **Response**: `{"documents": [ ... ]}`, each entry carrying `name`, `uri`, `title`,
`description`, `dataSource`, `updateTime`, `contentLengthBytes`, and the full
Markdown in `content`.
- **Example `curl`**:
```bash
curl -s -G "https://developerknowledge.googleapis.com/v1/documents:batchGet" \
--data-urlencode "names=documents/docs.cloud.google.com/run/docs/overview/what-is-cloud-run" \
--data-urlencode "names=documents/docs.cloud.google.com/run/docs/configuring/services/environment-variables" \
--data-urlencode "key=${DEVELOPERKNOWLEDGE_API_KEY}"
```
---
## Response Processing & Synthesis Guidelines
1. **Extract Content**: Parse the returned JSON payload (`answer`, `documentChunks[].content`, or `document.content`).
2. **Authoritative Precedence**: Treat retrieved documentation as 100% authoritative over pretraining knowledge.
3. **Context Defense**: Synthesize only the required technical solution (code snippet, configuration, or CLI command) without dumping raw API response envelopes.
attribution.md 1.8 KB
# Usage Attribution
Tag every command you execute directly in the terminal while using this skill,
so usage can be attributed. The tag identifies only the skill and its version;
it carries no user data.
- **`gcloud` CLI Commands**: Prefix every `gcloud` invocation, whatever the
subcommand, with the metrics environment variable. Set it inline on each
command because shell state may not persist between commands:
```bash
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:retrieving-developer-knowledge)" \
gcloud <command> [flags]
```
Do not use `gcloud config set` for this: it would persist beyond the current
task and mislabel unrelated usage.
- **Direct HTTP, REST, and MCP Requests**: On direct HTTP calls to Google APIs
(such as `https://developerknowledge.googleapis.com/v1` with `curl`) or HTTP
requests to a remote MCP server, include
`agent-skills/1.0 (skill:retrieving-developer-knowledge)` in the
`User-Agent` header. If a `User-Agent` header is already specified, append
this string to the end of it rather than overwriting existing `User-Agent`
data — the collection pipeline parses the `agent-skills/<version>` and
`skill:<name>` tokens, so any rewording breaks attribution:
```
User-Agent: <existing_user_agent> agent-skills/1.0 (skill:retrieving-developer-knowledge)
```
- **Constraint for Generated Code**: The tracking prefix is strictly for
commands you execute directly in the terminal. Do NOT include this tracking
prefix in generated scripts, Terraform templates, or code provided to the
user for their own repositories.
- **User Opt-Out**: If the user asks to disable or remove tracking or
attribution tags, omit the `CLOUDSDK_METRICS_REQUEST_ATTRIBUTION` variable
and custom `User-Agent` suffix from all commands.
mcp-usage.md 1.0 KB
# MCP Tool Usage & API Details
The Developer Knowledge skill integrates with the Developer Knowledge Remote MCP
server (`https://developerknowledge.googleapis.com/mcp`).
## Available Tools
1. **`search_documents`**:
- Accepts a search query string.
- Returns relevant document text chunks containing matching syntax, code
blocks, or flags.
- Each returned item includes a `content` field and a `parent` URI field.
2. **`answer_query`**:
- Accepts a natural language question.
- Performs server-side RAG and returns a synthesized response with source
citations.
- This tool has limited quota. If you get a 429 out of quota error, use
`search_documents` instead.
3. **`get_documents`**:
- Fetches full document contents.
- Takes a `names` array parameter: `names:
["documents/{uri_without_scheme}"]`.
- Example: For parent URI `https://cloud.google.com/run/docs/deploying`,
pass `names: ["documents/cloud.google.com/run/docs/deploying"]`.
supported-domains.md 1.5 KB
# Supported Developer Domains
The Developer Knowledge API and MCP server search, retrieve, and synthesize documentation from official public pages across the following domains:
* **Google Cloud & Infrastructure**:
* `docs.cloud.google.com` (Official Google Cloud Documentation)
* `cloud.google.com` (Google Cloud Solutions & Products)
* `docs.apigee.com` (Apigee API Management)
* `firebase.google.com` (Firebase Platform)
* **AI & Machine Learning**:
* `ai.google.dev` (Google AI for Developers & Gemini API)
* `adk.dev` (Agent Development Kit)
* `antigravity.google` (Project Antigravity / Gemini CLI)
* `geminicli.com` (Gemini CLI Documentation)
* `www.tensorflow.org` (TensorFlow Framework)
* **Mobile, Web & Client Platforms**:
* `developer.android.com` (Android Developer Documentation)
* `docs.flutter.dev` (Flutter Framework)
* `dart.dev` (Dart Language)
* `developer.chrome.com` (Chrome & Web Extensions)
* `web.dev` (Modern Web Best Practices)
* **Languages, Tools & Ecosystems**:
* `go.dev` (Go Programming Language)
* `developers.google.com` (Google Developer Technologies)
* `developers.home.google.com` (Google Home Developer Center)
* `mapsplatform.google.com` (Google Maps Platform)
* `fuchsia.dev` (Fuchsia OS)
These domains represent the complete corpus of searchable and retrievable technical content. For more details on the live corpus, see [Corpus Reference](https://developers.google.com/knowledge/reference/corpus-reference).
License (Apache-2.0)
View full license text
Licensed under the Apache License, Version 2.0. See https://github.com/google/skills/blob/main/LICENSE