collaborating-with-claude-code
Delegate code implementation/review/debugging/alternatives to Claude Code via a JSON bridge script. Multi-turn via SESSION_ID.
About this skill
This skill acts as a robust JSON bridge, enabling AI coding agents to delegate complex development tasks directly to Claude Code. It allows for non-interactive execution of `claude` (Claude Code) in "print" mode, returning its output as structured JSON. This facilitates a deeper level of collaboration, allowing the agent to tap into Claude Code's capabilities for tasks like securing second opinions on code, performing detailed code reviews, designing comprehensive test cases, and exploring various code implementations or architectural alternatives. Designed for multi-turn interactions, the skill maintains context using a `SESSION_ID`, making it suitable for iterative development and debugging processes. It's particularly useful when an agent requires advanced code generation, problem-solving, or critical analysis beyond its immediate capabilities, leveraging Claude Code's specialized knowledge in a structured, programmatic way. Developers using AI coding agents can benefit significantly by offloading time-consuming or intricate coding challenges. This skill transforms Claude Code into a dedicated, callable expert within an agent's workflow, enhancing productivity and the quality of generated code by providing access to a powerful external reasoning engine for software development.
Best use case
The primary use case is to significantly extend the coding and reasoning capabilities of an AI agent by integrating Claude Code as a specialized collaborator. Developers, especially those working on complex projects or requiring high-quality code, benefit most by being able to delegate intricate coding tasks—such as in-depth code reviews, sophisticated test designs, or exploring multiple implementation strategies—to Claude Code via their primary agent, streamlining development workflows and improving code quality.
Delegate code implementation/review/debugging/alternatives to Claude Code via a JSON bridge script. Multi-turn via SESSION_ID.
A structured JSON response from Claude Code containing detailed explanations, code suggestions, reviews, or answers related to the delegated coding task, enabling the AI agent to integrate and act upon expert insights.
Practical example
Example input
Hey Agent, please use the Claude Code collaboration skill to review the `src/utils.py` file. Ask Claude to focus on potential security vulnerabilities and suggest best practices for input sanitization and error handling. Summarize its key findings and any recommended refactorings.
Example output
```json
{"success": true, "SESSION_ID": "my_session_id_123", "agent_messages": "Okay, I've engaged Claude Code to review `src/utils.py`. Claude identified a potential deserialization vulnerability in the `load_config` function and recommends using `json.loads` with object_hook for safer handling. For error handling, it suggests more specific exception types and consistent logging. Key refactorings include implementing a schema validation for configuration and using context managers for file operations. Full details provided in the attached code suggestions."}
```When to use this skill
- When your AI agent needs a second opinion or expert analysis on code structure, logic, or best practices.
- For delegating comprehensive code reviews, identifying bugs, or suggesting performance optimizations.
- To generate robust test cases or explore alternative code implementations for a given problem.
- When engaging in multi-turn debugging sessions that require persistent context with Claude Code.
When not to use this skill
- When extremely fast, real-time code suggestions are required, as Claude Code tasks can take 1-2+ minutes.
- In untrusted repositories or directories, especially when using the `--full-access` option, due to potential security risks.
- For very simple coding tasks that can be handled efficiently by the agent itself without external delegation.
- If you need to redirect the script's stdout to a file directly, as it's designed to print final JSON to stdout and stream assistant text to stderr.
How collaborating-with-claude-code Compares
| Feature / Agent | collaborating-with-claude-code | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | medium | N/A |
Frequently Asked Questions
What does this skill do?
Delegate code implementation/review/debugging/alternatives to Claude Code via a JSON bridge script. Multi-turn via SESSION_ID.
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as medium. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# Collaborating with Claude Code
Use this skill for second opinions, code review, test design, or code implementations/alternatives. The bridge runs `claude` (Claude Code) non-interactively ("print" mode) and returns JSON.
The script is located at `~/.codex/skills/collaborating-with-claude-code/scripts/claude_code_bridge.py`.
## Timing
Claude Code often needs **1–2+ minutes** per task.
- Prefer running the bridge directly (no `&`); increase `--timeout-s` as needed (default: 1800s).
- Do **NOT** redirect stdout to a file (e.g. `> /tmp/out.json`).
- By default, the bridge streams Claude's assistant text to `stderr`, and prints only the final JSON envelope to `stdout`.
## Context
- Do **NOT** read the script unless you are modifying it;
- Before running the script, ALWAYS use `python <script_loc> --help` to get the usage instructions.
## Usage
- please always require claude code to fully understand the codebase before responding or making any changes.
- Put collaborating-with-claude-code terminal commands in the background terminal.
- Always review claude code's responses (or changes it makes) and make sure they are correct, constructive and complete.
- When claude code asks clarifying questions in a multi-turn session, always respond to its questions in that session based on current situation.
## Default
- **full access** (`--full-access`): use only in trusted repos/directories.
- **extended thinking ON** (can disable via `--no-extended-thinking`).
- **step mode AUTO** (can disable via `--step-mode off`).
## Output format
The bridge prints JSON to `stdout`:
```json
{"success": true, "SESSION_ID": "abc123", "agent_messages": "…Claude output…"}
```
## Recommended delegation patterns
- **Guided coding**: "Implement the code for [feature] following these specific steps/constraints."
- **Second opinion**: "Propose an alternative approach and tradeoffs."
- **Code review**: "Find bugs, race conditions, security issues; propose fixes."
- **Test design**: "Write a test plan + edge cases; include example test code."
- **Diff review**: "Review this patch; point out regressions and missing cases."Related Skills
CLAUDE.md – JJ Quick Command List
A concise cheat sheet for essential Jujutsu (`jj`) version control commands, designed to help AI agents or users quickly perform common repository operations.
claude-code-dispatch
Dispatch development tasks to Claude Code with automatic callback on completion. Supports Agent Teams (multi-agent parallel dev with dedicated Testing Agent), cost controls (--max-budget-usd), model fallback, git worktree isolation, custom subagents via --agents JSON, and MCP server integration. Use when: (1) dispatching a coding task to Claude Code and wanting automatic Telegram notification on completion, (2) running Agent Teams for parallel dev+test workflows, (3) needing zero-polling task execution with Stop Hook callback, (4) the user says 'use Claude Code to build/develop/create X', (5) the user asks to dispatch or run a Claude Code task. THIS IS THE DEFAULT for any 'build/develop/create a project' request — prefer this over claude-code-clawdbot for anything that takes >2 min or needs background execution.
laravel-expert
Senior Laravel Engineer role for production-grade, maintainable, and idiomatic Laravel solutions. Focuses on clean architecture, security, performance, and modern standards (Laravel 10/11+).
webmcp
This skill guides AI agents in implementing WebMCP within web projects, enabling browser-native structured tools for AI interaction using JavaScript or HTML APIs.
Prompt Coach
Analyze your Claude Code session logs to improve prompt quality, optimize tool usage, and enhance your skills as an AI-native engineer.
react
This AI agent skill guides the generation of modern React components, incorporating best practices such as destructured props, leveraging compiler optimizations, and proper use of React Effects. It also ensures compatibility and utilizes Tailwind CSS v4 syntax.
nextjs
Provides comprehensive Next.js routing capabilities, including typed routes, helpers for `PageProps` and `LayoutProps`, and `nuqs` for managing URL state.
just
Use `just` to save and run project-specific commands. Use when the user mentions `justfile`, `recipe`, or needs a simple alternative to `make` for task automation.
chrome-debug
This skill empowers AI agents to debug web applications and inspect browser behavior using the Chrome DevTools Protocol (CDP), offering both collaborative (headful) and automated (headless) modes.
worktree-manager
Create, manage, and cleanup git worktrees with Claude Code agents across all projects. USE THIS SKILL when user says "create worktree", "spin up worktrees", "new worktree for X", "worktree status", "cleanup worktrees", "sync worktrees", or wants parallel development branches. Also use when creating PRs from a worktree branch (to update registry with PR number). Handles worktree creation, dependency installation, validation, agent launching in Ghostty, and global registry management.
clearshot
Structured screenshot analysis for UI implementation and critique. Analyzes every UI screenshot with a 5×5 spatial grid, full element inventory, and design system extraction — facts and taste together, every time. Escalates to full implementation blueprint when building. Trigger on any digital interface image file (png, jpg, gif, webp — websites, apps, dashboards, mockups, wireframes) or commands like 'analyse this screenshot,' 'rebuild this,' 'match this design,' 'clone this.' Skip for non-UI images (photos, memes, charts) unless the user explicitly wants to build a UI from them. Does NOT trigger on HTML source code, CSS, SVGs, or any code pasted as text.
osgrep
Semantic code search using natural language queries. Use when users ask "where is X implemented", "how does Y work", "find the logic for Z", or need to locate code by concept rather than exact text. Returns file paths with line numbers and code snippets.