claude-cli
Use claude CLI for interactive AI sessions, scripting with print mode, MCP server management, and plugin configuration. Master session management, tool…
by lanej★ 41 GitHub stars
Install claude-cli in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Claude CLI
claude --help and claude mcp --help are authoritative for the full flag surface. This file
covers the flags that matter for scripting and the configuration shapes that are easy to get wrong.
Print mode is the scripting entry point
claude -p "summarize errors in app.log"
claude -p "count TODO comments" --output-format json | jq -r '.result'
claude -p "long task" --output-format stream-json --verbose # incremental
claude -p --fallback-model haiku "analyze this" # print mode only
--fallback-model exists only in print mode — an interactive session has no silent downgrade.
Sessions
claude -c # continue most recent
claude -r <session-id> # resume specific (bare -r for a picker)
claude -c --fork-session # branch without mutating the original
claude --session-id <uuid> # pin an ID, for scripted runs you need to find later
--fork-session is the safe way to try a different approach from a known-good point.
Model selection
Use aliases (--model sonnet|opus|haiku) rather than dated full IDs — pinned version strings go
stale and silently fail or resolve to something unintended.
Tool and permission control
claude -p "show recent commits" --allowed-tools "Bash(git:*)"
claude -p "clean project" --disallowed-tools "Bash(rm:*)" "Bash(mv:*)"
claude --permission-mode acceptEdits|plan|bypassPermissions|default
--dangerously-skip-permissions skips every check — sandboxes only.
Put the prompt before variadic tool flags so it is not consumed as another tool name.
--allowed-tools pre-approves matching calls; it is not a tool-availability sandbox.
Output fields and streaming flags: https://code.claude.com/docs/en/headless.
MCP configuration
Project-scoped servers belong in .mcp.json at the project root, not in user settings:
{
"mcpServers": {
"server-name": {
"command": "npx",
"args": ["-y", "package-name"],
"env": { "API_KEY": "value" }
}
}
}
Management:
claude mcp list
claude mcp get <name>
claude mcp remove <name>
claude mcp add --transport stdio|sse|http <name> [--env K=V] -- <command...>
claude mcp add-json <name> '{"command":"node","args":["server.js"]}'
claude mcp add-from-claude-desktop [--name <server>]
claude mcp reset-project-choices # clear approved/rejected project servers
For a run that must use only a given config, combine --mcp-config <file> with
--strict-mcp-config — without the strict flag, the file is merged with existing sources rather
than replacing them.
Settings precedence
claude --setting-sources user,project,local
claude --settings /path/to/settings.json
claude --add-dir /data/ /logs/ # grant access outside cwd
Maintenance
claude doctor (diagnose the auto-updater), claude update, claude install stable|latest|<ver>,
claude setup-token (long-lived auth for CI), claude migrate-installer (global npm → local).
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the claude-cli skill do?
Use claude CLI for interactive AI sessions, scripting with print mode, MCP server management, and plugin configuration. Master session management, tool control, and automation workflows.
How do I install the claude-cli skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the claude-cli skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…