Gemini CLI Delegation & Large Context Routing
Fast delegation of large-context tasks to Gemini CLI via MCP when file size exceeds 100KB or task requires analysis/review.
Best use case
Gemini CLI Delegation & Large Context Routing is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Fast delegation of large-context tasks to Gemini CLI via MCP when file size exceeds 100KB or task requires analysis/review.
Teams using Gemini CLI Delegation & Large Context Routing should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/core-gemini-delegator/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How Gemini CLI Delegation & Large Context Routing Compares
| Feature / Agent | Gemini CLI Delegation & Large Context Routing | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Fast delegation of large-context tasks to Gemini CLI via MCP when file size exceeds 100KB or task requires analysis/review.
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.
SKILL.md Source
## Purpose & When-To-Use
**Trigger Conditions:**
Use this skill for fast delegation decisions when:
- **Large file analysis**: Single file >100KB
- **Analysis/review tasks**: Summarization, comprehension, codebase review
- **Sandbox code testing**: Safe execution of unfamiliar code
**Do NOT use when:**
- File <100KB and task is edit/refactor/debug (Claude excels here)
- Multi-file orchestration needed (use separate orchestration agent)
- Real-time debugging or iterative refinement
---
## Pre-Checks
**Timestamp & Environment**
```
NOW_ET = 2025-10-26T01:18:53-04:00 (America/New_York, ISO-8601)
```
**Required validations before delegation:**
1. **Input schema validation**:
- `task_description` is non-empty string
- `file_paths` (if provided) resolve to accessible files
2. **Security pre-flight**:
- Scan file paths for patterns like `.env`, `credentials.json`, `*.key`, `*.pem`
- Abort if secrets detected; prompt user to sanitize
---
## Procedure
**Token Budget: T1≤2000 tokens**
### Tier 1 — Fast Delegation Decision (T1≤2000 tokens)
**Two-step process:**
1. **Delegation gate** (primary decision):
- If file size >100KB → **delegate to Gemini**
- If task type = `analysis|review|summarize|codebase-review` → **delegate to Gemini**
- Else → **keep in Claude**
2. **Format output**:
- If delegating: emit `delegation_command` for Gemini MCP
- Else: emit `recommended_tool: "claude"`
- Include brief rationale citing threshold
---
## Decision Rules
**Primary Routing Logic:**
| Condition | Threshold | Action |
|-----------|-----------|--------|
| File size | >100KB | Delegate to Gemini |
| Task type | `analysis`, `review`, `summarize`, `codebase-review` | Delegate to Gemini |
| Sandbox execution | Any code testing | Delegate to Gemini |
| Otherwise | Default | Keep in Claude |
**Note:** Complex multi-file orchestration belongs in a separate orchestration agent, not this skill.
**Abort Conditions:**
- Secrets detected in file paths or task description
---
## Output Contract
**Schema (TypeScript-style):**
```typescript
interface DelegationResult {
delegation_decision: boolean; // true = delegate to Gemini
recommended_tool: "claude" | "gemini-mcp";
delegation_command?: string; // only if delegation_decision = true
rationale: string; // max 160 chars, cites threshold
security_flags: string[]; // empty if clean; else warnings
}
```
**Required fields:**
- `delegation_decision`, `recommended_tool`, `rationale`, `security_flags` (always)
- `delegation_command` (only if `delegation_decision = true`)
---
## Examples
**Example 1: Large File Analysis (Delegate)**
```yaml
# Input
task_description: "Summarize research paper"
file_paths: ["./paper.pdf"]
context_size_estimate: 3500 # KB
# Output
{
"delegation_decision": true,
"recommended_tool": "gemini-mcp",
"delegation_command": "ask gemini to analyze @./paper.pdf and summarize key findings",
"rationale": "File size 3.5MB > 100KB threshold",
"security_flags": []
}
```
**Example 2: Small File Edit (Keep in Claude)**
```yaml
# Input
task_description: "Refactor authentication function"
file_paths: ["./auth.py"]
context_size_estimate: 45 # KB
# Output
{
"delegation_decision": false,
"recommended_tool": "claude",
"rationale": "File <100KB and task type 'refactor' suits Claude precision",
"security_flags": []
}
```
---
## Quality Gates
**Token Budget Enforcement:**
- **Token budget**: T1≤2k tokens for fast delegation decision (T2/T3 not applicable - skill simplified to T1 only)
- Examples must be ≤30 lines each (including fences)
**Safety Checks:**
- [ ] No API keys or secrets in delegation_command
- [ ] PII screening if task involves user data
- [ ] Sandbox isolation for code execution tasks
**Determinism:**
- Same inputs (file size, task type) must produce same delegation decision
- Rationale must cite specific threshold (e.g., "File size >100KB")
---
## Resources
**Primary Sources:**
- [Gemini MCP Tool Repository](https://github.com/jamubc/gemini-mcp-tool) — MCP server implementation, CLI integration (accessed 2025-10-26T01:18:53-04:00)
- [Gemini API Long Context Documentation](https://ai.google.dev/gemini-api/docs/long-context) — 1M token context window (accessed 2025-10-26T01:18:53-04:00)
- [Model Context Protocol - Claude Docs](https://docs.claude.com/en/docs/mcp) — MCP specification (accessed 2025-10-26T01:18:53-04:00)
**Configuration Templates:**
- `resources/mcp-config-template.json` — Claude Desktop MCP setup for gemini-mcp-tool
- `resources/delegation-decision-matrix.md` — Static reference table (not computed during skill execution)Related Skills
Codex CLI Delegation & Code Generation Routing
Intelligently delegate code generation, boilerplate creation, and automation tasks to OpenAI Codex CLI for rapid prototyping and development.
UX Wireframe Designer
Design user experience wireframes, user flows, and interactive mockups for web and mobile applications using industry-standard notation
TypeScript Tooling Specialist
Generate TypeScript/JavaScript project scaffolding with npm/pnpm/yarn, Jest/Vitest, ESLint/Prettier, and bundling (Vite/Rollup/esbuild).
Python Tooling Specialist
Generate Python project scaffolding with Poetry/pipenv, pytest configuration, type hints (mypy), linting (ruff/black), and packaging (setuptools/flit).
Java Tooling Specialist
Generate Java project scaffolding with Maven/Gradle, JUnit 5, Mockito, Checkstyle/SpotBugs, and packaging (JAR/WAR/native-image).
C# .NET Tooling Specialist
Generate C# .NET project scaffolding with dotnet CLI, xUnit/NUnit, StyleCop analyzers, and packaging (NuGet/Docker).
Unit Testing Framework Generator
Generate unit test scaffolding and test suites for Jest, PyTest, Go testing, JUnit, RSpec with mocking, assertions, and coverage configuration
Testing Strategy Composer
Compose comprehensive testing strategies spanning unit, integration, e2e, and performance tests with optimal coverage.
Load Testing Scenario Designer
Design load testing scenarios using k6, JMeter, Gatling, or Locust with ramp-up patterns, think time modeling, and performance SLI validation.
Integration Testing Designer
Design integration test scenarios with database fixtures, external service mocks, contract testing, and test environment setup for microservices and APIs.
Chaos Engineering Experiment Designer
Design chaos engineering experiments to test system resilience with controlled failure injection, hypothesis formulation, and blast radius control.
Terraform Module Best Practices
Design reusable Terraform modules with variable validation, output schemas, module composition, and testing (Terratest).