Skip to content
Published at:

生态与社区

Claude Code 的强大不仅来自工具本身,更来自它蓬勃的社区生态。本章介绍被广泛使用的命令、Skill、插件和配置规范。

常用 Slash Commands

Slash Commands 是在对话中直接输入的内置命令,以 / 开头:

会话管理

命令说明
/clear清空当前对话,开始新话题
/compact压缩对话历史,释放上下文空间
/config打开 Claude Code 配置界面
/context显示当前上下文使用情况

模式切换

命令说明
/plan进入计划模式(先设计再实现)
/fast切换 Fast Mode(Opus 加速输出)
/thinking切换深度思考模式

Git 相关

命令说明
/commit分析变更并创建提交
/commit-push-pr提交、推送、创建 PR 一键完成
/clean_gone清理远程已删除的本地分支

任务管理

命令说明
/init为新项目生成 CLAUDE.md
/review对当前分支进行代码审查
/security-review安全审查当前变更
/todo查看当前任务进度

自动化

命令说明
/loop以固定间隔重复执行命令(如每 5 分钟检查 CI 状态)
/schedule在指定时间触发任务
/tasks查看后台运行的任务

社区热门 Skills / Plugins

以下是社区中广泛使用且好评度高的 Skills:

开发流程类

Skill用途社区评价
superpowers:brainstorming创意阶段的需求分析和方案设计减少 80% 的返工
superpowers:writing-plans将设计转化为可执行的实现计划团队协作必备
superpowers:executing-plans按计划分步实现,每步设审查点保持代码质量
superpowers:test-driven-developmentTDD 工作流:先写测试再写实现适合后端和工具库
superpowers:systematic-debugging系统化 Bug 排查方法论比盲目调试高效得多

代码质量类

Skill用途
code-review:code-review全面的代码审查
security-review安全漏洞扫描
code-simplifier简化和优化代码
simplify审查变更代码的可复用性

项目管理类

Skill用途
commit-commands:commit智能提交
commit-commands:commit-push-pr一键推送到 PR
superpowers:finishing-a-development-branch完成的开发分支如何集成

配置与自动化

Skill用途
init为新项目生成 CLAUDE.md
claude-md-management审查和改进 CLAUDE.md
claude-code-setup推荐项目应该使用的 Claude Code 功能
update-config管理 settings.json 配置
fewer-permission-prompts智能分析并减少不必要的权限弹窗

CLAUDE.md 编写规范

CLAUDE.md 是 Claude Code 最重要的项目配置文件。一个优秀的 CLAUDE.md 能显著提升 Claude 对项目的理解。

基本结构

markdown
# CLAUDE.md

## Commands
# 常用的构建、测试、开发命令
```bash
pnpm dev          # 启动开发服务器
pnpm build        # 生产构建
pnpm test         # 运行测试
pnpm lint         # 代码检查

Architecture

项目的高层架构描述

  • src/ — 前端源码(React + TypeScript)
  • server/ — 后端 API(Express + Prisma)
  • 数据流:Client → API → Service → Database

Code Style

编码规范和约定

  • 使用 TypeScript 严格模式
  • 组件文件使用 PascalCase
  • 工具函数文件使用 camelCase
  • 所有 API 返回值使用统一的 { data, error } 格式

Conventions

项目特有的约定

  • 测试使用 vitest,不要用 jest
  • Git commit 使用 conventional commits 格式
  • 新功能需要 feature flag,使用 useFeatureFlag hook

### 编写原则

1. **把 CLAUDE.md 当作新人入职文档来写**:你希望新同事第一天知道什么,就写什么
2. **宁短勿长**:只写关键的、反直觉的、易错的。300 行以内最佳
3. **保持更新**:项目架构变化时,同步更新 CLAUDE.md
4. **用 `/init` 生成初稿**:然后手动精炼
5. **放在项目根目录**:Claude Code 自动发现

### 社区推荐模板

```markdown
# CLAUDE.md

## Tech Stack
- Frontend: React 18 + TypeScript + Tailwind CSS
- Backend: Node.js + Express + Prisma + PostgreSQL
- Testing: Vitest + Testing Library

## Commands
```bash
pnpm dev          # Start dev server (localhost:3000)
pnpm build        # Production build
pnpm test         # Run tests
pnpm test:watch   # Watch mode
pnpm lint         # ESLint + Prettier
pnpm db:migrate   # Run Prisma migrations

Project Structure

src/
  components/  # Shared UI components
  features/    # Feature modules (each has its own hooks, types, tests)
  lib/         # Utilities and helpers
  pages/       # Route pages
server/
  routes/      # API route handlers
  services/    # Business logic
  db/          # Prisma schema and migrations

Rules

  • Always use TypeScript strict mode
  • API responses use { data, error } envelope
  • Feature flags are required for new features
  • Commit messages follow conventional commits
  • Never import from ../../ — use path aliases
  • Tests go next to the file they test, with .test.ts suffix

## 社区推荐配置

### 权限最小化配置

适合刚接触 Claude Code,希望逐步建立信任:

```json
// .claude/settings.json
{
  "permissions": {
    "allow": [
      "Bash(git:status)",
      "Bash(git:diff)",
      "Bash(git:log)",
      "Bash(npm:run)",
      "Bash(pnpm:run)",
      "Bash(ls:*)",
      "Bash(cat:*)"
    ],
    "deny": [
      "Bash(rm:*)",
      "Bash(sudo:*)",
      "Bash(curl:*)",
      "Bash(git:push*)"
    ]
  }
}

效率优先配置

适合有经验的用户,减少打断:

json
{
  "permissions": {
    "allow": [
      "Bash(git:*)",
      "Bash(npm:*)",
      "Bash(pnpm:*)",
      "Bash(node:*)",
      "Bash(ls:*)",
      "Bash(cat:*)",
      "WebFetch",
      "WebSearch"
    ],
    "deny": [
      "Bash(rm:-rf:*)",
      "Bash(sudo:*)",
      "Bash(git:push:--force:*)"
    ]
  },
  "enableAllProjectMcpServers": true
}