Skip to main content
command

ask — Claude Code command: what it does, how to install

Answers questions about a repository using source code references, file tables, and Mermaid flowcharts.

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/ask.md
Open on GitHub

What ask does

The command investigates repository files to answer technical questions strictly from code. It detects the language of your prompt and replies in that same language. Answers include a direct summary, an explanation of the flow, a table of key files, code snippets, and at least one Mermaid diagram whenever architecture or relationships are involved.

Before parsing the codebase, it resolves git remotes. It runs git remote get-url origin and inspects git rev-parse --abbrev-ref HEAD. If the origin is unclear, it stops to ask whether the project is local-only or has an upstream URL. It refuses to continue until this context is set.

This setup determines citation formatting. Remote repos get markdown links pointing directly to the branch and line number, while local folders receive (file_path:line_number). Guessing is strictly forbidden by the prompt instructions.

What it helps with

  • inspect unfamiliar codebase architecture through code evidence
  • locate component definitions with line-level file references
  • generate Mermaid flowcharts for system relationships
  • verify repository behavior without guessing or hallucinations

Example prompts for the agent

  • /ask how does authentication flow work in this service?
  • /ask where is the main database connection initialized?

How to install ask

Manually: put the files in place

.claude/commands/ask.md

Call it with /ask. For all projects use ~/.claude/commands/

Questions about ask

How to install ask in Claude Code?

Place the definition file at .claude/commands/ask.md in your project root. For GitHub Copilot, save it as .github/prompts/ask.prompt.md.

What does the ask command do?

It queries source files across the repository to answer questions with verified code citations, tables of key files, and Mermaid diagrams. It explicitly declines to guess when code context is missing.

How are code citations generated?

For remotes, citations link directly to GitHub via [file:line](REPO_URL/blob/BRANCH/file#Lline). For local-only repos, it uses the plain text (file_path:line_number) format.

Source text

ask.md · MIT
---
description: Ask a question about the repository using wiki context and source file references
---

# Deep Wiki: Repository Q&A

Answer a question about this repository grounded in actual source code.

## Source Repository Resolution (MUST DO FIRST)

Before answering, resolve the source repository context:

1. **Check for git remote**: Run `git remote get-url origin`
2. **Ask the user**: _"Is this a local-only repository, or do you have a source repository URL?"_
   - Remote URL → store as `REPO_URL`, use linked citations: `[file:line](REPO_URL/blob/BRANCH/file#Lline)`
   - Local → use `(file_path:line_number)`
3. **Determine default branch**: Run `git rev-parse --abbrev-ref HEAD`
4. **Do NOT proceed** until resolved

## Question

$ARGUMENTS

## Process

1. **Detect language** of the question and respond in the **same language**
2. **Search** the codebase for files relevant to the question
3. **Read** those files to gather evidence
4. **Synthesize** an answer grounded entirely in actual code — never invent or guess

## Response Format

```markdown
## [Concise Answer Title]

[1-2 paragraph direct answer]

### How It Works
[Detailed explanation with inline code citations and at least 1 Mermaid diagram when the answer involves architecture, flow, or relationships]

### Key Files
| File | Purpose | Source |
|------|---------|--------|
| `src/path/file.ts` | [Role in the system] | [linked citation] |

### Code Example
<!-- Source: file_path:line_number -->
[Relevant snippet from actual source, if helpful]

### Related
- [Related concepts or files to explore]
```

## Rules

- ONLY use information from actual source files in this repository
- NEVER invent, guess, or use external knowledge
- ALWAYS cite source files inline using the resolved citation format:
  - **Remote**: `[src/path/file.ts:42](REPO_URL/blob/BRANCH/src/path/file.ts#L42)`
  - **Local**: `(src/path/file.ts:42)`
- Think step by step through complex questions
- If information is insufficient, say so explicitly and suggest which files to examine

© microsoft · MIT · microsoft/skills

Similar slash commands

All slash commands for Agent setup: memory, context, orchestration →

From the same set242

The whole set →
crisp Builds a short wiki for the current repository and scaffolds a VitePress site. Useful when docs are needed now and a long build is not. ★ 3,149repo stars changelog Generates a structured changelog from recent git commit history. It groups changes by date and category, formatting user-facing release notes in Markdown. ★ 3,149repo stars catalogue Builds a hierarchical wiki outline for the current repository as JSON. Use it when you need documentation structure before writing the pages. ★ 3,149repo stars build The build command from the Deep Wiki set turns finished markdown wiki pages into a VitePress project. Dark theme, Mermaid diagrams rendered for dark mode, click-to-zoom on diagrams and images. ★ 3,149repo stars agents This command creates AGENTS.md files in relevant repository folders, but only when they are missing. It gives coding agents project-specific build, test, structure, and code-style guidance. ★ 3,149repo stars wiki-writer Generates VitePress wiki pages with dark-mode Mermaid diagrams and links technical descriptions directly to source code lines. ★ 3,149repo stars wiki-researcher This subagent maps a codebase and traces data flows, integrations, and design choices with file-and-line evidence. Use it when you need a grounded account of how a project fits together. ★ 3,149repo stars wiki-architect Reads a codebase and lays out a hierarchical documentation catalogue, each item tied to a file and line. On request it adds four onboarding guides. ★ 3,149repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor