Global InfinityAgent Intelligence
← Back to Agent Radar

Agentic coding tool

Claude Code

A practical Claude Code guide covering installation, prompting, CLAUDE.md, permissions, Skills, subagents, Hooks, MCP, parallel work, CI, and troubleshooting.

Claude Code Field Manual — Source Edition

Adapted from Anthropic’s official Claude Code documentation. This source edition reorganizes the linked learning pages into a task-first manual for Global Infinity. It is an original editorial guide rather than a copy of the documentation site, with practical commands, configurations, prompts, and workflows readers can adapt.

Claude Code workflow: understand, plan, act, verify
Claude Code’s practical loop: gather context, choose an approach, take action, and verify the result.

1. What Claude Code is and where to use it

Claude Code is an agentic development tool that can inspect a codebase, edit files, run commands, and connect to development tools. Choose the surface that matches the work rather than forcing every task through one interface.

SurfaceBest forTypical starting point
Terminal CLIFull repository work, shell commands, scripts, and automationclaude
VS Code / JetBrainsFocused edits, selections, inline diffs, and plan reviewOpen the Claude Code panel in the project
DesktopParallel sessions, visual diffs, previews, and integrated toolsCreate a Code session for a folder
Web / mobileCloud tasks against a connected GitHub repositoryStart at claude.ai/code

2. Install and start safely

Recommended native install

# macOS, Linux, or WSL
curl -fsSL https://claude.ai/install.sh | bash

# Homebrew stable channel
brew install --cask claude-code

# Windows with WinGet
winget install Anthropic.ClaudeCode

First project

cd ~/projects/example-app
claude

# Useful health and authentication checks
claude doctor
claude auth status --text

Launch Claude Code from the repository or package you want it to understand. Starting too high in the filesystem gives it noisy context; starting too deep can hide project-level instructions.

3. Give Claude a finishable task

A strong request states the outcome, the relevant context, constraints, and proof of completion. For unfamiliar or risky work, separate exploration and planning from implementation.

Weak prompt

Fix checkout.

Task-ready prompt

Goal: stop duplicate orders when a customer retries payment.

Context:
- Checkout handler: src/checkout/submit.ts
- Payment client: src/payments/client.ts
- Reproduction: two requests with the same idempotency key create two orders

Constraints:
- Keep the public API response unchanged
- Reuse the existing transaction helper
- Do not modify unrelated formatting

Done when:
- Add a regression test for concurrent retries
- The targeted checkout tests pass
- Explain the root cause and summarize changed files

Plan-first prompt

Explore the authentication and session-refresh flow. Do not edit files yet.
Map the request path, identify race conditions and security boundaries, then
propose a short plan with tests and rollback considerations. Wait for approval.

4. Use the agentic loop deliberately

  1. Gather context: ask Claude to find entry points, related tests, local conventions, and current changes.
  2. Choose an approach: use plan mode for ambiguous, architectural, or high-risk changes.
  3. Act: keep the implementation coherent and scoped.
  4. Verify: run tests, inspect real output, and review the diff before completion.

Explore an unfamiliar repository

Give me a guided map of this repository. Identify the runtime entry points,
main data flow, test strategy, configuration layers, and the three files I
should read first. Cite file paths; do not change anything.

Debug with evidence

Reproduce the reported timeout before proposing a fix. Trace one failing request,
inspect the nearest logs and tests, and separate confirmed facts from hypotheses.
Make the smallest fix only after the root cause is supported by evidence.

Verification brief

Run the smallest relevant checks first, then the broader suite if they pass.
For UI changes, open the actual flow and verify visible content, interactions,
responsive layout, and console errors. Do not treat HTTP 200 as visual proof.

5. Manage context instead of fighting it

Claude Code’s context contains the conversation, tool results, files, instructions, skills, and other loaded material. Keep one session focused on one coherent objective. Use a fresh session when the objective changes, and compact long sessions with an explicit focus.

/context
/compact Preserve the accepted plan, changed files, failing test, and next action.
/clear

Use @path/to/file or IDE selections to point at high-value context. Avoid asking Claude to read a whole repository when a few entry points and failing tests can establish the task.

6. Store durable guidance with CLAUDE.md

CLAUDE.md contains instructions written by the team; auto memory contains learnings Claude records across sessions. Instructions guide behavior but are not a hard security control. Put enforced restrictions in settings, permissions, sandbox policy, or hooks.

Project CLAUDE.md example

# Project guide

## Commands
- Install: npm ci
- Unit tests: npm test
- End-to-end tests: npm run test:e2e
- Lint: npm run lint

## Architecture
- HTTP handlers live in src/api/handlers/.
- Business rules belong in src/domain/ and must not import UI modules.

## Delivery rules
- Preserve user changes outside the task.
- Add a regression test for every bug fix.
- Never deploy or push unless explicitly requested.
- Report the commands actually run before handoff.

Initialize and inspect memory

/init
/memory
/context

Path-scoped rule

---
paths:
  - "src/api/**/*.ts"
---

# API rules
- Validate every external input.
- Use the shared error response helper.
- Add an integration test for authorization boundaries.

If the repository already uses AGENTS.md, a short CLAUDE.md can import it with @AGENTS.md and add Claude-specific guidance below.

7. Configure settings, permissions, and sandboxing

Claude Code merges settings from managed, user, project, and local layers. Commit team-safe project settings; keep personal or machine-specific settings in the local file. Permission rules can allow, ask, or deny tools and command patterns.

Project settings example

{
  "permissions": {
    "allow": [
      "Bash(npm test:*)",
      "Bash(npm run lint:*)"
    ],
    "deny": [
      "Read(./.env)",
      "Read(./secrets/**)"
    ]
  },
  "sandbox": {
    "enabled": true
  }
}

Permission modes

ModeUseCaution
DefaultNormal work with approval promptsReview unfamiliar commands carefully
PlanResearch and design without implementationUse it to agree on scope before edits
Accept editsTrusted editing workflowCommands can still require approval
Bypass permissionsOnly inside a separately isolated environmentDo not use casually on a normal workstation

The Bash sandbox can restrict filesystem and network access while allowing more autonomous command execution. Sandbox policy and permission rules are complementary, not interchangeable.

8. Package repeatable work as Skills

A Skill is appropriate when a multi-step workflow should be reusable, discoverable, and shareable. Keep the main instructions focused and move large references or scripts into supporting files.

Minimal Skill

.claude/skills/release-check/
└── SKILL.md

---
name: release-check
description: Validate a web release before deployment.
---

# Release check
1. Run unit and integration tests.
2. Build the production bundle.
3. Inspect the primary flow in a browser.
4. Summarize risk and blockers.
5. Do not deploy unless the user explicitly requests it.

Use a Skill for a workflow; use CLAUDE.md for durable repository facts; use a hook when an action must run mechanically.

9. Delegate focused work to subagents

Subagents have their own context and can be restricted to particular tools. They are useful for independent research, review, testing, or specialist analysis. Give each one a bounded output that the main session can evaluate.

Custom reviewer subagent

---
name: security-reviewer
description: Review changed code for exploitable security defects.
tools: Read, Grep, Glob, Bash
model: inherit
---

Review only the changed code and its reachable data flows.
Return findings ordered by severity with file, line, exploit scenario,
evidence, and a minimal remediation. Do not edit files.

Delegation prompt

Use the security-reviewer subagent to inspect the current diff while you run
the targeted tests. Reconcile its findings with test evidence before reporting.

10. Automate guardrails with Hooks

Hooks run around Claude Code events. Typical uses include formatting after edits, blocking dangerous commands, validating files, recording audit events, or notifying a user when a task completes. Test hook commands independently before relying on them.

Format edited JavaScript and TypeScript files

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

Hooks can enforce behavior more reliably than conversational instructions, but a faulty hook can interrupt every session. Keep matchers narrow and failure messages actionable.

11. Connect live systems with MCP and plugins

MCP connects Claude Code to external tools and data. Plugins bundle reusable components such as Skills, subagents, hooks, and MCP configuration. Prefer authenticated connectors for private systems and grant only the capabilities needed for the workflow.

Add and inspect an MCP server

claude mcp add --transport http project-docs https://mcp.example.com
claude mcp list

# Inside a session
/mcp

Install a plugin from a marketplace

/plugin marketplace add example-org/claude-plugins
/plugin install code-review@example-marketplace

Before installing, inspect the plugin’s source, requested tools, hook commands, and MCP destinations. A plugin executes with the permissions available to Claude Code.

12. Manage sessions and parallel work

Continue, resume, name, and branch

claude --continue
claude --resume
claude --resume auth-refactor

# Inside a session
/rename auth-refactor
/branch try-streaming-approach

Use session names when several tasks run in parallel. Branch a conversation to explore another approach without losing the original. Do not resume the same session in two terminals unless interleaved transcript writes are intentional.

Isolated worktree session

claude --worktree dependency-upgrade

# Ask one session to update dependencies while another reviews UI changes.
# Integrate and run end-to-end tests from the primary checkout.

13. Script Claude Code and use it in CI

One-shot command

claude -p "Review the current diff for correctness and security. Do not edit files."

Structured output

claude -p \
  --output-format json \
  "Run the targeted tests and return a concise failure summary." \
  > claude-result.json

Process piped input

git diff main --name-only | claude -p \
  "Identify the changed files that need security review and explain why."

GitHub Actions setup

# Run inside a repository session
/install-github-app

In unattended automation, define allowed tools, maximum cost or turns, output format, and failure behavior. Never give a CI job broader repository or secret access than the task requires.

14. Browser, desktop, web, and remote workflows

Browser test prompt

Open the local application in Chrome, reproduce the failed checkout, inspect
the visible UI and console, then verify the fix at desktop and mobile widths.
Do not submit real payments or modify production data.

Claude Code can also work through VS Code, JetBrains, Desktop, web, mobile, and Remote Control. Cloud tasks use isolated infrastructure and a connected repository; local sessions can see local files and tools. Choose based on data location and required access.

15. Troubleshooting checklist

  1. Run claude doctor for installation and settings diagnostics.
  2. Use claude auth status --text to separate login problems from project problems.
  3. Run /context to confirm the expected CLAUDE.md, rules, Skills, and context are loaded.
  4. Run /permissions, /hooks, or /mcp to inspect the relevant subsystem.
  5. Check project and local settings for invalid JSON or conflicting layers.
  6. Reproduce with plugins and MCP servers disabled when diagnosing startup or tool failures.
  7. Use a fresh focused session if compaction or accumulated context is obscuring the task.
  8. Capture the exact command, error, version, operating system, and smallest reproduction before changing global configuration.

Diagnostic prompt

Diagnose only; do not change files or settings. Reproduce the issue, capture the
exact failing step, inspect the active configuration and nearest logs, and rank
possible causes by evidence. Clearly label confirmed facts and hypotheses.

16. Official source map


Editorial update: 11 August 2026. Check the linked official pages again before relying on version-sensitive commands, plan availability, model behavior, or policy.