chatgpt-code-review
Review code using GPT-5.2 Pro via Claude Code's Chrome integration. Use when the user asks to review code with ChatGPT, use their ChatGPT Pro subscription, get GPT-5.2 Pro to review code, or wants a second opinion from GPT. Requires Claude Code running with --chrome flag and user logged into chat.com. Triggers on "review with ChatGPT", "ChatGPT Pro review", "GPT-5.2 Pro code review", "get GPT's opinion".
When & Why to Use This Skill
This Claude skill enables seamless code reviews using GPT-5.2 Pro by integrating Claude Code with ChatGPT via Chrome automation. It allows developers to leverage high-end reasoning models for deep code analysis, bug detection, and architectural feedback, providing a powerful 'second opinion' directly within the terminal-to-browser workflow. By automating the injection of source code and handling model selection, it bridges the gap between different AI ecosystems for superior technical auditing.
Use Cases
- Cross-Model Validation: Obtain a rigorous second opinion from GPT-5.2 Pro on complex logic or critical security patches to ensure maximum code reliability.
- Advanced Technical Auditing: Automatically transfer large codebases to ChatGPT to utilize its specific reasoning strengths for identifying architectural flaws that require long-context thinking.
- Workflow Optimization: Leverage an existing ChatGPT Pro subscription to access premium models (like GPT-5.2 Pro) directly from the Claude Code CLI, eliminating manual copy-pasting and context switching.
- Asynchronous Code Analysis: Submit large files for review and continue working on other tasks while the skill monitors ChatGPT for the final analysis, perfect for deep-dive reviews that take 5-30 minutes.
| name | chatgpt-code-review |
|---|---|
| description | Review code using GPT-5.2 Pro via Claude Code's Chrome integration. Use when the user asks to review code with ChatGPT, use their ChatGPT Pro subscription, get GPT-5.2 Pro to review code, or wants a second opinion from GPT. Requires Claude Code running with --chrome flag and user logged into chat.com. Triggers on "review with ChatGPT", "ChatGPT Pro review", "GPT-5.2 Pro code review", "get GPT's opinion". |
ChatGPT Code Review via Chrome
Review code using GPT-5.2 Pro through Claude Code's Chrome browser integration.
METHOD: JSON-ENCODED TEXT INJECTION
Inject the complete code into ChatGPT's prompt using JavaScript with JSON encoding to preserve newlines.
The key insight: Use JSON.stringify() on the file content, then JSON.parse() in the injected JavaScript. This correctly preserves all newlines and special characters.
Prerequisites
- Claude Code with Chrome integration:
claude --chrome - Claude in Chrome extension installed (v1.0.36+)
- User logged into chat.com in Chrome
- ChatGPT Pro subscription (for GPT-5.2 Pro access)
Workflow
Step 1: Read the Complete File
Read the ENTIRE file. If too large for one read, read in chunks and concatenate.
content = Read(file.cpp) // Get ALL content
Step 2: Navigate to ChatGPT
- Navigate to
https://chat.com - Wait for page load
- Verify logged in
Step 3: Select GPT-5.2 Pro
- Click model selector dropdown
- Select "GPT-5.2 Pro"
Step 4: Build and Execute JavaScript
USE THIS EXACT ALGORITHM:
import json
def build_javascript(file_content: str, context: str) -> str:
"""
Build JavaScript that injects the prompt into ChatGPT.
Uses JSON encoding to preserve ALL newlines and special characters.
"""
# Combine context and code into one prompt
full_prompt = f"""{context}
Complete source code:
{file_content}
# JSON.stringify handles ALL escaping correctly
json_encoded = json.dumps(full_prompt)
# Build JavaScript that parses the JSON to get the string with real newlines
javascript = f"""var el = document.querySelector('#prompt-textarea');
var text = JSON.parse({json_encoded});
el.innerText = text;
el.dispatchEvent(new Event('input', {{bubbles: true}}));"""
return javascript
Example output:
var el = document.querySelector('#prompt-textarea');
var text = JSON.parse("Analyze this code:\\n\\n```\\n#include <stdio.h>\\nint main() {\\n return 0;\\n}\\n```");
el.innerText = text;
el.dispatchEvent(new Event('input', {bubbles: true}));
The \n inside the JSON string is correct - JSON.parse() converts them to real newlines.
Step 5: Submit
- Click send button or press ENTER
- Verify message was sent
- Return immediately - do NOT wait for completion
"Submitted to GPT-5.2 Pro. This typically takes 5-30 minutes. Ask me to 'fetch ChatGPT results' when ready."
Step 6: Fetch Results (on user request)
- Navigate to ChatGPT tab
- Check if complete (no spinner)
- Extract and return response
Error Recovery
| Issue | Action |
|---|---|
| Code appears as single line | You did NOT use JSON.parse(). Re-read Step 4. |
| Not logged in | Ask user to log in |
| Model unavailable | Fall back to GPT-5.2 Thinking |
Non-Blocking Workflow
GPT-5.2 Pro takes 5-30+ minutes. Submit and return immediately. Fetch results when user asks.