Vibe Engines
YouTube

Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path

Claude Code (Agentic CLI)

The moves that make Claude Code fast — slash commands, file references, plan mode, memory, subagents, MCP, and headless runs.

Claude Code is an agent in your terminal: it reads files, runs commands and edits code in a loop until the task is done, asking before anything risky. Three ideas shape every session. Context is finite, so you choose what goes in (@ files, CLAUDE.md) and reset it when it fills (/clear, /compact). Permission modes set how much it may do without asking; Shift+Tab cycles them. And everything interactive also runs headless through claude -p, which is how it works in scripts and CI.

Rows reflect Claude Code 2.1; /help lists what your version has.

Prompt input

@path/to/file
pull a file into context; @src/ adds a directory listing, Tab completes paths
!npm test
bash mode: run a command yourself and put its output in the conversation
/
browse built-in commands, your custom commands and skills
Esc
stop the current action and redirect; the conversation so far is kept
Esc Esc
rewind picker: edit an earlier message or restore code (also /rewind)
Shift+Enter · \ Enter
new line in the prompt; /terminal-setup configures terminals that need it
Ctrl+V
paste an image (screenshot, mockup) from the clipboard; you can also drag files in

Keyboard shortcuts

Shift+Tab
cycle permission modes: normal → auto-accept edits → plan mode
Ctrl+O
detailed transcript with full tool output; press / to search it
Ctrl+B
send a running command or agent to the background and keep working
Ctrl+R
search your prompt history
Ctrl+G
edit the prompt in your $EDITOR — for long instructions
Ctrl+S
stash the half-written prompt, send something else, then restore it
Option+P
switch model while writing a prompt (Alt+P on Linux and Windows)
Ctrl+C twice
exit Claude Code; once clears the input or cancels

Slash commands

/init
scan the repo and draft a CLAUDE.md with build commands and conventions
/clear
start a fresh conversation — the cheapest fix for a confused session
/compact [focus]
summarize to free context; add what to keep, e.g. /compact keep the API decisions
/context
what fills the context window: tools, memory files, messages, free space
/model
switch models mid-session
/plan
enter plan mode; /plan fix the auth bug starts planning straight away
/rewind · /undo
roll the conversation and code back to an earlier point
/resume
pick up a past session from this directory; Ctrl+A shows every project
/memory
open and edit the memory files loaded this session, including auto-memory
/permissions
review and edit allow and deny rules; the Recent tab shows denials
/agents
create and manage subagents with their own prompts, tools and models
/mcp
connected MCP servers, their tools and sign-in status
/hooks
the hooks configured for tool and session events
/cost · /usage
token spend for this session · your plan’s usage limits
/security-review
check pending changes for vulnerabilities; /review does a general review
/btw
ask a side question without derailing the main task
/config
settings such as theme and editor mode (Vim keys live here now)
/doctor
diagnose installation, settings and MCP problems

Memory & settings files

CLAUDE.md
Project instructions auto-loaded every session — conventions, commands, do/don’t
~/.claude/CLAUDE.md
personal instructions applied in every project
@path in CLAUDE.md
import another file into memory, so CLAUDE.md itself stays short
.claude/rules/*.md
topic rule files; paths: frontmatter loads one only for matching files
Auto-memory
Claude saves useful facts itself; for team rules ask it to edit CLAUDE.md (the # shortcut was removed)
.claude/settings.json
shared project settings: permissions, hooks, env; settings.local.json is your git-ignored copy
~/.claude/settings.json
user-wide settings that apply to every project
Bash(git diff *)
permission rule: a tool plus a pattern, in permissions.allow or deny; deny wins
.mcp.json
project MCP servers committed with the repo; each needs approval on first use

Extend it

.claude/agents/*.md
subagents: prompt, tools and model per file; each runs in its own context window
SKILL.md
a skill in .claude/skills/NAME/: instructions Claude loads only when the task matches
.claude/commands/x.md
a custom slash command: the file’s text becomes the prompt for /x
Hooks
shell commands on events like PreToolUse, PostToolUse, Stop — format or test after edits
exit 2 in a hook
blocks the tool call (PreToolUse) and hands the hook’s stderr to Claude as the reason
claude mcp add
add a server: --transport http NAME URL, or a local command after --
mcp add --scope
local (default, just you), project (writes .mcp.json) or user
/plugin
install bundles of commands, agents, skills and hooks from a marketplace

Headless & CLI flags

claude -p "prompt"
print mode: answer once and exit — for scripts and pipes
git diff | claude -p
pipe input in: git diff | claude -p "write a commit message"
claude -c · claude -r
continue the latest session here · resume one by ID or from a picker
--output-format json
machine-readable result with cost and session ID; stream-json streams events
--permission-mode plan
start in a mode: plan, acceptEdits, default and others
--allowedTools
pre-approve tools for the run, e.g. "Bash(npm test) Edit"; --disallowedTools denies
--model sonnet
choose a model by alias or full name for this session
--add-dir ../lib
give Claude access to a directory beyond the working one
--append-system-prompt
add your own instructions on top of the default system prompt
-w NAME
start in a fresh git worktree so parallel sessions never share a checkout
--max-budget-usd 5
stop a print-mode run once it has spent $5
Skip all permissions
--dangerously-skip-permissions — only in a sandbox without internet access
In CI
Headless mode + a scoped prompt = code review, triage, or codemods in a pipeline

Recipes

Review a branch in CI with a spending cap

git diff origin/main...HEAD | claude -p "Review this diff for bugs and security issues. List each with file and line." --output-format json --max-budget-usd 2 > review.json
jq -r '.result' review.json

Print mode runs once and exits; the JSON carries the answer in .result plus cost and session details, and the budget cap stops a runaway review.

Give Claude a project memory

claude
/init
Add to CLAUDE.md: tests run with "npm test -- --include=PATH", and files under generated/ are build output, so never edit them.

/init drafts the file and the follow-up adds what Claude would otherwise get wrong. It is loaded into every session, so keep each line specific.

Run two tasks in parallel without collisions

# terminal 1
claude -w fix-auth "Fix the token refresh bug in src/auth"
# terminal 2
claude -w add-tests "Add tests for src/billing"

Each session gets its own git worktree and branch, so the two agents never edit the same checkout. Merge or open a pull request from each branch when it is done.

Connect an MCP server and check it

claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
claude mcp list
claude
/mcp

Servers that need OAuth let you sign in from /mcp; add --scope project to share the server with the team through .mcp.json.

Lock down a scripted run

claude -p "Update CHANGELOG.md for the last release" --allowedTools "Read" "Edit" "Bash(git log *)" --permission-mode acceptEdits --max-budget-usd 1

In print mode nobody is there to approve prompts, so pre-approve exactly the tools the task needs; anything else is refused rather than left waiting.

Questions about Claude Code (Agentic CLI) Cheat Sheet

What is CLAUDE.md in Claude Code?

CLAUDE.md is a Markdown file of instructions that Claude Code loads into context at the start of every session. The project file at the repository root holds team knowledge such as build and test commands, conventions and directories not to touch; a personal one in ~/.claude applies to all your projects, and files in subdirectories load when Claude works there. Run /init to generate a first draft. Keep it short and specific, because every line is read in every session: record what Claude gets wrong, not what any engineer already knows.

How do I stop Claude Code from asking for permission every time?

Allow the specific tools and commands you trust. Choosing the always-allow option on a prompt, or editing rules in /permissions, adds entries such as a git diff or npm test pattern to your settings so they never prompt again. Shift+Tab switches to auto-accept edits, which applies file changes without asking while still checking commands, and plan mode does the opposite by changing nothing. Skipping every check with the dangerously-skip-permissions flag is meant only for isolated sandboxes without network access, because then nothing stands between the agent and your machine.

What is the difference between subagents, skills and slash commands?

A slash command is a saved prompt that you trigger yourself by typing its name. A skill is a folder of instructions and optional scripts that Claude loads on its own when a task matches the skill’s description, so the expertise is available without filling every session’s context. A subagent is a separate agent with its own system prompt, tools, model and context window; the main session delegates a task to it and gets back only the result, which keeps exploration-heavy work such as searching a large codebase out of the main conversation.

Can I use Claude Code in CI or scripts?

Yes. claude -p runs one prompt non-interactively and prints the result, so it composes with pipes and shell scripts. Add --output-format json for machine-readable output that includes cost and session details, or stream-json to process events as they happen. Because nobody is present to approve actions, list the allowed tools explicitly with --allowedTools, cap spending with --max-budget-usd, and keep credentials in the CI secret store. Typical uses are reviewing pull requests, triaging issues, writing release notes and running codemods across a repository.