AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Claude Cli

skill-jeffpignataro-claude-oauth-skill-claude-oauth-skill · by jeffpignataro

Invoke Claude Code CLI directly with prompts using non-interactive mode

No reviews yet
0 installs
42 views
0.0% view→install

Install

$ agentstack add skill-jeffpignataro-claude-oauth-skill-claude-oauth-skill

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-jeffpignataro-claude-oauth-skill-claude-oauth-skill)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
7mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Claude Cli? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Claude CLI Skill

This skill enables you to invoke the Claude Code CLI directly with prompts in non-interactive mode, bypassing the workspace trust dialog.

Overview

The Claude Code CLI can be invoked in non-interactive mode using the -p or --print flag, which prints the response and exits. This is particularly useful for:

  • Scripting and automation
  • Piping output to other commands
  • Quick one-off queries
  • Integration with other tools

Important Security Note: The -p flag automatically bypasses the workspace trust dialog. Only use this in directories you trust.

OpenClaw Execution

When calling this skill from an OpenClaw agent, ALWAYS use pty:true to ensure the terminal output is handled correctly.

# Example OpenClaw tool call
bash pty:true command:"claude -p 'Your prompt'"

Automated Permission Approval

When using this skill for complex automation (e.g., orchestrating other Claude agents), you may encounter permission prompts that block the non-interactive flow. To pre-approve specific tools and commands in a project directory, create a .claude/settings.json file.

Common Language Permissions

Add these to the allow array based on the project's tech stack:

  • General: Read, Write, Edit, Bash(*)
  • Rust: Bash(cargo*), Bash(rustc*)
  • Node/JS: Bash(npm*), Bash(pnpm*), Bash(bun*), Bash(node*)
  • Python: Bash(python*), Bash(pip*), Bash(pytest*), Bash(poetry*)
  • Go: Bash(go*)

Example for a multi-stack project:

mkdir -p .claude
cat > .claude/settings.json "

Key Flags

  • -p, --print: Print response and exit (non-interactive mode). This automatically skips the workspace trust dialog.
  • --model : Specify a model (e.g., 'sonnet', 'opus', or full model name)
  • --output-format : Output format - "text" (default), "json", or "stream-json"
  • --max-budget-usd : Set maximum spending limit for API calls
  • --session-id : Use a specific session ID
  • --system-prompt : Override the system prompt
  • --tools : Specify available tools (e.g., "Bash,Edit,Read" or "" to disable all)

Examples

Simple Query
claude -p "What is the capital of France?"
Code Analysis
claude -p "Analyze the code in main.py and suggest improvements"
With Model Selection
claude -p --model opus "Explain quantum computing in simple terms"
JSON Output
claude -p --output-format json "List the top 3 programming languages"
With Budget Limit
claude -p --max-budget-usd 0.50 "Generate a Python script to parse CSV files"
Disable All Tools (API-only mode)
claude -p --tools "" "Explain the concept of recursion"
With Custom System Prompt
claude -p --system-prompt "You are a code reviewer" "Review this function for security issues"

Integration Patterns

Piping Output

claude -p "Generate a bash script to backup files" > backup.sh
chmod +x backup.sh

Chaining Commands

result=$(claude -p "What is 2+2?")
echo "Claude says: $result"

Processing Files

for file in *.py; do
  claude -p "Summarize this Python file: $file"
done

When to Use This Skill

Use this skill when you need to:

  1. Automate Claude interactions - Scripts, CI/CD pipelines, or automated workflows
  2. Get quick answers - One-off queries without starting an interactive session
  3. Process output programmatically - Pipe to files, parse JSON, or chain with other commands
  4. Bypass trust prompts - Work in trusted directories without manual confirmation
  5. Integrate with other tools - Combine Claude with existing command-line workflows

Security Considerations

⚠️ Warning: The -p flag bypasses the workspace trust dialog. This means:

  • Claude will have access to tools without prompting for permission
  • Only use this in directories you trust
  • Be cautious when running in directories with sensitive data
  • Consider using --tools "" to disable all tools if you only need text generation

Advanced Usage

Streaming JSON Output

claude -p --output-format stream-json "Explain machine learning" | jq -r '.content'

Fallback Model (when primary is overloaded)

claude -p --fallback-model haiku "Quick question about Python syntax"

With MCP Servers

claude -p --mcp-config ./mcp-config.json "Query the database for user stats"

Structured Output with JSON Schema

claude -p --json-schema '{"type":"object","properties":{"name":{"type":"string"},"age":{"type":"number"}},"required":["name","age"]}' "Extract person info: John is 30 years old"

Tips and Best Practices

  1. Quote your prompts: Always use quotes around prompts to handle spaces and special characters
  2. Use specific models: Specify --model for consistent behavior (e.g., --model sonnet for faster responses)
  3. Set budget limits: Use --max-budget-usd to prevent unexpected API costs
  4. Disable tools when not needed: Use --tools "" for pure text generation to improve speed and reduce costs
  5. Capture output: Redirect output to files or variables for further processing
  6. Check exit codes: The command returns 0 on success, non-zero on errors

Troubleshooting

Command not found

Ensure Claude CLI is installed and in your PATH:

which claude

Permission errors

Make sure you're in a directory you trust, or the -p flag won't help with file access permissions.

API rate limits

Use --max-budget-usd to control spending, or wait if you hit rate limits.

Related Commands

  • claude --help: View all available options
  • claude --version: Check installed version
  • claude doctor: Check CLI health and configuration
  • claude setup-token: Configure authentication

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.