Agent Skills banner
liangdabiao liangdabiao

Agent Skills

Development community intermediate

Description

> 在 Claude Code 中创建、管理和共享 Skills 以扩展 Claude 的功能。 本指南展示了如何在 Claude Code 中创建、使用和管理 Agent Skills。Skills 是模块化功能,通过包含说明、脚本和资源的有组织的文件夹来扩展 Claude 的功能。

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

Repository README

This is the README for liangdabiao/Claude-Code-Deep-Research-main, shared by 6 entries in this directory. It describes the repository, not this entry specifically.

Agent Skills

在 Claude Code 中创建、管理和共享 Skills 以扩展 Claude 的功能。

本指南展示了如何在 Claude Code 中创建、使用和管理 Agent Skills。Skills 是模块化功能,通过包含说明、脚本和资源的有组织的文件夹来扩展 Claude 的功能。

前置条件

  • Claude Code 版本 1.0 或更高版本
  • Claude Code 的基本熟悉

什么是 Agent Skills?

Agent Skills 将专业知识打包成可发现的功能。每个 Skill 包含一个 `SKILL.md` 文件,其中包含 Claude 在相关时读取的说明,以及可选的支持文件,如脚本和模板。

**Skills 如何被调用**:Skills 是**模型调用的**——Claude 根据您的请求和 Skill 的描述自主决定何时使用它们。这与斜杠命令不同,斜杠命令是**用户调用的**(您显式输入 `/command` 来触发它们)。

**优势**:

  • 为您的特定工作流扩展 Claude 的功能
  • 通过 git 在您的团队中共享专业知识
  • 减少重复提示
  • 为复杂任务组合多个 Skills

在 [Agent Skills 概述](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/overview) 中了解更多信息。

有关 Agent Skills 的架构和实际应用的深入探讨,请阅读我们的工程博客:[使用 Agent Skills 为真实世界装备代理](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills)。

创建 Skill

Skills 存储为包含 `SKILL.md` 文件的目录。

个人 Skills

个人 Skills 在您的所有项目中都可用。将它们存储在 `~/.claude/skills/` 中:

mkdir -p ~/.claude/skills/my-skill-name

**使用个人 Skills 的场景**:

  • 您的个人工作流和偏好
  • 您正在开发的实验性 Skills
  • 个人生产力工具

项目 Skills

项目 Skills 与您的团队共享。将它们存储在项目中的 `.claude/skills/` 中:

mkdir -p .claude/skills/my-skill-name

**使用项目 Skills 的场景**:

  • 团队工作流和约定
  • 项目特定的专业知识
  • 共享的实用程序和脚本

项目 Skills 被检入 git 并自动对团队成员可用。

插件 Skills

Skills 也可以来自 [Claude Code 插件](/zh-CN/plugins)。插件可能捆绑了在安装插件时自动可用的 Skills。这些 Skills 的工作方式与个人和项目 Skills 相同。

编写 SKILL.md

创建一个带有 YAML frontmatter 和 Markdown 内容的 `SKILL.md` 文件:

---
name: your-skill-name
description: Brief description of what this Skill does and when to use it
---

# Your Skill Name

## Instructions
Provide clear, step-by-step guidance for Claude.

## Examples
Show concrete examples of using this Skill.

**字段要求**:

  • name:必须仅使用小写字母、数字和连字符(最多 64 个字符)
  • description:Skill 的简要描述及其使用时机(最多 1024 个字符)

`description` 字段对于 Claude 发现何时使用您的 Skill 至关重要。它应该包括 Skill 的功能和 Claude 应该何时使用它。

有关完整的编写指导(包括验证规则),请参阅 [最佳实践指南](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/best-practices)。

添加支持文件

在 SKILL.md 旁边创建其他文件:

my-skill/
├── SKILL.md (required)
├── reference.md (optional documentation)
├── examples.md (optional examples)
├── scripts/
│   └── helper.py (optional utility)
└── templates/
    └── template.txt (optional template)

从 SKILL.md 引用这些文件:

For advanced usage, see [reference.md](reference.md).

Run the helper script:
```bash
python scripts/helper.py input.txt
```

Claude 仅在需要时读取这些文件,使用渐进式披露来有效管理上下文。

使用 allowed-tools 限制工具访问

使用 `allowed-tools` frontmatter 字段来限制当 Skill 处于活动状态时 Claude 可以使用哪些工具:

---
name: safe-file-reader
description: Read files without making changes. Use when you need read-only file access.
allowed-tools: Read, Grep, Glob
---

# Safe File Reader

This Skill provides read-only file access.

## Instructions
1. Use Read to view file contents
2. Use Grep to search within files
3. Use Glob to find files by pattern