---
name: ask-agent
description: Ask another AI agent a question and get the response back (subagent pattern)
argument-hint: <agent> [options] <prompt>
allowed-tools: Bash(~/.codex/skills/ask-agent/scripts/*)
---

# ask-agent

Query another AI agent non-interactively and get the response back. Use this
when you want a second opinion from a different agent (Claude, Codex, etc.).

## Usage

```
/ask-agent <agent> [options] <prompt>
```

## Arguments

- `<agent>`: The agent to query (`claude`, `codex`)
- `<prompt>`: The question or request for the agent

## Options

- `-d, --dir <dir>`: Set working directory for the agent
- `-m, --model <model>`: Specify model (agent-specific)

## Instructions

When this skill is invoked, run the agent-query.sh script:

```bash
~/.codex/skills/ask-agent/scripts/agent-query.sh <agent> [options] <prompt>
```

The script will:
1. Run the specified agent in non-interactive/print mode
2. Return the agent's response

Report the response back to the user.

## Examples

```bash
# Get Codex's opinion on an approach
/ask-agent codex "What do you think of using JWT for this auth flow?"

# Ask Claude with a specific model
/ask-agent claude -m opus "Review this error handling pattern"

# Query from a specific directory
/ask-agent codex -d ./src "Explain what the auth module does"
```

## Agent CLI Mappings

| Agent  | Non-interactive command |
|--------|------------------------|
| claude | `claude -p "<prompt>"` |
| codex  | `codex exec "<prompt>"` |

## Notes

- Response is synchronous - the calling agent waits for the response
- Useful for getting a second opinion or different perspective
- Each agent has different training data and reasoning patterns
