claude-exec-json
v0.1.0
Published
Run Claude Code in exec mode and write structured JSON output to a temp file
Readme
claude-exec-json
Run Claude Code in exec mode and write structured JSON output to a temp file.
Install / npx
npx -y claude-exec-json "summarize this repo"Usage
claude-exec-json [options] <prompt...>Options:
--schema <json>Inline JSON schema string--schema-file <path>Path to JSON schema file--out <path>Output file path (default:/tmp/.claude-exec.<uuid>.json)--model <name>Claude model alias or full name--max-turns <n>Maximum number of agentic turns--claude-bin <path>Path to claude binary (default:claude)--yoloUse--dangerously-skip-permissions--helpShow help
Pass through args to claude after --:
claude-exec-json -- --allowedTools Bash,Edit "update the README"For LLMs / agents
This tool is designed for agents that need a one-shot, non-persistent run and a JSON file on disk. It prints the output path on stdout, so you can read the file next.
npx -y claude-exec-json --schema '{\"type\":\"object\",\"properties\":{\"summary\":{\"type\":\"string\"},\"next\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"summary\",\"next\"]}' \"Summarize and list next steps\"Example flow:
OUT=$(npx -y claude-exec-json \"Describe the repo in JSON\")
cat \"$OUT\"If you use the Codex skills format, a ready-to-pull skill is included at skills/claude-exec-json/SKILL.md.
Default schema
If no schema is provided, this default is used:
{
"type": "object",
"additionalProperties": false,
"properties": {
"ok": { "type": "boolean" },
"result": { "type": "string" },
"error": { "type": "string" }
},
"required": ["ok", "result"]
}Example with schema file
cat > /tmp/schema.json <<'JSON'
{
"type": "object",
"additionalProperties": false,
"properties": {
"summary": { "type": "string" },
"tasks": { "type": "array", "items": { "type": "string" } }
},
"required": ["summary", "tasks"]
}
JSON
claude-exec-json --schema-file /tmp/schema.json "List next actions"The command prints the output path on stdout.
