Query AI Agent

VerifiedCaution

Queries another AI agent (Claude, Codex) non-interactively and returns its response. Useful for getting a second opinion or a different perspective on a problem, executing the request synchronously via a command.

Sby Skills Guide Bot
DevelopmentBeginner
606/2/2026
Claude CodeCodex
#ask-agent#subagent-pattern#agent-query#second-opinion

Recommended for

Our review

Queries another AI agent (Claude or Codex) non-interactively and returns its response.

Strengths

  • Quickly get a second opinion from a different model
  • Synchronous usage with minimal blocking
  • Supports custom working directory and model selection

Limitations

  • Depends on the availability of target agents
  • No streaming, only full response
  • Requires prior setup of the agents
When to use it

When you want to cross-check an idea or code snippet with another AI agent.

When not to use it

If the target agent is not installed or an asynchronous interaction is preferred.

Security analysis

Caution
Quality score92/100

The skill runs a bash script that passes user input to external AI agent commands. While the allowed-tools is restricted, there remains risk of shell injection if the script does not robustly sanitize arguments. Additionally, the external AI agents' own safety is out of control. The skill itself does not instruct destructive actions, but caution is warranted.

Findings
  • The skill executes shell commands based on user-supplied prompt and arguments; if the agent-query.sh script does not properly sanitize inputs, it could be vulnerable to command injection.
  • Invoking external AI agents could lead to unpredictable or potentially harmful responses, though the skill only returns the response text without executing it.

Examples

Second opinion on authentication approach
/ask-agent codex "What do you think of using JWT for this auth flow?"

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:

~/.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

# 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
Related skills