skills/project-agent-writer/SKILL.md
当用户想要创建、更新或设计项目级智能体(.agents/agents/*.md)时使用此技能。分析用户问题和项目上下文来设计工作方案。触发词:'create agent'、'build an agent'、'add agent'、'design agent'、'update agent'、'project agent'、'subagent'、'worker agent'、'automated worker',或当用户描述应由自治智能体处理的重复性任务时触发。
npx skillsauth add learnwy/skills project-agent-writerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
分析项目的结构、规范和自动化缺口,然后设计一个智能体来解决用户的问题。在生成任何文件之前,始终通过 AskUserQuestion 与用户确认。
核心原则:先理解问题,再分析项目,然后设计智能体,仅在用户确认后才生成。
共享原则: 本技能与
project-skill-writer/project-skill-installer/project-rules-writer共享 5 条 writer 通用纪律。详见 ../project-skill-writer/references/writer-discipline.md。
触发条件:
不触发条件:
project-skill-installerproject-skill-writerproject-rules-writer[L1: 理解问题]
↓
[L2: 项目分析]
↓
[L3: 智能体设计]
↓
[L4: 确认] ← AskUserQuestion(必须确认)
↓
[L5: 生成]
↓
[L6: 验证]
提取用户需求——不要问"你想让智能体做什么?"而是从他们的问题中推断:
| 问题模式 | 智能体类型 | 示例 | |----------|------------|------| | "评估/评分/比较输出" | 评分器 | 代码审查者、PR 质量检查器 | | "比较 A 和 B,选出更好的" | 比较器 | 技能版本对比、A/B 测试器 | | "分析/发现模式/报告洞察" | 分析器 | Bug 查找器、性能诊断 | | "转换/转化/标准化数据" | 转换器 | 格式转换器、Schema 映射器 | | "研究/收集/综合信息" | 研究者 | 文档查找、最佳实践 | | "检查/验证/执行规则" | 验证器 | Schema 检查器、合规验证器 |
从用户的问题中提取:
扫描项目以理解上下文。并行使用搜索工具:
| 信号 | 查找内容 | 工具 |
|------|----------|------|
| 语言 | 文件扩展名(.ts、.py、.swift、.go) | Glob |
| 框架 | package.json 依赖、Podfile、go.mod、Cargo.toml | Read |
| 现有智能体 | .agents/agents/、.trae/agents/、.claude/agents/、.cursor/agents/ | Glob |
| 现有技能 | .agents/skills/、.trae/skills/、.cursor/skills/ | Glob |
| 自动化脚本 | scripts/、tools/、Makefile 目标 | Glob |
| API 接口 | REST 端点、GraphQL schema、gRPC protos | Grep |
| 规范 | 命名模式、输出格式、目录结构 | LS |
项目: {name}
语言: {检测到的语言}
现有智能体: {列表或"无"}
现有技能: {列表或"无"}
自动化脚本: {列表或"无"}
集成点: {API、文件模式、工具}
规范: {命名、输出格式}
基于问题(L1)+ 分析(L2),设计智能体:
智能体: {name}
问题: {用户原话描述的问题}
角色: {一句话描述}
类型: {评分器|比较器|分析器|转换器|研究者|验证器}
触发条件: {智能体何时激活}
输入: {智能体需要什么数据}
流程: {高层步骤}
输出: {智能体产出什么 + 格式}
约束: {边界 + 不该做什么}
要创建的文件:
- {path/to/agent.md}
关键:在生成任何文件之前,通过 AskUserQuestion 展示设计方案。
使用 AskUserQuestion:
{
"questions": [{
"question": "I've designed this agent based on your project. Should I create it?",
"header": "Agent",
"multiSelect": false,
"options": [
{
"label": "Create {agent-name} (Recommended)",
"description": "{type} agent — {一句话角色}. Output: {path}"
},
{
"label": "Adjust design",
"description": "Let me refine the agent design before generating"
},
{
"label": "Skip",
"description": "Don't create an agent right now"
}
]
}]
}
规则:
{
"questions": [{
"question": "Your problem could be solved by different agent types. Which approach fits best?",
"header": "Agent type",
"multiSelect": false,
"options": [
{
"label": "Grader agent (Recommended)",
"description": "Evaluates outputs against expectations with pass/fail evidence"
},
{
"label": "Validator agent",
"description": "Checks correctness against rules and suggests fixes"
},
{
"label": "Skip",
"description": "Don't create an agent right now"
}
]
}]
}
用户确认后:
scripts/cli.cjs init 创建智能体脚手架node scripts/cli.cjs init \
--skill-dir <this-skill-dir> \
--name <agent-name> \
--role "<one-sentence-role>" \
--output-dir <project>/.agents/agents/
交付前验证:
已创建智能体:
名称: {agent-name}
类型: {评分器|比较器|分析器|...}
路径: {项目相对路径}
使用方式: 通过 Task 工具使用其定义的输入来启动此智能体。
| 问题 | 解决方案 |
|------|----------|
| 用户问题太模糊 | 从上下文推断最可能的智能体类型,在 L4 确认 |
| 多种有效的智能体类型 | 在 AskUserQuestion 中展示备选方案,让用户选择 |
| 不存在智能体目录 | 创建 .agents/agents/ |
| 用户请求创建技能/规则 | 路由到 project-skill-writer 或 project-rules-writer |
| 用户在 L4 说"调整设计" | 回到 L3,纳入反馈 |
| 输出路径是全局的 | 拒绝,强制使用项目相对路径 |
| 智能体与现有的冲突 | 展示对比,询问用户是替换还是重命名 |
此技能仅处理:
此技能不处理:
project-skill-writerproject-skill-installerproject-rules-writertools
Fallback skill when no project-specific one matches. Provides 10 battle-tested software-engineering methodology agents: problem-definer (Weinberg), story-mapper (Patton), spec-by-example (Adzic), domain-modeler (DDD/Evans), responsibility-modeler (CRC/Wirfs-Brock), architecture-advisor (Bass), tdd-coach (Beck), refactoring-guide (Fowler), legacy-surgeon (Feathers), test-strategist (Crispin). Use when user asks about DDD, TDD, refactoring, story mapping, test strategy, or software-architecture quality attributes.
development
Use when the user wants to build, implement, or develop a feature. Orchestrates evidence-driven Spec-Driven Development. Default lifecycle is `lite` (INIT → IMPLEMENTING → TESTING → DONE); auto-promote to `standard` or `full` when scope, risk, or AC traceability demands it. Triggers: 'develop feature', 'implement this', 'build feature', 'add module', 'fix bug', '开发功能', '实现这个'.
documentation
当用户需要创建、更新或设计项目级技能(.agents/skills/*/SKILL.md)时使用此技能。Analyzes the user's problem and project context to design reusable skill solutions. 触发词:'创建技能'、'编写技能'、'构建技能'、'添加技能'、'更新技能'、'项目技能'、'新建技能'、'设计技能', or when the user describes a repetitive workflow that should be captured as a reusable AI skill.
tools
Use this skill when the user wants to install, add, or configure a skill in a project. Analyze the project's tech stack and workflow, then recommend and install the best-matching skill. Triggers: 'install skill', 'add skill', 'configure skill', 'set up skill', 'enable skill', 'use skill in project', 'project skill', or when the user asks how to bring an existing skill capability into the current workspace.