home / skills / hiroro-work / claude-plugins / ask-claude

ask-claude skill

/skills/ask-claude

This skill executes the claude CLI to obtain coding assistance, enabling quick questions, code generation, debugging, or task delegation.

npx playbooks add skill hiroro-work/claude-plugins --skill ask-claude

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.6 KB
---
name: ask-claude
description: Asks Claude CLI for coding assistance. Use for getting a second opinion, code generation, debugging, or delegating coding tasks.
allowed-tools: Bash(claude:*)
---

# Ask Claude

Executes the local `claude` CLI to get coding assistance.

**Note:** This skill requires the `claude` CLI to be installed and available in your system's PATH.

## Quick start

Run a single query with `-p` (print mode):

```bash
claude -p "Your question or task here"
```

## Common options

| Option | Description |
|--------|-------------|
| `-p` | Non-interactive print mode (required for scripting) |
| `--model MODEL` | Specify model (e.g., `sonnet`, `opus`, `haiku`) |
| `--output-format FORMAT` | Output format: `text`, `json`, `stream-json` |
| `-c, --continue` | Continue the most recent conversation |

> For all available options, run `claude --help`

## Examples

**Ask a coding question:**

```bash
claude -p "How do I implement a binary search in Python?"
```

**Use a specific model:**

```bash
claude -p --model opus "Review this code for potential issues"
```

**Get JSON output:**

```bash
claude -p --output-format json "List the main functions in this file"
```

**Continue a previous conversation:**

```bash
claude -p -c "Now add error handling to that function"
```

## Notes

- The `-p` flag runs Claude non-interactively and outputs result to stdout
- If `--model` is not specified, the default model is used
- `stream-json` outputs responses incrementally as they are generated
- **Warning**: The `-p` flag skips the workspace trust dialog. Only use in directories you trust.
- The command inherits the current working directory

Overview

This skill runs the local Claude CLI to get coding assistance from Claude models. It offers non-interactive queries for code generation, review, debugging, and follow-up prompts while inheriting your current working directory. Use it as a quick second opinion or to delegate short coding tasks to Claude from scripts or the terminal.

How this skill works

The skill invokes the installed claude command with the -p flag for non-interactive print mode, passing your prompt and any flags like --model or --output-format. It can continue a recent conversation with -c, request specific models, and return plain text or JSON (including stream-json for incremental output). Because it runs locally, it inherits the shell working directory and executes only if the claude CLI is present in PATH.

When to use it

  • Get a second opinion on implementation choices or algorithms.
  • Generate boilerplate code, tests, or small utility functions.
  • Debug or review code snippets and ask for fixes or explanations.
  • Automate developer tasks in scripts or CI steps that can call a CLI.
  • Obtain structured output (JSON) for further processing by tools.

Best practices

  • Always install and verify the claude CLI is available in your PATH before using the skill.
  • Use -p for scripting and automation; be aware it skips interactive prompts and workspace trust dialogs.
  • Specify --model when you need a particular Claude variant for tone or capability.
  • Prefer --output-format json or stream-json if downstream tools will parse the response.
  • Limit sensitive secrets or credentials in prompts since the CLI runs with your local environment context.

Example use cases

  • Ask Claude to write a function and return only the code for easy copy-paste.
  • Request a code review of a pasted snippet and get concise issues and fixes.
  • Run sequential prompts: generate code, then use -c to add error handling or tests.
  • Integrate into a script that queries Claude and parses JSON response for automation.
  • Use stream-json to display partial responses in a custom UI while generation is ongoing.

FAQ

Do I need an API key to use this skill?

No. This skill requires the claude CLI installed and configured locally; authentication is handled by that CLI according to its own setup.

What if the claude command is not found?

Install the official claude CLI and ensure it is in your system PATH, then verify by running claude --help in your terminal.