agent-development by jezweb/claude-skills
npx skills add https://github.com/jezweb/claude-skills --skill agent-development构建高效的自定义 Claude Code 智能体,实现适当的任务委派、工具访问和提示设计。
描述字段决定了 Claude 是否会自动委派任务。
---
name: agent-name
description: |
[角色] 专家。当遇到 [特定触发条件] 时,必须使用此智能体。
主动用于 [任务类别]。
关键词:[触发词]
tools: Read, Write, Edit, Glob, Grep, Bash
model: sonnet
---
| 弱描述(不会自动委派) | 强描述(自动委派) |
|---|---|
| “分析截图以发现问题” | “视觉质量保证专家。分析截图时必须使用此智能体。主动用于视觉质量保证任务。” |
| “运行 Playwright 脚本” | “Playwright 专家。运行 Playwright 脚本时必须使用此智能体。主动用于浏览器自动化任务。” |
关键短语 :
Task tool subagent_type: "agent-name" - 始终有效广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
创建或修改智能体后需要重启会话。
如果智能体不需要 Bash,就不要赋予它 Bash 权限。
| 智能体需要... | 应赋予的工具 | 不应赋予的工具 |
|---|---|---|
| 仅创建文件 | Read, Write, Edit, Glob, Grep | Bash |
| 运行脚本/CLI | Read, Write, Edit, Glob, Grep, Bash | — |
| 仅读取/审计 | Read, Glob, Grep | Write, Edit, Bash |
为什么? 模型默认使用 cat > file << 'EOF' 这样的 heredoc 语法,而不是 Write 工具。每条 bash 命令都需要批准,导致每次智能体运行都会产生数十条提示。
与其限制 Bash,不如在 .claude/settings.json 中设置允许的安全命令:
{
"permissions": {
"allow": [
"Write", "Edit", "WebFetch(domain:*)",
"Bash(cd *)", "Bash(cp *)", "Bash(mkdir *)", "Bash(ls *)",
"Bash(cat *)", "Bash(head *)", "Bash(tail *)", "Bash(grep *)",
"Bash(diff *)", "Bash(mv *)", "Bash(touch *)", "Bash(file *)"
]
}
}
不要为了绕过问题而降低质量,应该修复根本原因。
| 模型 | 适用场景 |
|---|---|
| Opus | 创意工作(页面构建、设计、内容创作)- 质量至关重要 |
| Sonnet | 大多数智能体 - 内容、代码、研究(默认选择) |
| Haiku | 仅用于质量无关紧要的脚本运行器 |
添加到 ~/.bashrc 或 ~/.zshrc:
export NODE_OPTIONS="--max-old-space-size=16384"
将 Node.js 堆内存从 4GB 增加到 16GB。
| 智能体类型 | 最大并行数 | 备注 |
|---|---|---|
| 任何智能体 | 2-3 | 上下文会累积;分批处理然后暂停 |
| 重型创意(Opus) | 1-2 | 使用更多内存 |
source ~/.bashrc 或重启终端NODE_OPTIONS="--max-old-space-size=16384" claude始终优先使用 Task 子智能体,而不是远程 API 调用。
| 方面 | 远程 API 调用 | Task 子智能体 |
|---|---|---|
| 工具访问 | 无 | 完全(Read, Grep, Write, Bash) |
| 文件读取 | 必须在提示中传递所有内容 | 可以迭代读取文件 |
| 交叉引用 | 单个上下文窗口 | 可以跨文档推理 |
| 决策质量 | 通用建议 | 带有理由的特定决策 |
| 输出质量 | 通常约 100 行 | 600+ 行,包含具体细节 |
// ❌ 错误 - 远程 API 调用
const response = await fetch('https://api.anthropic.com/v1/messages', {...})
// ✅ 正确 - 使用 Task 工具
// 调用 Task,指定 subagent_type: "general-purpose"
描述要完成什么,而不是如何使用工具。
### 检查占位符
```bash
grep -r "PLACEHOLDER:" build/*.html
### 正确(声明式)
```markdown
### 检查占位符
搜索 build/ 目录下的所有 HTML 文件,查找:
- PLACEHOLDER: 注释
- TODO 或 TBD 标记
- 模板括号,如 [Client Name]
任何匹配项都表示内容不完整。
| 应包含 | 可跳过 |
|---|---|
| 任务目标和上下文 | 显式的 bash/工具命令 |
| 输入文件路径 | “使用 X 工具来...” |
| 输出文件路径和格式 | 逐步的工具调用步骤 |
| 成功/失败标准 | Shell 管道语法 |
| 阻塞性检查(先决条件) | 微观管理工作流 |
| 质量检查清单 |
“那些无法获取你上下文的智能体必须能够独立复现其行为。”
每一项改进都必须编码到智能体的提示中,而不是作为隐性知识保留。
| 发现项 | 应记录的位置 |
|---|---|
| 错误修复模式 | 智能体的“修正”或“常见问题”部分 |
| 质量要求 | 智能体的“质量检查清单”部分 |
| 文件路径约定 | 智能体的“输出”部分 |
| 工具使用模式 | 智能体的“流程”部分 |
| 阻塞性先决条件 | 智能体的“阻塞性检查”部分 |
在完成任何智能体改进之前:
| 反面模式 | 失败原因 |
|---|---|
| “正如我们之前讨论的...” | 不存在先前的上下文 |
| 依赖开发期间读取的文件 | 智能体可能不会读取相同的文件 |
| 假设从错误中获得的知识 | 智能体看不到你的调试过程 |
| “就像主页那样” | 智能体没有构建过主页 |
根据任务类型匹配规范级别。过度指定灵活的智能体会使其变得脆弱。
| 任务类型 | 规范级别 | 示例 |
|---|---|---|
| 机械性/重复性 | 高(刚性步骤) | 版本检查器、文件复制器 |
| 基于判断的 | 低(指导原则) | 文档审计员、代码审查员 |
| 创意性 | 最小(仅目标) | 内容撰写者、头脑风暴者 |
应该:
不应该:
过度指定(不好):
## 阶段 1:发现
对所有 .md 文件执行 Glob...
## 阶段 6:生成报告
| 类别 | 权重 | 分数 | 加权分数 |
|----------|--------|-------|----------|
| 链接 | 20% | X/100 | X |
大小合适(好):
## 检查内容
- TODO、损坏的链接、过时的版本
## 输出格式
按严重程度列出问题。包含文件:行号和修复建议。
## 范围控制
如果文件数 >30,询问用户应关注哪些文件。
有效的智能体提示包含:
## 你的角色
[智能体做什么]
## 阻塞性检查
[必须存在的先决条件]
## 输入
[要读取哪些文件]
## 流程
[包含编码学习成果的步骤]
## 输出
[确切的文件路径和格式]
## 质量检查清单
[验证步骤,包括已发现的陷阱]
## 常见问题
[开发过程中发现的模式]
当向编号流水线中插入新智能体时(例如,HTML-01 → HTML-05 → HTML-11):
| 必须更新 | 更新内容 |
|---|---|
| 新智能体 | “工作流位置”图 + “下一步”字段 |
| 前驱智能体 | 其“下一步”字段,指向新智能体 |
常见错误 :新智能体被“孤立”,因为前驱智能体仍然指向旧的后续智能体。
验证方法 :
grep -n "Next:.*→\|Then.*runs next" .claude/agents/*.md
最佳用例 :重复但需要判断的任务。
示例:手动审计 70 个技能 = 繁琐。但每次审计都需要智能(检查文档、比较版本、决定修复内容)。非常适合具有清晰指令的并行智能体。
不适用于 :
对于每个 [项目]:
1. 读取 [源文件]
2. 通过 [外部检查 - npm view, API 调用等] 验证
3. 检查 [权威来源]
4. 评分/评估
5. 修复发现的问题 ← 关键指令
关键要素 :
1. 我:启动 2-3 个并行智能体,使用相同的提示,不同的项目列表
2. 智能体:并行工作(读取 → 验证 → 检查 → 编辑 → 报告)
3. 智能体:返回结构化报告(分数、状态、应用的修复、修改的文件)
4. 我:审查更改(git status,抽查 diffs)
5. 我:分批提交,附带有意义的变更日志
6. 我:推送并更新进度跟踪
为什么智能体不提交 :允许人工审查、分批处理和清晰的提交历史。
适合 :
不适合 :
---
name: my-agent
description: |
[角色] 专家。当遇到 [触发条件] 时,必须使用此智能体。
主动用于 [任务类别]。
关键词:[触发词]
tools: Read, Write, Edit, Glob, Grep, Bash
model: sonnet
---
.claude/settings.json 中使用允许列表export NODE_OPTIONS="--max-old-space-size=16384"
source ~/.bashrc && claude
每周安装量
356
代码仓库
GitHub 星标数
652
首次出现
2026年1月20日
安全审计
安装于
claude-code285
gemini-cli239
opencode239
cursor220
antigravity213
codex203
Build effective custom agents for Claude Code with proper delegation, tool access, and prompt design.
The description field determines whether Claude will automatically delegate tasks.
---
name: agent-name
description: |
[Role] specialist. MUST BE USED when [specific triggers].
Use PROACTIVELY for [task category].
Keywords: [trigger words]
tools: Read, Write, Edit, Glob, Grep, Bash
model: sonnet
---
| Weak (won't auto-delegate) | Strong (auto-delegates) |
|---|---|
| "Analyzes screenshots for issues" | "Visual QA specialist. MUST BE USED when analyzing screenshots. Use PROACTIVELY for visual QA." |
| "Runs Playwright scripts" | "Playwright specialist. MUST BE USED when running Playwright scripts. Use PROACTIVELY for browser automation." |
Key phrases :
Task tool subagent_type: "agent-name" - always worksSession restart required after creating/modifying agents.
If an agent doesn't need Bash, don't give it Bash.
| Agent needs to... | Give tools | Don't give |
|---|---|---|
| Create files only | Read, Write, Edit, Glob, Grep | Bash |
| Run scripts/CLIs | Read, Write, Edit, Glob, Grep, Bash | — |
| Read/audit only | Read, Glob, Grep | Write, Edit, Bash |
Why? Models default to cat > file << 'EOF' heredocs instead of Write tool. Each bash command requires approval, causing dozens of prompts per agent run.
Instead of restricting Bash, allowlist safe commands in .claude/settings.json:
{
"permissions": {
"allow": [
"Write", "Edit", "WebFetch(domain:*)",
"Bash(cd *)", "Bash(cp *)", "Bash(mkdir *)", "Bash(ls *)",
"Bash(cat *)", "Bash(head *)", "Bash(tail *)", "Bash(grep *)",
"Bash(diff *)", "Bash(mv *)", "Bash(touch *)", "Bash(file *)"
]
}
}
Don't downgrade quality to work around issues - fix root causes instead.
| Model | Use For |
|---|---|
| Opus | Creative work (page building, design, content) - quality matters |
| Sonnet | Most agents - content, code, research (default) |
| Haiku | Only script runners where quality doesn't matter |
Add to ~/.bashrc or ~/.zshrc:
export NODE_OPTIONS="--max-old-space-size=16384"
Increases Node.js heap from 4GB to 16GB.
| Agent Type | Max Parallel | Notes |
|---|---|---|
| Any agents | 2-3 | Context accumulates; batch then pause |
| Heavy creative (Opus) | 1-2 | Uses more memory |
source ~/.bashrc or restart terminalNODE_OPTIONS="--max-old-space-size=16384" claudeAlways prefer Task sub-agents over remote API calls.
| Aspect | Remote API Call | Task Sub-Agent |
|---|---|---|
| Tool access | None | Full (Read, Grep, Write, Bash) |
| File reading | Must pass all content in prompt | Can read files iteratively |
| Cross-referencing | Single context window | Can reason across documents |
| Decision quality | Generic suggestions | Specific decisions with rationale |
| Output quality | ~100 lines typical | 600+ lines with specifics |
// ❌ WRONG - Remote API call
const response = await fetch('https://api.anthropic.com/v1/messages', {...})
// ✅ CORRECT - Use Task tool
// Invoke Task with subagent_type: "general-purpose"
Describe what to accomplish, not how to use tools.
### Check for placeholders
```bash
grep -r "PLACEHOLDER:" build/*.html
### Right (Declarative)
```markdown
### Check for placeholders
Search all HTML files in build/ for:
- PLACEHOLDER: comments
- TODO or TBD markers
- Template brackets like [Client Name]
Any match = incomplete content.
| Include | Skip |
|---|---|
| Task goal and context | Explicit bash/tool commands |
| Input file paths | "Use X tool to..." |
| Output file paths and format | Step-by-step tool invocations |
| Success/failure criteria | Shell pipeline syntax |
| Blocking checks (prerequisites) | Micromanaged workflows |
| Quality checklists |
"Agents that won't have your context must be able to reproduce the behaviour independently."
Every improvement must be encoded into the agent's prompt, not left as implicit knowledge.
| Discovery | Where to Capture |
|---|---|
| Bug fix pattern | Agent's "Corrections" or "Common Issues" section |
| Quality requirement | Agent's "Quality Checklist" section |
| File path convention | Agent's "Output" section |
| Tool usage pattern | Agent's "Process" section |
| Blocking prerequisite | Agent's "Blocking Check" section |
Before completing any agent improvement:
| Anti-Pattern | Why It Fails |
|---|---|
| "As we discussed earlier..." | No prior context exists |
| Relying on files read during dev | Agent may not read same files |
| Assuming knowledge from errors | Agent won't see your debugging |
| "Just like the home page" | Agent hasn't built home page |
Match specification level to task type. Over-specifying flexible agents makes them brittle.
| Task Type | Specification Level | Example |
|---|---|---|
| Mechanical/repetitive | High (rigid steps) | Version checker, file copier |
| Judgment-based | Low (guidelines) | Docs auditor, code reviewer |
| Creative | Minimal (goals only) | Content writer, brainstormer |
DO:
DON'T:
Over-specified (bad):
## Phase 1: Discovery
Execute Glob for all .md files...
## Phase 6: Generate Report
| Category | Weight | Score | Weighted |
|----------|--------|-------|----------|
| Links | 20% | X/100 | X |
Right-sized (good):
## What to Check
- TODOs, broken links, stale versions
## Output Format
List issues by severity. Include file:line and fix.
## Scope Control
If >30 files, ask user which to focus on.
Effective agent prompts include:
## Your Role
[What the agent does]
## Blocking Check
[Prerequisites that must exist]
## Input
[What files to read]
## Process
[Step-by-step with encoded learnings]
## Output
[Exact file paths and formats]
## Quality Checklist
[Verification steps including learned gotchas]
## Common Issues
[Patterns discovered during development]
When inserting a new agent into a numbered pipeline (e.g., HTML-01 → HTML-05 → HTML-11):
| Must Update | What |
|---|---|
| New agent | "Workflow Position" diagram + "Next" field |
| Predecessor agent | Its "Next" field to point to new agent |
Common bug : New agent is "orphaned" because predecessor still points to old next agent.
Verification :
grep -n "Next:.*→\|Then.*runs next" .claude/agents/*.md
Best use case : Tasks that are repetitive but require judgment.
Example: Auditing 70 skills manually = tedious. But each audit needs intelligence (check docs, compare versions, decide what to fix). Perfect for parallel agents with clear instructions.
Not good for :
For each [item]:
1. Read [source file]
2. Verify with [external check - npm view, API call, etc.]
3. Check [authoritative source]
4. Score/evaluate
5. FIX issues found ← Critical instruction
Key elements :
1. ME: Launch 2-3 parallel agents with identical prompt, different item lists
2. AGENTS: Work in parallel (read → verify → check → edit → report)
3. AGENTS: Return structured reports (score, status, fixes applied, files modified)
4. ME: Review changes (git status, spot-check diffs)
5. ME: Commit in batches with meaningful changelog
6. ME: Push and update progress tracking
Why agents don't commit : Allows human review, batching, and clean commit history.
Good fit :
Bad fit :
---
name: my-agent
description: |
[Role] specialist. MUST BE USED when [triggers].
Use PROACTIVELY for [task category].
Keywords: [trigger words]
tools: Read, Write, Edit, Glob, Grep, Bash
model: sonnet
---
.claude/settings.jsonexport NODE_OPTIONS="--max-old-space-size=16384"
source ~/.bashrc && claude
Weekly Installs
356
Repository
GitHub Stars
652
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykWarn
Installed on
claude-code285
gemini-cli239
opencode239
cursor220
antigravity213
codex203
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
140,500 周安装
API文档生成器 - 自动生成REST/GraphQL/WebSocket API专业文档
289 周安装
Salesforce开发最佳实践:LWC、Apex触发器与异步处理模式详解
289 周安装
ChatGPT应用构建器 - 基于MCP服务器创建扩展LLM功能的对话式应用
290 周安装
HeyGen数字人视频API教程:创建AI虚拟人视频,控制形象、语音、脚本和场景
290 周安装
PyAutoGUI 自动化脚本:鼠标键盘控制、截图、图像识别、颜色操作全指南
290 周安装
TypeScript Monorepo 启动模板 | pnpm + tdown 构建工具链 | 现代化库开发架构
290 周安装