The RK Times
← All posts
Claude

Claude Cli

By Romaan · Jun 9, 2026 · 8 min read · 3 views

The following are the core topics and concepts you need to know to get productive with the Claude Code CLI:

  • CLAUDE.md
  • Permissions
  • Plan mode
  • Checkpoints
  • Skills
  • Hooks
  • MCP
  • Plugins
  • Context
  • Slash Commands
  • Compaction
  • Subagents

Installation & First Run

Claude Code is a terminal-based coding agent. Install it globally with npm (Node 18+) and launch it from inside any project directory:

# Install
npm install -g @anthropic-ai/claude-code

# Start a session in your repo
cd my-project
claude

# One-off, non-interactive run (great for scripts and CI)
claude -p "summarise what changed in the last commit"

On first launch you authenticate with your Claude account or an API key. After that you just describe what you want in plain English and Claude reads files, edits code, runs commands and tests — pausing to ask permission before anything risky.

CLAUDE.md — Project Memory

CLAUDE.md is a file Claude loads automatically at the start of every session. Use it to capture the things you would otherwise repeat in every prompt: how to build and test, coding conventions, architecture notes, and do/don't rules. Run /init in a new repo to generate a starter file.

  • Project memory./CLAUDE.md at the repo root, committed to git and shared with your team.
  • User memory~/.claude/CLAUDE.md, applied to every project on your machine.
  • Nested memory — a CLAUDE.md in a subdirectory is picked up when Claude works in that part of the tree.

You can pull in other files with @path/to/file imports, and add a quick memory mid-session by starting a message with #. Keep it short and high-signal — it is sent on every request.

# Project: Acme API

## Commands
- Build: `npm run build`
- Test:  `npm test` (run the focused test before the full suite)
- Lint:  `npm run lint`

## Conventions
- TypeScript strict mode; no `any`.
- Prefer small, pure functions and table-driven tests.

## Notes
- Never edit files under `src/generated/` -- they are codegen output.

Slash Commands

# Setup terminal
/terminal-setup 

# Set theme
/theme 

# Setup configurations
/config

# Set model (Select model and efforts - with left/right arrows)
/model 

# Name the conversation
/rename <name>

# Resume the conversation
/resume <name>

# Create initial instructions
/init

Those are setup commands. Day to day you will lean on these built-ins:

  • /clear — wipe the conversation and start fresh (do this between unrelated tasks).
  • /context — see how much of the context window is in use.
  • /compact — summarise the conversation to free up context.
  • /agents, /mcp, /permissions — manage subagents, MCP servers and tool permissions.
  • /rewind — roll back to an earlier checkpoint.

You can also define your own commands. A Markdown file at .claude/commands/review.md becomes /review; it can take $ARGUMENTS, run shell with !, and reference files with @. Project commands live in .claude/commands/; personal ones in ~/.claude/commands/.

You control how hard the model thinks. Add cues like think, think hard or ultrathink to give it a bigger reasoning budget on tricky problems; keep prompts lean on routine work to save tokens. Use /context to watch usage and /clear between unrelated tasks.

Further, you can run the commands via claude cli by append ! . For example, to list the files:

! ls -l

Permissions

Claude asks before it edits files or runs shell commands. Cycle the permission mode any time with Shift+Tab:

  • Normal — approve each action (the safe default).
  • Auto-accept edits — apply file edits without prompting, but still ask before running commands.
  • Plan mode — read-only; Claude proposes a plan but changes nothing.

Codify standing rules with /permissions or in .claude/settings.json using allow, ask and deny lists — for example, allow your test runner but always ask before git push:

{
  "permissions": {
    "allow": ["Bash(npm run test:*)", "Read(./src/**)"],
    "ask":   ["Bash(git push:*)"],
    "deny":  ["Read(./.env)", "Bash(rm -rf:*)"]
  }
}

Project rules live in .claude/settings.json (shared), personal overrides in .claude/settings.local.json, and machine-wide defaults in ~/.claude/settings.json.

Plan Mode

Plan mode is a read-only gear: Claude can explore the codebase and reason about an approach but cannot edit files or run mutating commands until you approve. Reach for it before large refactors or unfamiliar code — review the proposed plan, refine it, then let Claude execute. It is the cheapest way to catch a wrong approach before any code is touched.

Checkpoints

Before each edit, Claude Code snapshots your files so you can undo an agent that went off the rails. Tap Esc twice (or run /rewind) to restore an earlier checkpoint — you can roll back the code, the conversation, or both. Checkpoints cover the changes Claude makes; they are not a replacement for git, so keep committing as you go.

Hooks

Hooks are shell commands the harness runs automatically at lifecycle events — PreToolUse, PostToolUse, UserPromptSubmit, Stop, SessionStart and more. Because they are deterministic, they are ideal for guardrails the model should never skip: auto-formatting after every edit, running tests, or blocking writes to protected paths. Configure them in settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          { "type": "command", "command": "npm run -s format" }
        ]
      }
    ]
  }
}

Configure MCP Server

Edit .claude.json file or use command line:

# Add MCP Service
claude mcp add <name> --scope [user|local]
claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer <PAT>"}}' --scope user

claude mcp add azure --scope user -- npx -y @azure/mcp@latest server start

# List MCP Service
claude mcp list

# Remove MCP Service
claude mcp remove <name>

Local scope:  A local-scoped server loads only in the project where you added it and stays private to you. Claude Code stores it in ~/.claude.json

Project-scoped servers enable team collaboration by storing configurations in a .mcp.json file at your project’s root directory. 

User-scoped servers are stored in ~/.claude.json and provide cross-project accessibility, making them available across all projects on your machine while remaining private to your user account. 

Skill

A Skill teaches the agent how to perform a task — think of it as an algorithm written in plain English. Each skill is a folder with a SKILL.md file describing when to use it and the steps to follow. Claude loads a skill's full instructions only when its description matches what you are doing (progressive disclosure), so you can install many without bloating the context window.

Project skills live in .claude/skills/<name>/SKILL.md; personal ones in ~/.claude/skills/; and plugins can ship whole bundles of them. Good skills capture repeatable workflows: a release checklist, your team's PR conventions, or how to wire up a new service.

Subagents

A subagent is a specialised assistant with its own context window, system prompt and tool set. Delegating to one keeps your main conversation clean — the subagent does the noisy work (searching the codebase, reviewing a diff, reproducing a bug) and returns just the conclusion. You can also run several in parallel on independent tasks.

Define one as a Markdown file with YAML front matter in .claude/agents/ (or manage them with /agents):

---
name: code-reviewer
description: Reviews a diff for bugs and style issues. Use after finishing a change.
tools: Read, Grep, Bash
---

You are a meticulous code reviewer. Inspect the diff, flag correctness bugs
first, then style. Report findings by severity and keep it concise.

Claude hands suitable tasks to a matching subagent automatically, or you can ask for one by name.

Workspaces & Git Worktrees

When you want Claude to work on two things at once — or to experiment without disturbing your current branch — give each session its own git worktree. A worktree is a second working directory backed by the same repository, checked out to a different branch, so parallel agents never clobber each other's files.

# Create an isolated workspace on a new branch
git worktree add ../myapp-feature-x -b feature-x

# Run Claude there
cd ../myapp-feature-x && claude

# When you are done, remove it
git worktree remove ../myapp-feature-x

The Superpowers using-git-worktrees skill (below) automates this — creating the branch, running your project's install step and verifying a clean test baseline before work begins.

Context & Compaction

Everything Claude can "see" — your messages, the files it has read and command output — lives in a finite context window. Run /context to see how full it is. The fuller it gets, the slower and less focused responses become, so treat context as a budget.

When it fills up, Claude Code compacts the conversation — summarising the older turns into a compact form and carrying on. This happens automatically, or you can trigger it with /compact (optionally with a hint, e.g. /compact focus on the auth refactor). For a hard reset between unrelated tasks, /clear is faster and cheaper than letting context grow.

Plugins

/plugin install superpowers@claude-plugins-official

The basic workflow superpowers can offer:

The Basic Workflow

  1. brainstorming – Activates before writing code. Refines rough ideas through questions, explores alternatives, presents design in sections for validation. Saves design document.
  2. using-git-worktrees – Activates after design approval. Creates isolated workspace on new branch, runs project setup, verifies clean test baseline.
  3. writing-plans – Activates with approved design. Breaks work into bite-sized tasks (2-5 minutes each). Every task has exact file paths, complete code, verification steps.
  4. subagent-driven-development or executing-plans – Activates with plan. Dispatches fresh subagent per task with two-stage review (spec compliance, then code quality), or executes in batches with human checkpoints.
  5. test-driven-development – Activates during implementation. Enforces RED-GREEN-REFACTOR: write failing test, watch it fail, write minimal code, watch it pass, commit. Deletes code written before tests.
  6. requesting-code-review – Activates between tasks. Reviews against plan, reports issues by severity. Critical issues block progress.
  7. finishing-a-development-branch – Activates when tasks complete. Verifies tests, presents options (merge/PR/keep/discard), cleans up worktree.

Tips for Getting the Most Out of It

  • Invest in CLAUDE.md early — every minute spent there is repaid on every prompt.
  • Use Plan mode for anything non-trivial, and approve the plan before code is written.
  • Give Claude a way to check its own work — tests, a type-checker or a linter wired through hooks beats eyeballing output.
  • /clear between unrelated tasks, and delegate noisy exploration to subagents to keep context lean.
  • Commit often — checkpoints are a safety net, but git is your real undo history.

Comments (0)

Be the first to comment.