agentleFS
choughtonchoughton/feature-design-prompt-templates/skills/claude-cli/SKILL.md

claude-cli

Skill1 starsChanged 6 months agoMITView on GitHub

Invoke Claude Code CLI from inside a Cowork session to get an independent Claude response, separate from the moderator's session but with full access to the project's files. Trigger when the user asks for a "fresh Claude opinion", "second Claude session", "independent Claude review", or when running a multi-model crossfire that needs a Claude-side perspective. Spawns a separate `claude` process via the Bash tool from the project's working directory so it can read referenced files, captures the response, and returns it.

  • Reads credentials
  • Installs packages

7 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions7 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 7

    1. samirpatil2000/skills★ 17same name
    2. julweber/ai_agent_skills★ 2same name
    3. Kubementat/ai_agent_skills★ 2same name
    4. tzoofu/skills★ 1same name
    5. Acnologia7021/codex-skills★ 0same name
    6. namos2502/CortexLink★ 0same name
    7. nguyenvanhuy0612/claude-skills★ 0same name

    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 repository3 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do NOT trigger when:

    line 18
  2. Very specific:

    OAuth (Pro/Max subscription) — recommended: Run claude auth login once interactively, OAuth completes, credentials cached in ~/.claude/.

    line 26
  3. Very specific:

    If you specifically need a *guaranteed-bare* run (no global config, no project context), set ANTHROPIC_API_KEY and add --bare to the …

    line 42
  4. Distinctive:

    If unavailable, tell the user:

    line 52
  5. Distinctive:

    Run from the project working directory (the cwd where the user is running the plugin — typically the repo root).

    line 76

“Common” is measured: kept by at least 6 in 10 of the 5 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Claude Code CLI Runner — Independent Claude Session

Invokes Claude Code CLI in non-interactive mode to spawn an independent Claude session, separate from the parent (moderator) Cowork session but with full access to the project's filesystem so it can read any files referenced in the prompt.

This matters because crossfire reviewers don't just respond to inlined prompt text — they read project files (PRD, Codex, Design Philosophy, the problem statement file itself, the existing codebase) the way a human reviewer would. Without filesystem access, crossfire reduces to pattern-matching on whatever was inlined.

When to use

  • A crossfire-style multi-model review needs a Claude perspective that doesn't share context with the moderator
  • The user explicitly asks for "a second Claude opinion", "fresh Claude take", "independent Claude review"
  • Sanity-checking the moderator's own reasoning by running the same question through an isolated Claude process

Do NOT trigger when:

  • The user just wants the current Claude's opinion — answer directly, don't spawn a subprocess
  • Claude Code CLI isn't installed (see Setup)

Setup the user needs

  1. Claude Code CLI installed and on PATH. On Windows: winget install Anthropic.ClaudeCode (recommended) or npm install -g @anthropic-ai/claude-code (Node 20+).
  2. Auth configured — pick one:
    • OAuth (Pro/Max subscription) — recommended: Run claude auth login once interactively, OAuth completes, credentials cached in ~/.claude/. Subsequent CLI calls use the subscription, no API key needed.
    • API key: ANTHROPIC_API_KEY env var. Required if using --bare (which we don't, by design — see below).
  3. Git for Windows installed (Windows only) so the Bash tool inside the spawned Claude works. Without it, the spawned Claude's shell tool falls back to PowerShell, which sometimes breaks downstream tooling.

Why we don't use --bare and don't isolate the cwd

--bare is Anthropic's documented "fully reproducible / scripted" mode that skips auto-discovery of CLAUDE.md, hooks, skills, plugins, MCP servers, and OAuth keychain. It also requires ANTHROPIC_API_KEY — the env-var-only auth path. Most users prefer to stay on their Pro/Max subscription rather than pay per-token, so this skill drops --bare.

The skill also runs from the project working directory (no cd /tmp isolation). This is intentional: a crossfire reviewer needs to read the project's PRD, Codex, Design Philosophy, the problem statement file, and any code referenced in the prompt. Isolating from the cwd removes that capability and reduces crossfire to "respond to whatever the moderator inlined" — which defeats the point.

What we DO want to avoid:

  • The moderator's conversation leaking into the spawned Claude. This doesn't happen automatically — claude -p does not auto-resume the parent's session. So a bare claude -p from the project dir is already independent in the way that matters.

What we accept:

  • The project's CLAUDE.md, project skills, and user-global ~/.claude/ config are loaded by the spawned Claude. For crossfire this is appropriate context, not contamination — design principles in CLAUDE.md are the kind of thing a reviewer should know.

If you specifically need a guaranteed-bare run (no global config, no project context), set ANTHROPIC_API_KEY and add --bare to the invocation. That's a deliberate opt-in for cases where you want pure prompt-in / text-out with zero environment.

How to invoke

Step 1 — Check that Claude Code CLI is available

command -v claude && claude --version

If unavailable, tell the user:

Claude Code CLI doesn't appear to be installed or on PATH. Install with winget install Anthropic.ClaudeCode (Windows recommended) or npm install -g @anthropic-ai/claude-code, then run claude auth login to authenticate via OAuth, then retry.

Stop.

Step 2 — Construct the prompt

Assemble the prompt for the fresh Claude. Critical: do not include any reference to the parent session's context unless explicitly intended. The whole point of this skill is independence. If the parent flow has source documents that should be available to the fresh Claude, include them inline in the prompt or write them to a temp file the fresh Claude reads.

For long prompts (anything over a few KB), use a file. Stdin to claude -p is capped at 10MB.

Step 3 — Run Claude from the project directory

claude -p "$PROMPT" \
  --permission-mode default \
  --allowed-tools "Read,Glob,Grep,WebFetch" \
  --max-turns 8 \
  --no-session-persistence \
  --output-format text \
  2>/dev/null

Run from the project working directory (the cwd where the user is running the plugin — typically the repo root). The spawned Claude needs to read files referenced in the prompt; it cannot do that from a temp directory.

Flag rationale:

  • -p "$PROMPT" — non-interactive print mode. Does not auto-resume the parent session.
  • --permission-mode default — prompts before risky actions but, in practice, the allowed-tools list is read-only so nothing risky comes up. Don't use dontAsk here — it would deny the read calls we explicitly want.
  • --allowed-tools "Read,Glob,Grep,WebFetch" — read-only toolset. The reviewer can read project files, search them, and fetch external references, but cannot edit, write, or shell out. This is the right shape for adversarial review.
  • --max-turns 8 — generous turn cap so the reviewer can do multi-step file exploration before producing the final response. Adjust upward for complex reviews; the cap exists to prevent runaway loops, not to constrain legitimate work.
  • --no-session-persistence — don't write this session to disk. Keeps your /resume history clean.
  • --output-format text — plain text on stdout.
  • 2>/dev/null — suppresses spinners and progress indicators.

For long prompts, write to a file in the session folder and pass via stdin or $(cat ...):

claude -p "$(cat /path/to/prompt.md)" \
  --permission-mode default \
  --allowed-tools "Read,Glob,Grep,WebFetch" \
  --max-turns 8 \
  --no-session-persistence \
  --output-format text \
  2>/dev/null

Step 4 — Capture and return

Capture stdout. Present back with framing that makes the source clear:

Independent Claude session says:

<response>

The framing matters because the user needs to understand this is NOT the moderator (Cowork Claude) talking — it's a separately-spawned Claude with no context inheritance.

Optional flags worth knowing

  • --model sonnet or --model opus — pin a specific Claude model. Useful when the user wants the fresh Claude on a different model than Cowork is using (e.g., have Opus review what Sonnet produced).
  • --append-system-prompt "<role>" — set a reviewer persona. For crossfire prompts that already establish role internally, leave this off; for ad-hoc reviews, can be useful.
  • --max-budget-usd 1.00 — cost guard. Adds a hard cap on the spawned session's cost.
  • --continue / -c or --resume / -r — DO NOT USE for fresh-context calls. These resume an existing session and defeat the purpose of this skill.

Error handling

SymptomLikely causeAction
command not foundClaude Code CLI not installedInstall per Setup
Auth error / "no credentials"claude auth login not run, or OAuth expiredTell user to re-auth
Stdin concat issuesHeredoc or other accidental stdin attachment to -pPass prompt as positional arg, not via redirected stdin
Reviewer can't see referenced filesSpawned Claude was run from a different cwd than where files liveAlways run from the project root, not a temp dir
First call slowCold start (model + tools warmup)Expected; subsequent calls are faster
Tries to use tools beyond Read/Glob/Grep--allowed-tools not enforced or wrong valuesVerify the flag is passed correctly; the spawned Claude only gets tools you allowlist

Recursion safety

Spawning claude from inside a Claude (Cowork) session does NOT create shared session state. They're separate processes that share only the host filesystem and env vars. There's no loop or contamination at the process level — the contamination concern is purely about shared config files (mitigated by the temp-dir trick).

Windows / Cowork sandbox note

Same caveat as the other model-runner skills: Claude Code CLI installed on Windows may not be reachable from Cowork's Linux Bash sandbox. If command -v claude fails inside the sandbox:

  1. Install Claude Code CLI inside the sandbox (npm install -g @anthropic-ai/claude-code).
  2. The sandbox is ephemeral, so claude auth login won't persist. You have two options:
    • Set ANTHROPIC_API_KEY env var (forces you back into the API-key path — defeats the OAuth goal).
    • Find a way to mount or copy ~/.claude/ from the host into the sandbox, or have Cowork itself expose host credentials. This is environment-specific and may not be supported.

This caveat is the most likely failure point on Windows + Cowork. Worth verifying first.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.