claude-code
Skill22 starsChanged 9 days agoMITView on GitHub
Deep-dive reference for delegating implementation work to the Claude Code CLI. Covers print-mode invocation, structured JSON output parsing, tool scoping with --allowedTools, tmux session handling, cost and turn caps, and error recovery.
48 other projects use a version of this.
Adopted by
Most recently taken up by
- kortix-ai/sunatheir own version, first seen Nov 8, 2026
- ashleysbrain/skillstheir own version, first seen Nov 8, 2026
- kortix-ai/CompanyOStheir own version, first seen Nov 8, 2026
- delorenj/skillstheir own version, first seen Nov 7, 2026
- harshitboots/ScreenSighttheir own version, first seen Nov 1, 2026
- hu465/claude-skills-their own version, first seen Oct 25, 2026
Used with
Projects with it also use Problem-Solving Techniques, minecraft-modpack-server and 6 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
truongtv22SkillProblem-Solving Techniques
Apply systematic problem-solving techniques for complexity spirals (simplification cascades), innovation blocks (collision-zone thinking), recurring patterns (meta-pattern recognition), assumption constraints (inversion exercise), scale uncertainty (scale game), and dispatch when stuck. Techniques derived from Microsoft Amplifier project patterns adapted for immediate application.
Also in 4 projects that use this
math-incSkillminecraft-modpack-server
Set up a modded Minecraft server from a CurseForge/Modrinth server pack zip. Covers NeoForge/Forge install, Java version, JVM tuning, firewall, LAN config, backups, and launch scripts.
Also in 4 projects that use this
math-incSkillpokemon-player
Play Pokemon games autonomously via headless emulation. Starts a game server, reads structured game state from RAM, makes strategic decisions, and sends button inputs — all from the terminal.
Also in 4 projects that use this
truongtv22Skillmobile-development
Build modern mobile applications with React Native, Flutter, Swift/SwiftUI, and Kotlin/Jetpack Compose. Covers mobile-first design principles, performance optimization (battery, memory, network), offline-first architecture, platform-specific guidelines (iOS HIG, Material Design), testing strategies, security best practices, accessibility, app store deployment, and mobile development mindset. Use when building mobile apps, implementing mobile UX patterns, optimizing for mobile constraints, or making native vs cross-platform decisions.
Also in 4 projects that use this
aivrarSkillsdlc-review
Review Kanban handoffs and route verified outcomes.
Also in 3 projects that use this
Tommy-ywSkillhermes-agent
Complete guide to using and extending Hermes Agent — CLI usage, setup, configuration, spawning additional agents, gateway platforms, skills, voice, tools, profiles, and a concise contributor reference. Load this skill when helping users configure Hermes, troubleshoot issues, spawn agent instances, or make code contributions.
Also in 5 projects that use this
- +2 more from math-inc
Other versions48 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 48
- NousResearch/hermes-agent★ 262ksame name
- kortix-ai/suna★ 21ksame name
- kortix-ai/CompanyOS★ 21ksame name
- mrgoonie/claudekit-skills★ 2.2ksame name
- Lilac-Labs/gini-agent★ 1.9ksame name
- Open-Curiosity/gini-agent★ 1.9ksame name
- math-inc/OpenGauss★ 1.3ksame name
- wentorai/Research-Claw★ 858same name
- Tommy-yw/RunbookHermes★ 546same name
- aivrar/portable-hermes-agent★ 239same name
38 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- dependency-analyzerSkill
- docsSkill
- handoffSkill
- openai-reviewerSkill
- plugin-homeSkill
- schema-validatorSkill
- security-auditSkill
- session-auditSkill
- test-validatorSkill
- codexSkill
- opencodeSkill
- chartsSkill
- export-csvSkill
- export-excelSkill
- make-chartSkill
- make-html-reportSkill
- make-pdfSkill
- a2a-communicateSkill
- a2a-handle-inboundSkill
- codebase-inspectionSkill
- ethos-skill-authoringSkill
- native-mcpSkill
- github-authSkill
- github-code-reviewSkill
- github-issuesSkill
- github-pr-workflowSkill
- github-repo-managementSkill
- birth-ritualSkill
- get-to-know-youSkill
- xurlSkill
- arxivSkill
- grounded-citationsSkill
- research-paper-writingSkill
- reddit-researchSkill
- code-reviewSkill
- coding-agentSkill
- planSkill
- requesting-code-reviewSkill
- spikeSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- tddSkill
- writing-plansSkill
- no-ai-slopSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. 0 are common, 7 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 40 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 62
When invoked with --output-format json, Claude Code returns a JSON object on stdout.
- Very specific: line 77
After the process exits, capture stdout via process_logs and parse:
- Distinctive: line 114
When to restrict: always restrict for investigation-only delegations (no accidental writes).
- Distinctive: line 126
If the task is not complete after N turns, Claude Code exits with the partial result.
- Very specific: line 143
When Claude Code runs inside a tmux pane (common in ethos's process model), it may emit interactive permission prompts to the PTY.
- Distinctive: line 163
When the task involves destructive operations (deleting files, force-pushing, dropping databases).
- Distinctive: line 164
When the user has explicitly asked for confirmation before changes.
- Distinctive: line 165
When delegating to an unfamiliar codebase where the blast radius is unknown.
- Very specific: line 171
Always set the working directory explicitly with --cwd:
- Very specific: line 177
Do not rely on the shell's current directory — process_start may not inherit it consistently.
- Very specific: line 213
Use --continue when a delegation needs a second pass (e.g., "now add tests for what you just changed").
- Very specific: line 215
Use --session-id when managing multiple parallel delegations and you need to resume a specific one.
- Distinctive: line 231
If the user did not specify, do not override — let Claude Code use its default.
- Distinctive: line 235
Before spawning a Claude Code delegation, verify:
“Common” is measured: kept by at least 6 in 10 of the 40 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Claude Code — Deep-Dive Delegation Reference
Comprehensive reference for spawning and managing the Claude Code CLI (claude) as a delegated coding agent under ethos process control.
When to use
- Large refactors that span many files — Claude Code excels at holding a wide codebase context and applying systematic changes across it.
- Multi-file edits where the same pattern repeats across dozens of files (rename a type, update an import path, migrate an API).
- Deep codebase reasoning — tasks that benefit from the model reading and understanding significant portions of the code before making a change.
- Complex debugging where the root cause requires reading call chains across multiple packages.
Do not use for one-line fixes, trivial formatting changes, or tasks where the startup cost of spawning a process exceeds the value of the change. Execute those directly.
Print mode — the core delegation pattern
Print mode (-p or --print) is the canonical invocation for delegation from a managed process. It runs Claude Code as a one-shot: send a task, receive a result, exit.
claude -p "<task description>" --output-format jsonThis is the only invocation pattern you should use for delegation. Interactive mode (claude without -p) opens a REPL and cannot be driven programmatically from process_start.
Minimal example
process_start({
command: 'claude -p "Refactor the UserService class to use dependency injection. The class is in src/services/user.ts and its tests are in src/services/__tests__/user.test.ts." --output-format json --cwd /path/to/project',
name: 'delegated-refactor-user-di',
cwd: '/path/to/project'
})Structured JSON output contract
When invoked with --output-format json, Claude Code returns a JSON object on stdout. The shape:
{
"result": "The assistant's response text — what it did, what changed, any warnings.",
"cost_usd": 0.042,
"duration_ms": 34200,
"turn_count": 3,
"input_tokens": 12400,
"output_tokens": 4800
}Parsing pattern
After the process exits, capture stdout via process_logs and parse:
1. Read process logs (stdout).
2. Find the last complete JSON object in the output.
3. Parse it.
4. Extract `result` for the summary, `cost_usd` for budget tracking.
5. If parsing fails, treat the raw stdout as a plain-text result and flag the anomaly.The --output-format text variant returns the result as plain text (no JSON wrapper). Use text when you only need the response and do not need cost data.
Tool scoping with --allowedTools
Claude Code has access to a broad set of tools by default (Bash, Read, Write, etc.). Restrict what it can do with --allowedTools:
# Full read-write access (default behavior, but explicit):
claude -p "<task>" --allowedTools "Bash" "Read" "Write" "Edit"
# Read-only — for investigation tasks where you do not want mutations:
claude -p "<task>" --allowedTools "Read" "Bash(cat *)" "Bash(find *)" "Bash(grep *)" "Bash(rg *)"
# Git-only — for tasks that should only inspect version control:
claude -p "<task>" --allowedTools "Bash(git *)" "Read"
# Scoped write — only allow writes to a specific directory:
claude -p "<task>" --allowedTools "Read" "Write" "Bash(cd src/api && *)"Tool scoping syntax rules
- Each allowed tool is a separate argument:
--allowedTools "Bash(git *)" "Read". Bash(pattern)restricts Bash to commands matching the glob pattern.- Multiple
Bash(...)entries are OR'd — the command must match at least one. - Omitting
--allowedToolsgrants the default full toolset.
When to restrict: always restrict for investigation-only delegations (no accidental writes). For implementation delegations, restrict to the minimum toolset the task needs.
Cost and turn caps
Turn cap
Limit conversation depth with --max-turns:
claude -p "<task>" --max-turns 5If the task is not complete after N turns, Claude Code exits with the partial result. Use this for tasks with a known upper bound on complexity.
Cost monitoring
There is no built-in cost cap flag. Monitor cost via the JSON output:
1. After process completion, parse `cost_usd` from the JSON output.
2. Compare against a budget threshold (set by the orchestrator or the user).
3. If the cost exceeds the threshold, log a warning and surface it to the user.
4. For iterative delegations (retry loops), accumulate cost across runs.A reasonable budget threshold for most single-task delegations: $0.10 for small tasks, $0.50 for medium refactors, $2.00 for large multi-file changes. Surface a warning at 80% of the threshold.
Tmux session handling
When Claude Code runs inside a tmux pane (common in ethos's process model), it may emit interactive permission prompts to the PTY. Two strategies:
Strategy 1: --yes flag (auto-approve)
claude -p "<task>" --yes --allowedTools "Bash" "Read" "Write"--yes auto-approves tool invocations that Claude Code would normally prompt for. Combine with --allowedTools to restrict the scope of what gets auto-approved.
Strategy 2: Full-auto delegation
claude -p "<task>" --yes --allowedTools "Bash" "Read" "Write" "Edit" --max-turns 10 --output-format json --cwd /path/to/projectThis is the canonical "fire and forget" invocation for a fully automated delegation. The orchestrator spawns it, monitors logs, and collects the result.
When NOT to use --yes
- When the task involves destructive operations (deleting files, force-pushing, dropping databases).
- When the user has explicitly asked for confirmation before changes.
- When delegating to an unfamiliar codebase where the blast radius is unknown.
In these cases, omit --yes and monitor the process interactively.
Working directory
Always set the working directory explicitly with --cwd:
claude -p "<task>" --cwd /absolute/path/to/projectDo not rely on the shell's current directory — process_start may not inherit it consistently. The --cwd flag is the single source of truth for where Claude Code operates.
Error recovery
Common failure modes
| Exit code | Cause | Recovery |
Non-zero, stderr contains auth | Auth token expired or revoked | Re-run claude auth login and retry |
Non-zero, stderr contains context or token | Context window exceeded | Split the task into smaller pieces; reduce --allowedTools to limit tool output |
Non-zero, stderr contains rate | Rate limited by the API | Wait 60 seconds and retry; if persistent, check usage dashboard |
Non-zero, stderr contains timeout | Process timed out | Increase the timeout or split the task |
| Non-zero, no stderr | Process killed by OS (OOM, signal) | Check system resources; retry with a simpler task |
Recovery pattern
1. Capture exit code and stderr from process_logs.
2. Match stderr against known failure patterns (table above).
3. If recoverable: apply the recovery action and retry (max 2 retries).
4. If not recoverable: surface the error to the user with the raw stderr.
5. Never silently swallow a non-zero exit.Session continuation
For multi-step delegations where context should carry over between invocations:
# Resume the most recent session for this directory:
claude -p "<follow-up task>" --continue --cwd /path/to/project
# Resume a specific session by ID:
claude -p "<follow-up task>" --session-id abc123 --cwd /path/to/projectUse --continue when a delegation needs a second pass (e.g., "now add tests for what you just changed"). The session retains the full conversation history, so the follow-up has context.
Use --session-id when managing multiple parallel delegations and you need to resume a specific one.
Model override
Override the default model with --model:
claude -p "<task>" --model claude-sonnet-4-6
claude -p "<task>" --model claude-opus-4-7When to override:
- Cheaper model for simple, well-scoped tasks (sonnet).
- Stronger model for complex reasoning, architecture decisions (opus).
- User request — if the user specifies a model, pass it through.
If the user did not specify, do not override — let Claude Code use its default.
Delegation checklist
Before spawning a Claude Code delegation, verify:
which claudesucceeds — the CLI is installed.claude auth statussucceeds — auth is configured.--cwdpoints to the correct project root.--allowedToolsis scoped to the minimum needed.--output-format jsonis set (for structured result parsing).- A
process_startname is chosen (descriptive slug). - A cost budget and turn cap are set (if applicable).
- The user has authorized the delegation.
Hard rules
- Always use print mode (
-p). Interactive mode cannot be driven fromprocess_start. - Always set
--cwd. Implicit working directory is a source of bugs. - Always parse the exit code. A zero exit with no JSON output is still a failure — the process may have been killed mid-stream.
- Never delegate without the process tool. Without
process_start, the orchestrator blocks for the full duration and the user cannot kill the delegation. - Never auto-approve (
--yes) destructive operations without explicit user authorization.
Adapted from NousResearch/hermes-agent (MIT)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

