query-code
Skill4 starsChanged 4 months agoApache-2.0View on GitHub
Answer questions about a previously analyzed codebase. Reads learn-code output and dispatches an agent that can also Read/Grep the actual source code to provide file:line-grounded answers.
In this repository53 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- action-commentsSkill
- article-extractorSkill
- docs-convert-gdoc-mdSkill
- docs-orchestratorSkill
- docs-review-content-qualitySkill
- docs-review-modular-docsSkill
- docs-review-securitySkill
- docs-review-styleSkill
- docs-review-technicalSkill
- docs-ticket-readinessSkill
- docs-workflow-code-analysisSkill
- docs-workflow-create-jiraSkill
- docs-workflow-create-merge-requestSkill
- docs-workflow-jira-readySkill
- docs-workflow-pipeline-diagnosticsSkill
- docs-workflow-planningSkill
- docs-workflow-pr-analysisSkill
- docs-workflow-quality-gateSkill
- docs-workflow-requirementsSkill
- docs-workflow-scope-req-auditSkill
- docs-workflow-security-reviewSkill
- docs-workflow-startSkill
- docs-workflow-style-reviewSkill
- docs-workflow-tech-reviewSkill
- docs-workflow-writingSkill
- git-pr-readerSkill
- ibm-sg-audience-and-mediumSkill
- ibm-sg-language-and-grammarSkill
- ibm-sg-legal-informationSkill
- ibm-sg-numbers-and-measurementSkill
- ibm-sg-punctuationSkill
- ibm-sg-referencesSkill
- ibm-sg-structure-and-formatSkill
- ibm-sg-technical-elementsSkill
- jira-readerSkill
- jira-writerSkill
- learn-codeSkill
- lint-with-valeSkill
- mdita-writeSkill
- redhat-docs-tocSkill
- rh-ssg-accessibilitySkill
- rh-ssg-formattingSkill
- rh-ssg-grammar-and-languageSkill
- rh-ssg-gui-and-linksSkill
- rh-ssg-legal-and-supportSkill
- rh-ssg-release-notesSkill
- rh-ssg-structureSkill
- rh-ssg-technical-examplesSkill
- rn-known-issuesSkill
- understand-pull-requestSkill
- validate-plugin-prereqsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 8 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 32
If the question is empty, STOP and report: "Please provide a question about the codebase.".
- Very specific: line 49
If ${CLONE_DIR} already exists and is a git repo, use it as the repo path.
- Very specific: line 50
If ${CLONE_DIR} does not exist and an analysis already exists at ${BASE_PATH}, proceed without a clone (the analysis data is sufficient for …
- Distinctive: line 51
If neither the clone nor analysis exists, clone:
- Very specific: line 72
If exactly one exists: use it.
- Very specific: line 73
If multiple exist: list them and ask the user to specify --repo.
- Distinctive: line 74
If none exist: report that no analysis data is available.
- Very specific: line 78
Check that ${BASE_PATH}/synthesis/ONBOARDING.md exists.
- Very specific: line 82
Check if ${BASE_PATH}/workflow/ contains a progress file.
- Very specific: line 84
If a progress file exists with status: "in_progress": report that the analysis is incomplete and offer to resume it.
- Distinctive: line 85
If no progress file exists: ask the user if they want to run learn-code first.
- Distinctive: line 87
If the user agrees to run learn-code:
- Distinctive: line 94
Wait for it to complete, then proceed to step 4.
- Very specific: line 98
Read the following files from ${BASE_PATH}/:
- Distinctive: line 108
If any file is missing (except relationships, which may not exist for older analyses), log a warning but continue with available data.
- Distinctive: line 131
If none of these yield a valid path, warn the user that file:line references may not be available.
- Distinctive: line 179
After the agent completes:
- Very specific: line 181
Verify ${OUTPUT_FILE} was written.
≈ “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
Query-Code — Ask Questions About an Analyzed Codebase
Takes a natural-language question about a codebase, loads the analysis data produced by learn-code, and dispatches an agent that answers the question with evidence grounded in actual source files and line numbers.
Usage
/docs-skills:query-code "How does authentication work?" --repo /path/to/repo
/docs-skills:query-code "How does authentication work?" --repo https://github.com/user/repo
/docs-skills:query-code "What modules depend on the database layer?"
/docs-skills:query-code "Where is the HTTP routing configured?" --repo /path/to/my-apiArguments
$1— The question to answer (required, can be a quoted string)--repo <path|url>— Path or URL of the repository (optional if only one analysis exists). Accepts a local filesystem path or a git remote URL (https://,git@,git://). Git URLs are cloned to.agent_workspace/<repo-name>/_clone/.
Execution
1. Parse arguments
Extract the question (first positional argument or quoted string) and optional --repo path.
If the question is empty, STOP and report: "Please provide a question about the codebase.".
2. Resolve analysis data
If --repo is provided:
If the value is a git URL (matches https://, http://, git@, or git://):
- Derive
REPO_NAMEfrom the URL: strip any trailing.git, then take the last path segment (e.g.,https://github.com/user/my-project.git→my-project). - Set paths:
GIT_ROOT="$(cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)" && pwd)"
BASE_PATH="${GIT_ROOT}/.agent_workspace/${REPO_NAME}"
CLONE_DIR="${BASE_PATH}/_clone"- If
${CLONE_DIR}already exists and is a git repo, use it as the repo path. - If
${CLONE_DIR}does not exist and an analysis already exists at${BASE_PATH}, proceed without a clone (the analysis data is sufficient for querying, though file:line inspection will be limited). - If neither the clone nor analysis exists, clone:
uv run --script ${CLAUDE_PLUGIN_ROOT}/skills/git-pr-reader/scripts/git_pr_reader.py clone "<URL>" --output-dir "${CLONE_DIR}"Then offer to run learn-code (see step 3 below).
If the value is a local path:
Resolve to absolute path. Derive REPO_NAME from basename. Set:
GIT_ROOT="$(cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)" && pwd)"
BASE_PATH="${GIT_ROOT}/.agent_workspace/${REPO_NAME}"If --repo is NOT provided:
Scan .agent_workspace/ for subdirectories containing synthesis/ONBOARDING.md.
- If exactly one exists: use it. Derive
REPO_NAMEandBASE_PATH. - If multiple exist: list them and ask the user to specify
--repo. - If none exist: report that no analysis data is available.
3. Verify analysis exists
Check that ${BASE_PATH}/synthesis/ONBOARDING.md exists.
If it does not exist:
Check if ${BASE_PATH}/workflow/ contains a progress file.
- If a progress file exists with
status: "in_progress": report that the analysis is incomplete and offer to resume it. - If no progress file exists: ask the user if they want to run learn-code first.
If the user agrees to run learn-code:
Skill: docs-skills:learn-code
args: <repo-path>Wait for it to complete, then proceed to step 4.
4. Load analysis context
Read the following files from ${BASE_PATH}/:
| File | Content |
detection/detection.json | Language, module map, config info |
module-registry/registry.json | Module purposes and complexity |
module-analysis/summary.json | Detailed per-module analysis |
relationships/relationships.json | Cross-module coupling data |
synthesis/ONBOARDING.md | Full onboarding guide |
If any file is missing (except relationships, which may not exist for older analyses), log a warning but continue with available data.
Assemble the context into a JSON object:
{
"repo_name": "<REPO_NAME>",
"primary_language": "<from detection>",
"detection": "<detection.json contents>",
"registry": "<registry.json contents>",
"summaries": "<summary.json contents>",
"relationships": "<relationships.json contents or []>"
}5. Determine repo path
The repo path is needed so the agent can inspect actual source files. Determine it from:
- The
--repoargument if provided - The
repo_pathfield in the progress file at${BASE_PATH}/workflow/learn-code_${REPO_NAME}.json - The
repo_rootfield indetection.json
If none of these yield a valid path, warn the user that file:line references may not be available.
6. Set output path
OUTPUT_DIR="${BASE_PATH}/queries"
mkdir -p "$OUTPUT_DIR"Generate a filename slug from the question:
- Lowercase the question
- Replace spaces and non-alphanumeric characters (except hyphens) with hyphens
- Collapse consecutive hyphens into one
- Strip leading and trailing hyphens
- Truncate to 60 characters
- Append
_<YYYYMMDD-HHMMSS>.mdusing the current UTC time
Example: "How do the Tekton PipelineRuns get triggered?" → how-do-the-tekton-pipelineruns-get-triggered_20260524-180000.md
Set OUTPUT_FILE="${OUTPUT_DIR}/<slug>.md".
7. Dispatch code-questioner agent
Agent:
subagent_type: docs-skills:code-questioner
description: "Answer: <question truncated to 60 chars>"
prompt: |
Answer this question about the <REPO_NAME> codebase:
QUESTION: <user's full question>
ANALYSIS_CONTEXT:
<JSON context object from step 4>
ONBOARDING_GUIDE:
<full contents of ONBOARDING.md>
REPO_PATH: <absolute path to the repository>
OUTPUT_FILE: <OUTPUT_FILE>
You may Read and Grep files in REPO_PATH to find specific code evidence.
Always include file:line references when citing specific code.
Write your answer as markdown (with YAML frontmatter) to OUTPUT_FILE.8. Verify and present answer
After the agent completes:
- Verify
${OUTPUT_FILE}was written. If the agent failed to write it, write the agent's response yourself to${OUTPUT_FILE}with YAML frontmatter:
---
question: "<original question>"
repo: "<REPO_NAME>"
date: "<current ISO 8601 UTC>"
---
<agent's response>- Display the answer to the user.
- Log:
"Answer saved to <OUTPUT_FILE>".
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.

