跳到主内容
AIHO 2026 全新改版上线
ClaudeSkillsAgent实战

Claude Skills 实战:用 SKILL.md 让 Agent 学会部署 Nuxt 项目

AIHO 编辑部 · 2026-06-21

TL;DR

Skills 把 Agent 能力从「写代码注册 tool」降维到「写 Markdown 描述步骤」。我们写了 5 个生产级 Skill,总结出什么样的 SKILL.md 才能让 Claude 真正按你的预期执行

我们写了哪 5 个 Skill

Skill场景效果
deploy-to-vercel部署 Nuxt 项目到 Vercel从 15 分钟手动操作 → 30 秒一行指令
audit-deps审计 package.json 依赖安全每周自动跑,输出安全报告
gen-sitemap生成 sitemap.xml改路由后自动更新,不用手动跑脚本
db-migration数据库 schema 迁移生成迁移文件 + 回滚脚本
gen-api-docs从代码生成 API 文档提交 PR 时自动更新文档

SKILL.md 怎么写才有效

反面教材(无效)

---
name: deploy-to-vercel
description: Deploy to Vercel
---

Deploy the project to Vercel.

Claude 看到这个会问一堆问题:用什么命令?要不要 --prod?环境变量怎么配?

正面教材(有效)

---
name: deploy-to-vercel
description: Deploy a Nuxt/Vite/Next project to Vercel
---

## When to use

User says "部署" / "deploy" / "上线" or asks to deploy to Vercel.

## Prerequisites

1. Check `vercel.json` exists. If not, create one:
   ```json
   { "framework": "nuxt", "buildCommand": "pnpm run build" }
  1. Check VERCEL_TOKEN env var is set. If not, ask user to provide it.

Steps

  1. Run vercel build to verify build passes locally
  2. Run vercel --prod --yes to deploy
  3. Wait for deployment URL in output
  4. Return the deployment URL to user

Error handling

  • If build fails: show error, do NOT retry automatically
  • If VERCEL_TOKEN missing: ask user to set it, do NOT guess
  • If vercel CLI not installed: npm i -g vercel first

Do NOT

  • Do not deploy to preview without asking
  • Do not modify nuxt.config during deploy

**关键要素**:
1. **When to use** — 明确触发条件,避免 Claude 瞎调
2. **Prerequisites** — 前置检查,缺什么先补
3. **Steps** — 具体命令,不要含糊
4. **Error handling** — 出错了怎么办
5. **Do NOT** — 禁止事项,防止 Claude 自作主张

## 附带脚本和模板

Skill 目录可以放脚本和模板,Claude 会按需读取:

deploy-to-vercel/ SKILL.md scripts/ check-env.sh # 检查环境变量 templates/ vercel.json # 默认配置模板 nuxt.vercel.json # Nuxt 专用配置


SKILL.md 里引用:
```markdown
## Steps

1. Run `bash scripts/check-env.sh` to verify prerequisites
2. If `vercel.json` missing, copy from `templates/nuxt.vercel.json`
3. Run `vercel --prod --yes`

Skills vs .cursorrules vs MCP

维度Skills.cursorrulesMCP
本质能力描述(按需加载)全局 prompt(每次带)工具接入协议
格式Markdown + 脚本纯文本JSON + 代码
Context 占用低(按需加载)高(每次对话带)
适合固化团队流程项目规范接外部 API
支持Claude 系列Cursor / WindsurfClaude / Cursor

三者互补:.cursorrules 定项目规范,Skills 定操作流程,MCP 接外部工具。

效果数据

部署 Skill 上线两周后:

  • 部署操作时间:15 min → 30 sec(Claude Code 执行 Skill)
  • 部署错误率:2 次/周 → 0(Skill 里有前置检查)
  • 新人上手:不需要看部署文档,直接说"部署"就行

结论

Skills 的核心价值不是「教 AI 新知识」,而是**「固化团队最佳实践」**。写好一个 Skill = 新人不用看文档也能按规范操作。

建议从高频、易出错的流程开始写 Skill——部署、迁移、审计这类。