claude-ask
npx machina-cli add skill dceoy/ai-coding-agent-skills/claude-ask --openclawClaude Ask Skill
Use Claude Code CLI to answer questions about code without making modifications. This is a read-only analysis skill.
When to Use
- User asks "how does X work?"
- User wants to find where something is implemented
- User needs to understand architecture or patterns
- User is debugging and needs to understand code flow
- User asks "what does this code do?"
Prerequisites
Verify Claude Code CLI is available:
claude --version # Should display installed version
Basic Usage
Step 1: Parse the Question
Extract what the user wants to know and the scope (files, feature, component).
Step 2: Execute Claude Code Query
Run Claude Code in read-only mode (use -p/--print to output once and exit):
claude -p "Answer this question about the codebase: [QUESTION]
Provide:
1. Direct answer to the question
2. Specific file paths and line numbers
3. Code examples from the actual codebase
4. Related concepts or dependencies
Do NOT make any changes - this is read-only analysis."
If your CLI does not support -p, run claude and paste the prompt.
Step 3: Present Answer
Format the response with:
- Summary (1-2 sentences)
- Details (explanation)
- File References (paths + line numbers)
- Code Examples
- Related Info (dependencies, gotchas)
Example Queries
claude -p "Where is email validation implemented? Show all locations with file paths and line numbers. Do NOT modify code."
claude -p "Explain how authentication works. Include all files involved, the complete flow, and security measures. Do NOT modify code."
Best Practices
- Always include file paths with line numbers
- Show actual code from the codebase
- Explain "why" not just "what"
- Verify paths and line numbers after the response
Error Handling
- If Claude Code CLI is not available, ensure it's installed and in your PATH
- If authentication fails, ask the user to sign in via the CLI
- If the answer is unclear, ask a more specific question
Related Skills
claude-execfor code modificationsclaude-reviewfor code reviews
Limitations
- Read-only analysis
- Cannot run tests or execute code
- Limited by current codebase context
Source
git clone https://github.com/dceoy/ai-coding-agent-skills/blob/main/skills/claude-ask/SKILL.mdView on GitHub Overview
Claude-ask performs read-only code analysis by querying Claude Code CLI to determine how code works, where itβs implemented, what patterns are used, and debugging insights. It avoids modifying the codebase and relies on an installed Claude Code CLI. This is ideal for understanding architecture and flow without touching the code.
How This Skill Works
Step 1: Parse the Question to determine the scope (files, feature, component). Step 2: Execute Claude Code CLI in read-only mode using the -p option to produce a detailed answer with file paths and code examples. Step 3: Present a structured answer including a summary, details, file references with line numbers, code samples, and related dependencies.
When to Use It
- User asks how a specific part of the code works
- User wants to locate where a feature or function is implemented
- User needs understanding of architecture or design patterns in the codebase
- User is debugging and needs a read-only trace of code flow
- User asks what a piece of code does and how it interacts with other modules
Quick Start
- Step 1: Parse the question and determine the scope (files, feature, component).
- Step 2: Run claude -p with a read-only prompt to query the codebase.
- Step 3: Present the answer with a summary, detailed explanations, file references, and code samples.
Best Practices
- Always include file paths with line numbers
- Show actual code from the codebase
- Explain why something works, not just what it does
- Verify paths and line numbers after the response
- If multiple files are involved, provide context with related references
Example Use Cases
- Where is email validation implemented? Show all locations with file paths and line numbers.
- Explain how authentication works. Include all files involved, the complete flow, and security measures.
- Identify where a feature is implemented and how it interacts with modules across the codebase.
- Walk through a debugging scenario where a function path fails, listing involved files and lines.
- Provide an architecture overview of a component with its dependencies and call graph.