Skill

什么是skill

skill就是为AI安装的可重复工作流包,把一件经常做,并且有固定规则的事情整理成一套模板,必要时附上脚本和资源。即

Skill = 说明书(SKill.md) + 元数据(openai.yaml) + 可选的脚本/参考资料/资源文件

结构

skill-name/
|
|-- SKILL.md                # 必需:入口说明,告诉 ChatGPT 这个 skill 是做什么的、什么时候触发、怎么做
|
|-- agents/
|   `-- openai.yaml         # 必需:UI/元数据,比如显示名称、简介、图标等
|
|-- scripts/                # 可选:放可执行脚本,适合稳定、可重复的步骤
|   |-- analyze.py
|   `-- helper.sh
|
|-- references/             # 可选:放参考资料、规则、模板说明
|   |-- schema.md
|   `-- style-guide.md
|
`-- assets/                 # 可选:放输出会用到的资源文件
    |-- template.docx
    `-- logo.png

简单实现

实现一个git PR变更摘要

your-skill/
├── agents/
│   └── openai.yaml
└── SKILL.md
  • interface:
    这一段是在定义这个 skill 的“界面展示信息”。

  • display_name: "PR Change Summary"
    这是这个 skill 在界面上显示出来的名字。
    用户看到的通常就是这个名字,而不是目录名。

interface:
  display_name: "PR Change Summary"
  short_description: "Summarize git diffs into short developer-facing updates"

---上下包裹着的是元信息

  • name:skill的名字

  • description:触发描述

## Overview:说明 skill 的总目标

## Workflow:定义执行步骤

  • ### Read the diff structurally结构化阅读变化

  • ### Infer the real change推断改动类型

  • ### Produce a brief developer summary生成短的摘要

## Output rules:定义输出边界

## Heuristics:给出好坏范式

---
name: pr-change-summary
description: summarize git diff or patch content into a short developer-facing change summary. use when chatgpt or codex is given a git diff, patch, unified diff, or code change snippet and needs to quickly explain what changed, highlight impacted areas, and produce a concise summary for engineers.

---

# PR Change Summary

## Overview

Turn raw `git diff` or patch text into a short summary for developers. Focus on what changed, where it changed, and why it likely matters.

## Workflow

### 1. Read the diff structurally

Identify:

- files changed
- added, removed, or renamed files
- changed functions, classes, routes, queries, configs, or tests
- recurring patterns across files

Prefer the semantic change over line-by-line narration.

### 2. Infer the real change

Summarize the implementation intent in plain engineering language:

- bug fix
- refactor
- feature addition
- cleanup
- configuration change
- test-only update
- dependency or build change

Do not overclaim intent when the diff is ambiguous. Use wording like `likely`, `appears to`, or `seems to` when needed.

### 3. Produce a brief developer summary

Default output should be short and scan-friendly.

Use this structure unless the user asks for another format:

```markdown
Summary: <1-3 sentences>

Changed areas:
- <area 1>
- <area 2>
- <area 3>
```

## Output rules

- Write for developers, not for end users.
- Keep the whole summary brief.
- Mention concrete modules, files, or components when visible in the diff.
- Group related edits together instead of listing every file separately.
- Mention tests only if the diff clearly changes or adds tests.
- Avoid filler such as `This PR basically...` or `Overall...`.
- Do not invent motivation, risk, or product impact unless directly supported by the diff.

## Heuristics

### Prefer summaries like these

Good:

- `Adds validation for empty email input in the signup flow and updates the API handler to return a 400 response instead of silently accepting invalid data.`
- `Refactors cache invalidation into a shared helper and updates the user/profile paths to call the new helper.`
- `Updates test fixtures and snapshot expectations for the new serializer output.`

Bad:

- `Changes many files across the codebase.`
- `Improves the system.`
- `Adds some fixes and refactors.`

## Special cases

### Large diffs

For large patches:

- collapse low-signal edits
- emphasize the main theme of the change
- mention only the most important 2-5 changed areas

### Mixed diffs

If a diff mixes unrelated work, call that out briefly and summarize each cluster separately.

### Pure formatting changes

Say so directly, for example:

- `Mostly formatting and lint-driven cleanup; no clear behavioral change is visible in the diff.`

## Example

### Input pattern

A user provides raw `git diff` or patch text.

### Expected style

```markdown
Summary: Refactors authentication token parsing into a shared utility and updates the login and refresh handlers to use it. Also adds tests covering expired-token behavior.

Changed areas:
- auth utility extraction
- login and refresh handlers
- expired-token test coverage
```


整体结构

SKILL.md
|
|-- Frontmatter
|   |-- name
|   `-- description
|
|-- Title
|   `-- PR Change Summary
|
|-- Overview
|   `-- 说明任务目标
|
|-- Workflow
|   |-- 1. 结构化读 diff
|   |-- 2. 推断真实改动类型
|   `-- 3. 输出简短摘要
|
|-- Output rules
|   `-- 约束输出内容和边界
|
|-- Heuristics
|   `-- 给出好坏摘要示例
|
|-- Special cases
|   |-- large diffs
|   |-- mixed diffs
|   `-- formatting-only diffs
|
`-- Example
    `-- 给出目标输出样式

使用

在 ChatGPT web端安装skill

image-20260316232455540

上传skill压缩包

image-20260316232928649

进行skill测试,由于 web 端 gpt 不能使用 git 命令,所以这里失败了,可以尝试用 codex 测试该skill

image-20260316233443515

最后

更多skill开发尽在:https://developers.openai.com/codex/skills