collaborating-with-claude
Original:🇺🇸 English
Translated
1 scriptsChecked / no sensitive code detected
Use the Claude Code CLI to consult Claude and delegate coding tasks for prototyping, debugging, and code review. Supports multi-turn sessions via SESSION_ID. Optimized for low-token, file/line-based handoff.
2installs
Added on
NPX Install
npx skill4agent add renocrypt/latex-arxiv-skill collaborating-with-claudeTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Collaborating with Claude Code (Codex)
Use Claude Code CLI as a collaborator while keeping Codex as the primary implementer.
This skill provides a lightweight bridge script () that returns structured JSON and supports multi-turn sessions via .
scripts/claude_bridge.pySESSION_IDWhen to use
- You want a second opinion (design tradeoffs, edge cases, missing tests).
- You want Claude to propose or review a unified diff (Claude does not edit files).
- You want multi-turn back-and-forth while you implement locally.
When not to use
- The task is trivial or one-shot (do it directly in Codex).
- You need authoritative facts that require browsing/citations (Claude may guess).
- You might paste sensitive data (secrets, private keys, prod logs).
Core rules
- Claude is a collaborator; you own the final result and must verify changes locally.
- Do not invoke directly; always use the bridge script (
claude) so output/session handling stays consistent.scripts/claude_bridge.py - Prefer file/line references over pasting snippets. Run the bridge with set to the repo root (it sets the
--cdprocess working directory); useclaudewhen Claude needs access to additional directories.--add-dir - For code changes, request Unified Diff Patch ONLY and forbid direct file modification.
- Always run the bridge script with first if you are unsure of parameters.
--help - Always capture and reuse it for follow-ups to keep the collaboration conversation-aware.
SESSION_ID - For automation, prefer (resume). Session selectors are mutually exclusive: choose one of
--SESSION_ID,--SESSION_ID, or--continue.--session-id - Keep a short Collaboration State Capsule updated while this skill is active.
- Default timeout: when invoking via the Codex command runner, set to 600000 (10 minutes) unless a shorter/longer timeout is explicitly required.
timeout_ms - Default model: prefer for routine work; use
sonnetonly for complex tasks or when explicitly requested.opus - Ensure Claude Code is logged in before running headless commands (run and
claudeonce if needed)./login - Streamed JSON requires ; the bridge enables this automatically.
--verbose
Model selection
Claude Code supports model aliases, so you can use / instead of hard-coding versioned model IDs.
--model sonnet--model opus- If you omit , Claude Code uses its configured default (typically from
--model, optionally overridden by~/.claude/settings.jsonand.claude/settings.json)..claude/settings.local.json - If you need strict reproducibility, pass a full model name via .
--model <full-name>
Quick start (shell-safe)
⚠️ If your prompt contains Markdown backticks (), do not pass it directly via (your shell may treat backticks as command substitution). Use a heredoc instead; see .
`like/this`--PROMPT "..."references/shell-quoting.mdbash
PROMPT="$(cat <<'EOF'
Review src/auth.py around login() and propose fixes.
OUTPUT: Unified Diff Patch ONLY.
EOF
)"
python3 .codex/skills/collaborating-with-claude/scripts/claude_bridge.py --cd "." --model sonnet --PROMPT "$PROMPT" --output-format stream-jsonOutput: JSON with , , , and optional / .
successSESSION_IDagent_messageserrorall_messagesMulti-turn sessions
bash
# Start a session
PROMPT="$(cat <<'EOF'
Analyze the bug in foo(). Keep it short.
EOF
)"
python3 .codex/skills/collaborating-with-claude/scripts/claude_bridge.py --cd "." --PROMPT "$PROMPT" --output-format stream-json
# Continue the same session
PROMPT="$(cat <<'EOF'
Now propose a minimal fix as Unified Diff Patch ONLY.
EOF
)"
python3 .codex/skills/collaborating-with-claude/scripts/claude_bridge.py --cd "." --SESSION_ID "<SESSION_ID>" --PROMPT "$PROMPT" --output-format stream-jsonPrompting patterns (token efficient)
Use as a starter when crafting .
assets/prompt-template.md--PROMPT1) Ask Claude to open files itself
Provide:
- Entry file(s) and approximate line numbers
- Objective and constraints
- Output format (diff vs analysis)
Avoid:
- Pasting large code blocks
- Multiple competing objectives in one request
2) Enforce safe output for code changes
Append this to prompts when requesting code:
OUTPUT: Unified Diff Patch ONLY. Strictly prohibit any actual modifications.
3) Use Claude for what it’s good at
- Alternative solution paths and edge cases
- UI/UX and readability feedback
- Review of a proposed patch (risk spotting, missing tests)
Verification
- Smoke-test the bridge: .
python3 .codex/skills/collaborating-with-claude/scripts/claude_bridge.py --help - If you need a session: run one prompt with and confirm the JSON contains
--output-format stream-jsonand asuccess: true.SESSION_ID - Note: won’t include a newly generated session id; use
--output-format text/stream-jsonto capture it. If you resume withjsonin--SESSION_IDmode, the bridge echoes thattextin its JSON output.SESSION_ID
Safety & guardrails
- Never paste secrets (private keys, API keys, seed phrases) into prompts.
- For code changes, request Unified Diff Patch ONLY and apply changes yourself.
- Treat Claude output as suggestions; verify locally (tests, lint, build) before merging.
Collaboration State Capsule
Keep this short block updated near the end of your reply while collaborating:
text
[Claude Collaboration Capsule]
Goal:
Claude SESSION_ID:
Files/lines handed off:
Last ask:
Claude summary:
Next ask:References
- (prompt patterns)
assets/prompt-template.md - (shell quoting/backticks)
references/shell-quoting.md