Agent写作
- 作者仓库星标 498
- 作者更新于 实时读取
- 作者仓库 mateclaw
- 领域
- 通用
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 92 / 100 · 已通过审计
- 作者 / 版本 / 许可
- @matevip · v1.0.0 · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: skill-authoring
description: Author SKILL.md skills: frontmatter, validator limits, structure. A skill is a SKILL.md file — Y…
category: 通用
runtime: 无特殊运行时
---
# skill-authoring 输出预览
## PART A: 任务判断
- 适用问题:通用任务拆解、检查和交付。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Overview / When to Use / Required Frontmatter”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于通用任务拆解、检查和交付,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Overview / When to Use / Required Frontmatter”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/skill-assets` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令。
先用一个小任务确认它会围绕“Overview / When to Use / Required Frontmatter”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: skill-authoring
description: Author SKILL.md skills: frontmatter, validator limits, structure. A skill is a SKILL.md file — Y…
category: 通用
source: matevip/mateclaw
---
# skill-authoring
## 什么时候使用
- 把通用方向的常用动作沉淀成 Agent 可调用的技能 适合处理通用任务拆解、检查、交付和复盘,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤;通常不需要额外…
- 面向通用任务拆解、检查和交付,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Overview / When to Use / Required Frontmatter」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "skill-authoring" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Overview / When to Use / Required Frontmatter
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件、执行终端命令 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Authoring MateClaw Skills
Overview
A skill is a SKILL.md file — YAML frontmatter plus a markdown body of reusable instructions. There are two places a SKILL.md can live, and they have different creation paths:
- Builtin (in-repo):
mateclaw-server/src/main/resources/skills/<name>/SKILL.md— committed, shipped inside the server JAR. On every startupBuiltinSkillSeedServicescansclasspath*:skills/*/SKILL.md, parses each frontmatter, and upserts a row intomate_skillkeyed byname. The SKILL.md is the single source of truth — no SQL seed entry is required. - Custom (runtime): created by an agent or user through the
skill_managetool. Stored as amate_skillrow withskill_type=customand exported to the workspace at~/.mateclaw/skills/<name>/. Not committed; lives per-installation.
This skill covers both. Note that skill_manage does NOT write into the in-repo skills/ tree — builtin skills are authored by writing the file directly and restarting.
When to Use
- You're adding a reusable workflow that should ship with MateClaw → builtin.
- You're editing an existing builtin skill under
mateclaw-server/src/main/resources/skills/. - An agent finished a complex task and wants to persist the approach → custom, via
skill_manage. - You're reviewing a SKILL.md for correct frontmatter and structure.
Don't use for: recording a one-off tip discovered while using a skill (that belongs in record_lesson / a per-skill LESSONS.md) or cross-skill memory notes (remember). This skill is about writing the skill document itself.
Required Frontmatter
The frontmatter is parsed by SkillFrontmatterParser: a regex (^---\s*\n(.*?)\n---\s*\n(.*)$) splits the fenced block, then SnakeYAML loads it as a mapping. Hard requirements:
- Starts with
---as the first bytes — no leading blank line, no BOM. - A closing
---line follows, then the body. The body must be non-empty. - The block between the fences parses as a YAML mapping.
nameis present — it is the upsert key.BuiltinSkillSeedServiceskips any SKILL.md with noname.descriptionis present — a single line.
If the frontmatter regex fails to match, the parser treats the whole file as body with an empty name, and a builtin skill is silently skipped at seed time. A loadable skill ALWAYS has well-formed frontmatter.
Size & Naming Limits
- Skill content: ≤ 100,000 chars (
MAX_CONTENT_CHARS, ~25k tokens) — enforced byskill_managefor custom skills. Builtin skills aren't hard-checked but should obey the same ceiling. - Name: must match
^[a-z0-9][a-z0-9._-]{0,63}$— lowercase letters and digits plus-_., starting with a letter or digit, ≤ 64 chars.skill_managelowercases the name before validating. - Description: keep it to one line. Peer skills run 40-70 chars — a tight trigger phrase, not a paragraph.
- Peer skills in
resources/skills/sit at 6-15k chars. Aim for that range; past ~20k, split detail intoreferences/*.md.
Peer-Matched Frontmatter
Every shipped skill follows this shape:
---
name: my-skill-name
description: 'One line: what it does and when it fires.'
version: 1.0.0
tags:
- short
- descriptive
- tags
author: ported
---
Fields BuiltinSkillSeedService projects onto the mate_skill row:
| Field | Effect | Default if absent |
|---|---|---|
name |
upsert key, skill identity | — (required) |
description |
shown in skill lists | empty |
version |
mate_skill.version |
1.0.0 |
icon |
emoji, or a /skill-assets/... path |
🛠️ |
author |
attribution | MateClaw |
tags |
YAML list or CSV string | skill name |
nameZh / nameEn |
bilingual display names | none |
optional: true |
seeds the skill disabled — user opts in from the Skills page | false (enabled) |
dependencies.tools |
required tool ids → config_json.requiredTools |
none |
platforms |
e.g. [linux, macos, windows] |
none |
version / author / tags are not validator-enforced, but every peer carries them — omitting makes the skill look half-finished. Use optional: true for heavyweight skills (paid CLI dependencies, external OAuth, niche integrations) so they ship dark and the user activates them deliberately.
Skill Structure
Shipped skills follow roughly:
# <Title>
## Overview — one or two paragraphs: what and why.
## When to Use — bulleted triggers, plus a "Don't use for:" counter-trigger.
## <Topic sections> — quick-reference tables, exact commands, concrete recipes
(mvn test, paths under mateclaw-server/, etc.).
## Common Pitfalls — numbered mistakes paired with their fixes.
## Verification Checklist — checkbox list of post-action checks.
Not every section is mandatory, but Overview + When to Use + an actionable body + Common Pitfalls is the minimum for the skill to read like a peer.
Directory Placement
mateclaw-server/src/main/resources/skills/<skill-name>/SKILL.md
The skills/ tree is flat — no category subdirectories. The seed glob classpath*:skills/*/SKILL.md matches exactly one level deep, so a skill nested under a category directory would never be scanned. The directory name SHOULD equal the frontmatter name. Supporting files go in references/ and scripts/ subdirectories (see below).
Builtin Workflow (in-repo)
- Survey peers:
ls mateclaw-server/src/main/resources/skills/and read 2-3 SKILL.md files close to your topic — match tone and structure. - Create
skills/<name>/SKILL.mdwith the file tools. - Validate that the frontmatter parses — see the checklist below.
- Restart the server.
BuiltinSkillSeedServiceseeds the new row only at startup; a running server will not see it. The service also skips re-seeding when no SKILL.md's size/mtime changed, so rebuilding the JAR is what makes a change land. - Commit the new
skills/<name>/directory. No SQL seed change is needed — the SKILL.md is the source of truth and obsoletes per-skillINSERT INTO mate_skill.
Custom Workflow (skill_manage)
Agents and users create runtime skills with the skill_manage tool — actions create | edit | patch | delete:
create— a new skill from full SKILL.md content. Rejects a duplicate name.edit— a full-content rewrite of a custom skill.patch— find-and-replace one section (oldText→newText).delete— uninstall (logical delete plus workspace archive).
Notes:
- Every write is security-scanned (
SkillSecurityService) before saving — dangerous patterns are rejected with the reason. Builtin SKILL.md files are NOT scanned; they are trusted committed source. edit/patch/deleterefuse builtin skills ("cannot edit builtin skill"). To change a builtin skill, edit the resource file and restart.- A custom skill is live immediately — the tool re-runs the resolver pipeline — so no restart is needed.
Supporting Files
Beyond SKILL.md, a skill directory may carry:
references/*.md— long-form material the body links to. Use this to keep SKILL.md under ~20k chars.scripts/*— executable helpers a skill invokes.templates/,assets/— used by some bundled skills (HTML templates, images, etc.).
SkillFileAccessPolicy only resolves runtime paths under references/ and scripts/, and rejects .. traversal or absolute paths — keep runtime-read files in those two directories.
Common Pitfalls
- Leading whitespace before
---. The frontmatter regex anchors on^---; a blank line or BOM makes the whole file parse as body with an emptyname, and a builtin skill is silently skipped. - Expecting a running server to see a new builtin skill.
BuiltinSkillSeedServiceseeds only at startup. Restart — or, for a quick iteration, create a custom skill viaskill_manage, which is live immediately. - Trying to
skill_manage edita builtin skill. It is refused. Builtin skills are committed source — edit the file and restart. - Adding an
INSERT INTO mate_skillfor a new builtin skill. Unnecessary and discouraged — the SKILL.md is the source of truth and the seed service upserts byname. - Generic description. "Debug things" is weak. A peer description names the trigger — "4-phase root cause debugging: understand bugs before fixing." beats "Debug things."
- Naming an external project or internal RFC in the skill body. Describe the function objectively. Shipped content states what it does, not where the idea came from —
author: portedis the neutral attribution for an adapted skill. - Skill content over 100k chars.
skill_managerejects it outright; split detail intoreferences/. - Mismatched directory and
name. The upsert keys on the frontmattername, but a directory that disagrees confuses everyone reading the tree. Keep them equal.
Verification Checklist
- File at
mateclaw-server/src/main/resources/skills/<name>/SKILL.md(builtin); the directory name equals the frontmattername - Frontmatter starts at byte 0 with
---, closes with a---line, and the body is non-empty -
namematches^[a-z0-9][a-z0-9._-]{0,63}$;descriptionis a single line -
version,tags,authorpresent (peer-matched shape) - Total file ≤ 100,000 chars (aim 6-15k; split into
references/past ~20k) - Structure:
# Title→## Overview→## When to Use→ actionable body →## Common Pitfalls→## Verification Checklist - No external project names or RFC numbers in the body
- Builtin: server restarted so
BuiltinSkillSeedServiceseeds the row; the newskills/<name>/directory is committed - Custom: created via
skill_manage, security scan reported PASSED
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核