AgentSkillsCN

claude-code-guide

当用户就以下主题向您提问时,请使用此代理:“Claude…能否…”、“Claude…是否…”、“我该如何…”——(1)Claude Code(CLI 工具):功能特性、钩子、斜杠命令、MCP 服务器、设置、IDE 集成、键盘快捷键;(2)Claude Agent SDK:构建自定义代理;(3)Claude API(原 Anthropic API):API 使用、工具调用、Anthropic SDK 使用。**重要提示:** 在启动新代理之前,请先检查是否已有正在运行或刚刚完成的 claude-code-guide 代理,您可以使用“resume”参数继续沿用该代理。

SKILL.md
--- frontmatter
name: claude-code-guide
description: |
  Use this agent when the user asks questions ("Can Claude...", "Does Claude...", "How do I...") about: (1) Claude Code (the CLI tool) - features, hooks, slash commands, MCP servers, settings, IDE integrations, keyboard shortcuts; (2) Claude Agent SDK - building custom agents; (3) Claude API (formerly Anthropic API) - API usage, tool use, Anthropic SDK usage. **IMPORTANT:** Before spawning a new agent, check if there is already a running or recently completed claude-code-guide agent that you can resume using the "resume" parameter.
allowed-tools:
  - Glob
  - Grep
  - Read
  - WebFetch
  - WebSearch

Claude Code Guide

This skill provides comprehensive guidance for Claude Code - the agentic coding tool from Anthropic.

What is Claude Code?

Claude Code is an agentic coding assistant that operates directly in your terminal. Unlike chat-based AI tools, Claude Code:

  • Sees your codebase: Reads files, understands project structure, follows imports
  • Takes action: Edits files, runs commands, creates commits, manages git workflows
  • Verifies results: Runs tests, checks build output, validates changes
  • Learns context: Remembers project conventions via CLAUDE.md files

The Agentic Loop

Claude Code operates in a continuous gather → act → verify loop:

code
┌─────────────────────────────────────────────────────┐
│                   AGENTIC LOOP                       │
├─────────────────────────────────────────────────────┤
│  1. GATHER CONTEXT                                   │
│     • Read files, search code, explore structure     │
│     • Understand current state and requirements      │
│                                                      │
│  2. TAKE ACTION                                      │
│     • Edit files, run commands, create content       │
│     • May require permission for sensitive ops       │
│                                                      │
│  3. VERIFY RESULTS                                   │
│     • Check command output, run tests                │
│     • Validate changes meet requirements             │
│                                                      │
│  4. REPEAT or COMPLETE                               │
│     • Continue if more work needed                   │
│     • Report results when done                       │
└─────────────────────────────────────────────────────┘

Read more: references/core/agentic-loop.md

Key Features Quick Reference

FeatureDescriptionLearn More
ToolsFile ops, search, bash, web accessreferences/core/tools.md
Context Window~200K tokens, auto-compactionreferences/core/context-management.md
CLAUDE.mdProject-specific instructionsreferences/configuration/memory.md
SkillsReusable prompts & workflowsreferences/configuration/skills.md
HooksShell commands on eventsreferences/configuration/hooks.md
MCP ServersExternal tool integrationsreferences/configuration/mcp.md
SubagentsDelegated specialized tasksreferences/configuration/sub-agents.md
Plan ModeDesign before implementingreferences/workflows/common-workflows.md
Headless ModeNon-interactive automationreferences/workflows/advanced-workflows.md

Extension Points Comparison

Choose the right extension mechanism for your needs:

MechanismBest ForScopeComplexity
CLAUDE.mdProject conventions, coding standards, contextProjectLow
SkillsReusable prompts, workflows, templatesUser/ProjectLow-Medium
HooksAutomation, validation, logging, side effectsUser/ProjectMedium
MCP ServersExternal APIs, databases, custom toolsUser/ProjectMedium-High
SubagentsSpecialized tasks, parallel work, isolationUser/ProjectMedium

When to Use What

Use CLAUDE.md when:

  • Defining coding standards ("use tabs, not spaces")
  • Documenting project architecture
  • Specifying test commands
  • Setting up file organization rules

Use Skills when:

  • Creating reusable workflows (/commit, /review)
  • Building prompt templates with arguments
  • Packaging documentation for reference
  • Defining specialized behaviors

Use Hooks when:

  • Running commands before/after actions
  • Validating or blocking tool usage
  • Logging activity
  • Auto-formatting code on save

Use MCP Servers when:

  • Connecting to external APIs (GitHub, Jira, databases)
  • Adding custom tool capabilities
  • Integrating with existing services
  • Providing resources from external sources

Use Subagents when:

  • Delegating specialized investigations
  • Running parallel analysis tasks
  • Isolating context for focused work
  • Creating custom agent personas

Navigation Guide

Understanding How Claude Code Works

  • How does the agentic loop work?references/core/agentic-loop.md
  • What tools does Claude have?references/core/tools.md
  • How does context management work?references/core/context-management.md

Configuration & Setup

  • How do I set up CLAUDE.md?references/configuration/memory.md
  • How do I create skills?references/configuration/skills.md
  • How do I configure hooks?references/configuration/hooks.md
  • How do I add MCP servers?references/configuration/mcp.md
  • How do I create subagents?references/configuration/sub-agents.md

Workflows & Best Practices

  • Common tasks (exploration, debugging, PRs)references/workflows/common-workflows.md
  • Advanced patterns (parallel, CI/CD, headless)references/workflows/advanced-workflows.md
  • Best practices & tipsreferences/best-practices.md

CLI Reference

  • Commands, flags, and optionsreferences/cli-reference.md

Quick Tips

Effective Prompting

code
# Be specific about verification
"Add input validation to the signup form. Run the tests to verify."

# Provide context
"The auth system uses JWT tokens stored in httpOnly cookies.
Add a logout endpoint that clears the cookie."

# Request exploration first
"Explore how error handling works in this codebase, then
suggest improvements to the API error responses."

Keyboard Shortcuts

KeyAction
EnterSend message (configurable)
EscCancel current generation
Ctrl+CInterrupt / Exit
TabAccept autocomplete
Up/DownNavigate history

Essential Commands

CommandPurpose
/helpShow all commands
/compactReduce context usage
/clearStart fresh conversation
/rewindUndo to checkpoint
/statusShow current state
/configOpen settings
/reviewReview code changes
/pr-commentsAddress PR feedback

Common Questions

Q: How much context does Claude Code have? A: ~200K tokens. Use /compact if running low. See references/core/context-management.md.

Q: Can Claude Code run commands without asking? A: Depends on permission mode. Safe commands auto-approve; destructive ones ask. See references/core/agentic-loop.md.

Q: How do I share context across sessions? A: Use CLAUDE.md files for persistent context. See references/configuration/memory.md.

Q: Can I use Claude Code in CI/CD? A: Yes, with headless mode (claude -p). See references/workflows/advanced-workflows.md.

Q: How do I add custom tools? A: Via MCP servers. See references/configuration/mcp.md.

IDE Integration

Claude Code integrates with VS Code and JetBrains IDEs:

VS Code: Install "Claude Code" extension

  • Cmd+Esc (Mac) / Ctrl+Esc (Windows/Linux) to open
  • Automatic file sync with editor
  • Inline diff viewing

JetBrains: Install "Claude Code" plugin

  • Same keyboard shortcut
  • Project context awareness
  • Integrated terminal

Getting Help