Skip to main content

Claude Code

Setup

~/.bashrc:

export ANTHROPIC_AUTH_TOKEN="<YOUR_API_KEY>"
export ANTHROPIC_BASE_URL="https://open.bigmodel.cn/api/anthropic"
export ANTHROPIC_MODEL="glm-4.7"
export ANTHROPIC_SMALL_FAST_MODEL="glm-4.7"
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-4.7"
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm-4.7"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-4.7"
export API_TIMEOUT_MS="3000000"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1

~/.claude/settings.json:

{
"env": {
"ANTHROPIC_AUTH_TOKEN": "<YOUR_API_KEY>",
"ANTHROPIC_BASE_URL": "https://open.bigmodel.cn/api/anthropic",
"ANTHROPIC_MODEL": "glm-4.7",
"ANTHROPIC_SMALL_FAST_MODEL": "glm-4.7",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.7",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7",
"API_TIMEOUT_MS": "3000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
}
}

Switch

Quick configuration with All-in-One assistant tool Claude Code Switch.

Bootstrap

Opinionated project initialization for Claude Code.

Tools

Claude code has built-in tools, follow certain paradigm to use them.

Commands

.claude/commands/api/api-new.md:

Create a new POST $ARGUMENTS endpoint with:

- Auth middleware.
- Rate limiting middleware.
- Error handling wrapper.
- TypeScript interfaces for request and response.
/api-new /api/users

Memory

Captures everything Claude does during your coding sessions, compresses it with Claude agent-sdk, and injects relevant context back into future sessions.

Session

Resume from session:

# Most recent session
claude -c

# Specific session
claude -r
claude -r [session_id]

Skills

渐进式披露:

  • 核心功能简洁: 500 行以内.
  • 高级功能分离.
  • 按需加载: metadata -> instructions -> resources and code.
工具选择
  • 临时任务 -> prompts
  • 标准作业程序 -> skills
  • 连接外部系统 -> MCP
  • 复杂独立任务 -> sub-agents

Skills Description

核心原则: 既要说明做什么,也要说明什么时候用:

description: Extract text and tables from PDF files, fill forms, merge documents.
Use when working with PDF files or when the user mentions PDFs,
forms, or document extraction.

Skills Effective Checklist

  1. Core quality:
    • Description is specific and includes key terms
    • Description includes both what the Skill does and when to use it
    • SKILL.md body is under 500 lines
    • Additional details are in separate files (if needed)
    • No time-sensitive information (or in "old patterns" section)
    • Consistent terminology throughout
    • Examples are concrete, not abstract
    • File references are one level deep
    • Progressive disclosure used appropriately
    • Workflows have clear steps
  2. Code and scripts:
    • Scripts solve problems rather than punt to Claude
    • Error handling is explicit and helpful
    • No "voodoo constants" (all values justified)
    • Required packages listed in instructions and verified as available
    • Scripts have clear documentation
    • No Windows-style paths (all forward slashes)
    • Validation/verification steps for critical operations
    • Feedback loops included for quality-critical tasks
  3. Testing:
    • At least three evaluations created
    • Tested with Haiku, Sonnet, and Opus
    • Tested with real usage scenarios
    • Team feedback incorporated (if applicable)

Skills Security Checklist

  1. Code Review:
    • 所有脚本已审查
    • 无硬编码密钥或密码
    • 无危险的系统命令(rm -rf, eval, exec)
    • 文件路径经过验证(防止路径遍历)
  2. Network Access:
    • 检查所有外部 URL
    • 验证 API 端点可信
    • 处理网络失败情况
  3. Data Handling:
    • 无敏感数据泄露
    • 日志不包含 PII
    • 临时文件正确清理
  4. Permissions:
    • 最小权限原则
    • 不请求不必要的文件访问
    • 明确说明需要的权限
  5. Documentation:
    • 安全注意事项已文档化
    • 数据处理流程透明
    • 用户知情同意
grep -r "requests\." .
grep -r "os.system" .
grep -r "subprocess" .
grep -r "eval" .
  • Superpowers: Complete software development workflow.
  • DevBrowser: Browser automation.
  • NotebookLM: Communicate directly with Google NotebookLM notebooks.
  • Scientific: Comprehensive collection of ready-to-use scientific skills.

Skills List

  • Anthropic: Anthropic repository for agent skills.
  • Awesome: Curated list of Claude Code skills.
  • Marketplace: Agent skills marketplace.
  • Seekers: Convert documentation websites, GitHub repositories, and PDFs into Claude AI skills with automatic conflict detection.

Skills Guide

Plugins

Install plugins from marketplace, it will extend Claude Code through the plugin system with:

  • Custom commands.
  • Agents.
  • Hooks.
  • Skills.
  • MCP servers.
  • Agents: Comprehensive production-ready system combining agents, multi-agent workflow orchestrators, skills, and slash commands.
  • Continuous: Context management.
  • Figma: Figma official skills and MCP server.
  • Notion: Notion official skills, commands and MCP server.
  • SafetyNet: Catching destructive git and filesystem commands before they execute.
  • Edmuds: Personal configuration for productive web development.
  • LifeAssistant: Personal coach that remembers, notices patterns, and holds accountable.
/plugin marketplace add anthropics/claude-plugins-official
/plugin marketplace add obra/superpowers-marketplace
/plugin marketplace add sabertazimi/claude-code
/plugin install frontend-design
/plugin install superpowers@superpowers-marketplace
/plugin install sabertaz-claude-code

Plugins List

  • Anthropic: Anthropic-managed directory of high quality Claude Code plugins.
  • Plugins: Lightweight registry to discover and manage Claude plugins and agent skills.

Best Practices

Claude code best practices:

  • Extended thinking mode: "think" -> "think hard" -> "think harder" -> "ultrathink".
  • Plan mode: 对于复杂的任务, 使用 plan mode 先进行规划, 会比直接执行更高效.
  • Avoid /compact: dump plan and progress + /clear the state + restart from dump file.
  • Use Claude Code GitHub Actions.