Tabbit
活动资源博客模型
Tabbit LogoTabbit

Tabbit — 为你工作的 AI 浏览器

主题资源

  • AI Browser Resources
  • Agentic Browser Resources
  • Browser Downloads and Install Guides
  • Browser Comparisons
  • AI Browser Alternatives
  • Browser Productivity Resources

热门指南

  • AI Browser
  • Agentic Browser Download
  • Best AI Browser 2026: Top 9 Tested & Ranked
  • AI Browser Download
  • Free AI Browser
  • Best AI Browser 2026
  • AI Browser Comparison 2026
  • AI Browser for Windows
  • AI Browser for Mac
  • Chrome Alternative 2026

活动

  • 别装了,你在《牛来》里早有原型
  • Tabbit 妙招大赛
  • KPOP SBTI 饭圈人格测试
  • Tabbit 校园共创者计划
  • fifi 的论文文献妙招精选
  • 用户问卷

关于

  • Tabbit 博客
  • 媒体报道
提示词
社区Claude Opus 4.7

Claude Opus 4.7:Claude Code 进阶配置 - Skills、Hooks 与 Subagents

原始来源

Refactix Blog

作者Refactix AI

Tabbit 整理2026-08-20

查看原文

一句话结论

通过 Skills 可复用工作流、Hooks 自动化防护和 Subagents 并行处理,可以构建企业级的 Claude Code 开发环境,实现代码质量保障和高效协作。

适用场景

  • 适合的任务:

    • 需要标准化工作流程的团队

    • 复杂的代码审查和质量控制

    • 多任务并行开发

    • 需要外部工具集成的项目(数据库、API等)

  • 不适合的任务:

    • 简单的个人项目

    • 不需要自动化的临时任务

  • 适用的模型版本:Claude Opus 4.7

  • 适用的客户端、Agent 或 API:Claude Code CLI

  • 推荐的推理档位和参数:根据任务复杂度选择 high/xhigh

可直接使用的内容

1. 构建有效的 CLAUDE.md

# Project: billing-service

## Stack
- Node.js 20, TypeScript strict mode
- PostgreSQL via Prisma
- Fastify for HTTP, BullMQ for background jobs

## Conventions
- No `any` types. If the inference is wrong, fix the type at the source.
- All API handlers validate input with Zod schemas in `src/schemas/`
- Prisma queries go through `src/repos/`, never inline
- Tests use Vitest. Run `pnpm test -- <file>` for single-file runs

## Do not
- Run `prisma migrate dev`. Use `pnpm db:migrate` (has our pre-hooks).
- Commit anything that touches `src/billing/legacy/` without flagging it
- Install packages without checking the monorepo root package.json first

## Useful paths
- API routes: `src/routes/`
- Domain logic: `src/domain/<entity>/`
- DB migrations: `prisma/migrations/`

2. Skills:打包可复用工作流

目录结构:

.claude/skills/release-notes/
├── SKILL.md
└── references/
    └── template.md

SKILL.md 示例:

---
name: release-notes
description: Use when generating release notes from git commits between two tags. Groups by conventional commit type and filters out dependency bumps.
---

# Release Notes Generator

## Steps

1. Run `git log <from-tag>..<to-tag> --oneline` to list commits
2. Parse conventional commit prefixes: feat, fix, perf, refactor, docs, chore
3. Skip commits matching: `chore(deps)`, `chore: bump`, `Merge pull request`
4. Group into: Features, Fixes, Performance, Refactors, Other
5. Use the template in `references/template.md` for formatting
6. Output to stdout unless user specifies a file

使用方式:

claude /release-notes v1.2.0 v1.3.0

3. Hooks:自动化防护栏和副作用

配置文件:.claude/settings.json

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | xargs -I {} sh -c 'case {} in *.ts|*.tsx) pnpm prettier --write {} ;; esac'"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "jq -e 'select(.tool_input.command | test(\"prod|production\"; \"i\")) | error(\"production commands blocked, use staging\")' > /dev/null 2>&1"
          }
        ]
      }
    ]
  }
}

Hook 类型说明:

  • PostToolUse:工具执行后触发(如自动格式化代码)

  • PreToolUse:工具执行前触发(如阻止危险命令)

4. Subagents:并行工作和上下文隔离

专用 Subagent 示例:迁移审计器

---
name: migration-auditor
description: Reviews database migration files for concurrency issues, missing indexes, and backward-compatibility breaks. Use before merging any migration PR.
tools: Read, Grep, Glob, Bash
---

You review database migrations for safety. For each migration file, check:

1. Does it add a NOT NULL column without a default? That breaks concurrent writes.
2. Does it drop a column referenced elsewhere in the codebase? Grep for the column name.
3. Does it add an index on a large table without CONCURRENTLY? That holds a lock.
4. Does it rename a table or column? That breaks deployed code reading the old name.

Output a punch list of issues with file:line references. If clean, say so and stop.

使用场景:

  • 代码审查 subagent

  • 安全审计 subagent

  • 性能分析 subagent

  • 测试生成 subagent

5. MCP 服务器:连接外部工具

添加本地 PostgreSQL 服务器:

# Local scope, only this machine
claude mcp add --transport stdio postgres -- npx -y @modelcontextprotocol/server-postgres postgresql://localhost/dev

添加项目级 MCP 服务器(共享给团队):

# Project scope, committed to .mcp.json, shared with team
claude mcp add --scope project --transport stdio linear -- npx -y @linear/mcp-server

管理 MCP 服务器:

claude mcp list           # 列出所有注册的服务器
claude mcp get postgres   # 查看单个服务器详情
/mcp                      # 在会话中查看状态

测试/工作流步骤

  1. 配置 CLAUDE.md:

    • 创建项目根目录的 CLAUDE.md

    • 包含技术栈、约定、禁止事项、有用路径

  2. 创建 Skills:

    • 识别重复性工作流(如发布说明、代码审查)

    • 在 .claude/skills/<name>/ 创建 SKILL.md

    • 添加参考文件到 references/ 目录

  3. 配置 Hooks:

    • 在 .claude/settings.json 添加 PostToolUse 钩子(自动格式化)

    • 添加 PreToolUse 钩子(阻止危险命令)

    • 测试钩子是否按预期工作

  4. 创建 Subagents:

    • 识别需要专门知识的任务(迁移审计、安全审查)

    • 在 .claude/agents/<name>.md 创建 agent 定义

    • 指定需要的工具权限

  5. 集成 MCP 服务器:

    • 识别需要的外部工具(数据库、项目管理工具)

    • 使用 claude mcp add 添加服务器

    • 验证连接和数据访问

原始证据与数据

文章提供了完整的项目配置示例,包括:

  • 详细的 CLAUDE.md 模板(billing-service 项目)

  • Skills 目录结构和 SKILL.md 完整示例

  • Hooks 配置(JSON 格式,包含 PostToolUse 和 PreToolUse)

  • Subagent 定义示例(migration-auditor)

  • MCP 服务器配置命令和示例

文章强调这些是"patterns that hold up past the first week"(经过一周后仍然有效的模式),适合团队推广使用。

适用边界

  • Skills 适合可重复的工作流,不适合一次性任务

  • Hooks 需要理解 JSON 配置和命令语法,配置错误可能导致 Claude Code 无法正常工作

  • Subagents 需要明确定义工具权限,避免过度授权

  • MCP 服务器 需要网络连接和正确的 transport 配置

  • 这些配置需要在团队中共享和同步,建议使用 Git 管理

来源摘录或观察

文章提到:"The honest summary is that most people stop at CLAUDE.md and miss the leverage that comes from Skills, Hooks, and Subagents." 这表明进阶配置能显著提升生产力和代码质量。

文章还提供了团队推广建议:"Rolling it out to a team",强调了标准化配置的重要性。

Tabbit 小编提醒

提示词内容来自公开资料与 Tabbit 编辑整理。引用前请查看原文授权与适用范围。

Claude Opus 4.7

在 Tabbit 中使用

Claude Opus 4.7

相关提示词

媒体Anthropic Claude Platform Docs / Anthropic Newsroom2026-04-16

Claude Opus 4.7:努力档位与迁移提示模板

媒体Anthropic 官方文档

Claude Opus 4.7:Anthropic 官方提示词库与最佳模式

媒体ZooClaw AI Help2026-04-07

Claude Opus 4.7:三模式实战策略 - Caveman 提示词、CLAUDE.md 安全护栏与 Git Worktrees

媒体Tenten Learning

Claude Opus 4.7:50+ 社群精华技巧完全攻略

Claude Opus 4.7

相关测评

媒体Anthropic Newsroom2026-04-16

Claude Opus 4.7:官方编码、视觉与 Agent 基准

媒体Vellum2026-04-16

Claude Opus 4.7:Vellum 跨模型基准与任务选型

社区Reddit r/ClaudeCode

Claude Opus 4.7:Reddit ClaudeCode 发布后长会话体验