How to Use Claude Code

How to Use Claude Code

Julian Úsuga Posted Updated
howto claude tools

Introduction

This guide covers the parts of Claude Code that have the highest leverage in day-to-day work: slash commands, sub-agents, skills, and hooks. It is written for someone who has Claude Code installed and wants to move past basic prompting.

The April 2026 update reflects how the tool has shifted: there are more built-in slash commands, hooks are now the right way to enforce automated behavior, and /loop plus /schedule open up recurring and remote workflows that didn’t exist when this post was first written.

Key Concepts

Memory

Markdown files that persist context across sessions. Each project has its own folder under ~/.claude/projects/<project>/memory/, indexed by MEMORY.md. Claude reads memory automatically at the start of a session and writes new memories when it learns something durable.

Skills

Packaged prompts and instructions for recurring tasks. Built-in skills include /init, /review, /security-review, /loop, and /schedule. Custom skills live in ~/.claude/skills/<name>/SKILL.md and become invocable as /<name>.

Sub-agents

Separate Claude instances launched in the background via the Agent tool. They have their own context window and tool allowlist. Sub-agents shine for research and exploration: their tool noise stays out of the parent conversation.

Hooks

Shell commands the harness runs in response to events (tool calls, prompt submission, session start, stop). Hooks are the only way to enforce automated behavior — Claude itself can’t promise “from now on always do X”, but a hook can.

MCP Servers

External tool servers that connect via the Model Context Protocol. Configured per-user in ~/.claude/mcp.json or per-project in .mcp.json. MCP is how Claude reaches Gmail, Slack, databases, internal APIs, etc.

Slash Commands That Earn Their Keep

These are the commands worth remembering. Type /help in the CLI to see the full list — it’s longer than what’s here, but most of the rest is rarely useful.

Setup & session management

CommandWhat it does
/initGenerate a CLAUDE.md for the current repo. Run once per project.
/clearDrop conversation history and start fresh.
/compactSummarize long conversations to free up context — cheaper than /clear because it preserves intent.
/costShow token usage and cost for the current session.
/modelSwitch model (e.g. Opus 4.7 ↔ Sonnet 4.6 ↔ Haiku 4.5).
/fastToggle fast mode (Opus 4.6 fast variant — same model, faster output).
/configOpen the settings UI for theme, model defaults, etc.

Code review & quality

CommandWhat it does
/reviewReview a pull request. Run inside the repo; pass a PR number or omit for the current branch.
/security-reviewTargeted security pass on pending changes. Catches injection, auth gaps, secret leaks.
/ultrareviewMulti-agent cloud review (billed). User-triggered only — Claude can’t launch this for you.

Automation & scheduling

CommandWhat it does
/loop <interval> <prompt>Run a prompt on a recurring interval. Defaults to 10m. Use for “check the deploy every 5 minutes” type tasks.
/scheduleCreate, list, or delete remote cron agents. These run on Anthropic infrastructure on a schedule.

Configuration

CommandWhat it does
/permissionsAdd, remove, or move tool permissions between user and project settings.
/hooksView configured hooks. Edit settings.json to actually add them.
/agentsManage custom sub-agents.
/mcpManage MCP server connections.

The ! prefix

Type ! before a shell command to run it directly in the session. Output lands in the conversation, so Claude sees it.

! git log --oneline -20
! gcloud auth login

This is the right way to hand Claude the result of an interactive command (auth flows, anything that prompts).

Sub-Agents

Sub-agents are launched via the Agent tool. They run in the background and return a single summary message when done.

TypeUse case
general-purposeMulti-step research and implementation when you don’t want the noise in your context.
ExploreFast codebase discovery — globbing, grepping, reading files to answer “how does X work?”.
PlanArchitectural planning before a non-trivial change. Returns a step-by-step plan, not code.

You can also define custom sub-agents in ~/.claude/agents/<name>.md with their own system prompt, tool allowlist, and model. Once defined they appear as a subagent_type you can pass to Agent.

Forking vs. subagent_type

Calling Agent without a subagent_type creates a fork — a copy of the current Claude with full conversation context. Forks share the prompt cache, so they’re cheap. Use a fork when you want to delegate work but the agent needs to know everything you know. Use a typed subagent when the work is specialized and a clean context is better.

Hooks: Making Behavior Stick

If you’ve ever told Claude “from now on, always run the linter before committing” and watched it forget two messages later, you want a hook.

Hooks live in ~/.claude/settings.json (user) or .claude/settings.json (project). Available events:

  • UserPromptSubmit — fires when you send a message. Can inject context.
  • PreToolUse / PostToolUse — fires before/after a specific tool call. Can block or annotate.
  • SessionStart — fires once at the start of a session.
  • Stop — fires when Claude finishes responding. Useful for notifications.

Example: run prettier --write after every Edit or Write.

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [{ "type": "command", "command": "prettier --write \"$CLAUDE_FILE\"" }]
      }
    ]
  }
}

The harness, not Claude, runs these. They can’t be forgotten.

Plan Mode

Press Shift+Tab to toggle plan mode. In this mode Claude can read and analyze but cannot edit, write, or run side-effect-ful tools. It exits by presenting a plan you approve. Use it for anything you don’t want Claude to start coding on immediately.

Skills

Skills are reusable, namespaced prompt packages. Invoke with /<skill-name>. A few worth knowing:

  • /init — write a CLAUDE.md describing the repo.
  • /review and /security-review — described above.
  • /loop and /schedule — described above.
  • /simplify — review changed code for redundancy and quality, then fix.
  • /fewer-permission-prompts — scan transcripts for read-only commands you keep approving and add them to the project allowlist.
  • /update-config — modify settings.json (permissions, env vars, hooks) safely.

Custom skills are a SKILL.md file in ~/.claude/skills/<name>/. Frontmatter declares the trigger conditions; the body is the prompt the harness loads when the skill fires.

Anatomy of an Effective Prompt for a Sub-agent

Sub-agents start with zero context about your conversation (unless they’re forks). Brief them like a colleague who just walked in:

  1. Goal — one sentence on the outcome.
  2. Context — what you’ve already tried or ruled out, why this matters.
  3. Scope — what’s in, what’s out, what another agent is handling.
  4. Deliverable — exact format you want back. Tell them to be terse if you want terse (“under 200 words”).

Terse command-style prompts produce shallow work. Spend the tokens on context.

Case Study: 3 Agents in Parallel

The original version of this post described running three agents in parallel — content, brand, and code. The pattern still works, but in 2026 it’s worth being more disciplined about when to parallelize:

  • Parallelize independent work. Three agents reading three different parts of the codebase: yes.
  • Don’t parallelize dependent work. “One agent writes the schema, another writes the migration that depends on it” — no. The second one will start with a stale view.
  • Don’t parallelize what a single fork can do faster. If a task is mostly reading with one final synthesis, one fork beats three agents you have to merge.

A good heuristic: if you’d struggle to write three prompts that don’t reference each other, you don’t have three parallel tasks — you have one sequential task.

A Sane Default Workflow

  1. /init once when you join a repo.
  2. Use plan mode (Shift+Tab) for anything non-trivial.
  3. Send research and exploration to sub-agents (Agent with Explore or a fork).
  4. Run /review before opening a PR; /security-review if it touches auth, input handling, or secrets.
  5. Set hooks for the things you’d otherwise have to remind Claude about every session.
  6. Use /cost and /compact to stay cheap on long sessions.

Resources

Conclusion

Claude Code rewards investment. The first hour is just chatting; the second is when you start configuring hooks, writing custom skills, and chaining sub-agents. By the time you’ve added a CLAUDE.md, three hooks, and one custom skill, the tool feels less like an assistant and more like an environment.

Start with /init and a single hook. Add the rest as the friction tells you to.