Design systematic decision frameworks for selecting appropriate AI tools (Claude Code vs Gemini CLI) based on context requirements, codebase size, reasoning depth needs, and task complexity. Use this skill when starting projects with unclear tool requirements, optimizing context-constrained workflows, or designing multi-phase strategies that leverage multiple tools' strengths. This skill helps match tool capabilities to task characteristics, preventing wasted context and ensuring optimal resource allocation.
Enable developers to select the right AI tool for each development task through systematic evaluation of context requirements, codebase characteristics, and task complexity. This skill helps:
Use this skill when:
"Think like a resource optimization engineer allocating specialized tools to tasks where each tool excels. Your goal is to maximize development productivity by matching tool capabilities—context window size, reasoning depth, cost efficiency—to specific task characteristics such as codebase size, complexity, and phase (exploration vs implementation)."
Before selecting a tool or designing a multi-tool workflow, analyze through these questions:
"How many lines of code does this project have?"
Size Categories:
< 50K lines → Claude Code sufficient
50K-500K lines → Evaluate task type
> 500K lines → Gemini for exploration, Claude Code for implementation
How to measure:
# Count lines of code (excluding comments, blank lines)
cloc . --exclude-dir=node_modules,venv
"Is this an exploration task or focused implementation?"
Exploration Tasks (Broad understanding, pattern discovery):
Focused Implementation (Specific feature, bounded scope):
Hybrid Tasks (Both exploration and implementation):
"Does this task need deep architectural reasoning or surface-level pattern matching?"
Deep Reasoning Tasks (Architectural decisions, tradeoffs, security):
Pattern Matching Tasks (Applying known solutions, generating boilerplate):
Exploration Tasks (Understanding existing patterns):
"What's the token budget for this task?"
Tight Budget (Cost-sensitive, optimize per-token value):
Liberal Budget (Exploration prioritized, cost secondary):
Balanced Budget (Cost matters, but productivity critical):
"Is this task time-critical?"
Time-Critical (Fast iteration needed):
Non-Time-Critical (Thorough understanding prioritized):
"Do you already understand this codebase?"
Expert (Familiar with codebase, know where things are):
Intermediate (General familiarity, need occasional reference):
Novice (New to codebase, need broad understanding):
"Don't use Gemini when Claude Code suffices; don't constrain Claude Code when Gemini excels."
Match tool to task characteristics:
Anti-pattern: Using Gemini for 10K-line project (wasting context, slower, higher cost) Anti-pattern: Using Claude Code to explore 1M-line monolith (insufficient context, frustration)
"Each tool has an optimal context window for its task type."
Claude Code (200K context):
Gemini CLI (2M context):
"Exploration + Implementation as sequential workflow, not single tool."
When task requires both broad understanding AND focused implementation:
Phase 1: Gemini (Exploration)
Phase 2: Claude Code (Implementation)
Result: Best of both tools (comprehensive understanding + deep reasoning)
"Token budget influences tool selection for large codebases."
Cost considerations:
Gemini CLI: Higher cost per session (large context loaded)
Claude Code: Lower cost per session (smaller context)
Strategy: Use expensive tool (Gemini) strategically (exploration phase), then switch to efficient tool (Claude Code) for iteration.
"Framework applies to current tools; adapts to new tools."
Tool landscape evolves:
Framework adapts:
Example future decision:
IF codebase < 100K lines:
Use Claude Opus (1M context, superior reasoning)
ELSE IF codebase 100K-5M lines:
Use Gemini Ultra (10M context, comprehensive exploration)
START: Assess Codebase Size
IF codebase < 50K lines:
→ Claude Code is sufficient
→ Use Claude Code for all work
→ END
ELSE IF codebase 50K-500K lines:
→ Evaluate task type
IF task = "exploration" (understand unknown system):
→ Gemini first (broad understanding)
→ THEN Claude Code (focused implementation)
→ Go to Multi-Phase Workflow (Algorithm 2)
ELSE IF task = "focused" (implement one feature):
→ Claude Code directly
→ Load relevant files (Foundation + Current)
→ END
ELSE IF task = "deep reasoning" (architecture, security):
→ Claude Code (superior reasoning)
→ Load essential context only
→ END
ELSE IF codebase > 500K lines:
→ Claude Code insufficient
→ Multi-Phase Workflow required
→ Go to Algorithm 2
Multi-Phase Workflow (Algorithm 2):
Phase 1: Gemini Session
- Load full/large codebase
- Explore: Answer architectural questions
- Generate summary document (5K-10K tokens)
- Create checkpoint
Phase 2: Claude Code Session
- Load Gemini summary (5K tokens)
- Load Foundation/Current (20K tokens)
- Implement feature with deep reasoning (175K available)
END: Execute with selected tool(s)
Phase 1: Gemini Exploration
INPUT: Large codebase (>500K lines), exploration question
PROCESS:
1. Load codebase into Gemini (use 2M context)
2. Ask exploration questions:
- "What's the overall architecture?"
- "How does feature X work across services?"
- "Where is Y implemented?"
3. Generate summary document:
- Architecture overview (components, dependencies)
- Key patterns discovered
- Files relevant to current task
- Constraints and design decisions
4. Save summary (target: <10K tokens)
OUTPUT: Summary document for Phase 2
---
Phase 2: Claude Code Implementation
INPUT: Summary from Phase 1, implementation task
PROCESS:
1. Load summary into Claude Code (5K-10K tokens)
2. Load Foundation context (CLAUDE.md, architecture.md, decisions.md)
3. Load Current context (files relevant to task)
4. Total context loaded: ~50K tokens
5. Available for work: 150K tokens
6. Implement feature with deep reasoning
7. Validate against specification
OUTPUT: Implemented feature
---
Checkpoint Between Phases:
Create checkpoint document:
- What was learned in Phase 1 (Gemini exploration)
- What will be implemented in Phase 2 (Claude Code work)
- Key constraints from exploration
- Files identified as relevant
| Factor | Claude Code | Gemini CLI |
|---|---|---|
| Context Window | 200K standard, 1M extended | 2M standard |
| Best Use Case | Focused implementation, deep reasoning | Broad exploration, large codebase analysis |
| Reasoning Depth | Excellent (latest models) | Good (sufficient for most) |
| Cost per Session | Lower (smaller context) | Higher (larger context) |
| Response Latency | Faster (optimized for dev) | Potentially slower (larger context) |
| Ideal Codebase Size | <100K lines | >100K lines |
| Task Complexity | Deep architectural reasoning | Pattern discovery, relationship mapping |
| Specialization | AI-native development | General-purpose exploration |
Scenario: Building a Flask API (30K lines of code)
Analysis:
Decision: Claude Code exclusively
Rationale:
Workflow:
1. Load Foundation: CLAUDE.md, architecture.md (10K tokens)
2. Load Current: API routes, models relevant to endpoint (20K tokens)
3. Total context: 30K tokens (15% utilization)
4. Available: 170K tokens for implementation work
5. Implement endpoint with Claude Code
Scenario: Understanding unfamiliar Django project (200K lines)
Analysis:
Decision: Multi-phase (Gemini explore → Claude Code implement)
Rationale:
Workflow:
Phase 1: Gemini Exploration (2 hours)
1. Load full Django project (200K lines)
2. Ask: "What's the overall architecture?"
3. Ask: "How does authentication work?"
4. Ask: "Where is the payment processing logic?"
5. Generate summary: Key components, patterns, relevant files (8K tokens)
6. Save summary as exploration-checkpoint.md
Phase 2: Claude Code Implementation (ongoing)
1. Load exploration-checkpoint.md (8K tokens)
2. Load Foundation: CLAUDE.md, architecture.md (10K tokens)
3. Load Current: Files for specific feature (30K tokens)
4. Total context: 48K tokens (24% utilization)
5. Implement features with deep reasoning (152K available)
Scenario: Migrating authentication in legacy system (800K lines)
Analysis:
Decision: Multi-phase workflow (Gemini explore → Claude Code implement)
Rationale:
Workflow:
Phase 1: Gemini Exploration (1 day)
1. Load full legacy system (800K lines into 2M context)
2. Exploration questions:
- "How is authentication currently implemented across all modules?"
- "Which files contain authentication logic?"
- "What are the dependencies for current auth system?"
- "What would break if we change authentication?"
3. Generate comprehensive summary (15K tokens):
- Current authentication architecture
- All files touching authentication (list with explanations)
- Dependencies and integration points
- Migration risks and considerations
4. Save as auth-migration-analysis.md
Phase 2: Claude Code Implementation (2 weeks)
1. Load auth-migration-analysis.md (15K tokens)
2. Load Foundation: CLAUDE.md, architecture.md, decisions.md (15K tokens)
3. For each module being migrated:
- Load Current: Module files (30K tokens)
- Total context: 60K tokens (30% utilization)
- Implement migration with deep reasoning (140K available)
- Validate against security requirements
- Create checkpoint for next module
4. Repeat for all modules
Result:
- Gemini provided comprehensive system understanding
- Claude Code provided deep security reasoning for implementation
- Best of both tools leveraged systematically
Scenario: Production bug in 100K-line codebase, downtime expensive
Analysis:
Decision: Claude Code (fast iteration prioritized)
Rationale:
Workflow:
1. Identify bug location (from error logs, monitoring)
2. Load Foundation: CLAUDE.md (project patterns)
3. Load Current: Files related to bug (error-prone module + dependencies)
4. Total context: 40K tokens (20% utilization)
5. Available: 160K tokens for diagnosis + fix
6. Claude Code: Deep reasoning to diagnose root cause
7. Implement fix with validation
8. Deploy quickly
Time saved: Using Claude Code directly (no Gemini exploration phase)
Result: Bug fixed in 2 hours vs potential 4+ hours with multi-phase
Scenario: Learning React (not codebase, but large documentation corpus)
Analysis:
Decision: Either tool, prefer Claude Code for learning conversations
Rationale:
Workflow:
1. Load React documentation selectively (as needed)
2. Ask Claude Code: "Explain React hooks with examples"
3. Iterate: "How does useEffect work?"
4. Iterate: "When should I use useContext?"
5. Practice: "Generate a component using these hooks"
6. Total context grows organically (conversation-driven)
7. Claude Code 200K context sufficient for learning dialogue
| Codebase Size | Task Type | Recommended Tool | Workflow |
|---|---|---|---|
| < 50K | Any | Claude Code | Single-phase (Claude) |
| 50K-100K | Focused | Claude Code | Single-phase (Claude) |
| 50K-100K | Exploration | Claude Code or Gemini | Single or multi-phase |
| 100K-500K | Focused | Claude Code | Single-phase (selective loading) |
| 100K-500K | Exploration | Gemini → Claude | Multi-phase |
| > 500K | Any | Gemini → Claude | Multi-phase (required) |
Override conditions:
When recommending tool selection, provide:
## Tool Selection for [Task Description]
**Analysis**:
- **Codebase size**: [X lines]
- **Task type**: [Exploration / Focused / Hybrid]
- **Reasoning depth**: [Surface / Moderate / Deep]
- **Context budget**: [Tight / Balanced / Liberal]
- **Time sensitivity**: [Critical / Moderate / Not critical]
- **Expertise level**: [Novice / Intermediate / Expert]
**Recommendation**: [Claude Code / Gemini CLI / Multi-phase]
**Rationale**:
- [Reason 1 based on analysis]
- [Reason 2 based on analysis]
- [Reason 3 based on tool capabilities]
**Workflow**:
[Single-phase workflow OR Multi-phase workflow with Phase 1 and Phase 2]
**Expected outcome**: [What this approach achieves]
cloc to count lines accuratelyReady to select the right tool? Provide:
Or describe a scenario and I'll apply the framework to recommend tool selection with detailed workflow!