跳到正文
cccskills
免费在 GitHub 公开

custom-agent

[AI & Tools] Use when creating, verifying, or enhancing Claude Code custom agent files.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md11.5 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Quick Summary

Goal: Create new custom agents, audit existing agent quality, or enhance agent definitions so each agent is valid, least-privilege, structurally complete, and ready for safe delegation.

Summary: Produce valid agents through the selected mode: Create — clarify → check existing → scaffold → write → validate; Audit — discover → read/parse → validate → report → fix confirmed Errors; Enhance — read → analyze → recommend → apply confirmed changes. Validate frontmatter, tools, structure, and quality score.

Workflow: Detect mode (Create/Audit/Enhance) from $ARGUMENTS → Execute → Validate

Key Rules:

  • Agent files: .claude/agents/{name}.md with YAML frontmatter + markdown body as system prompt
  • Agent does NOT inherit Claude Code system prompt — write complete instructions
  • Minimize tools to only what the agent needs
  • System prompt structure: ## Role → ## Workflow → ## Key Rules → ## Output
  • Analyze scope and use TaskCreate for small tasks/subtasks before starting, including final review. Keep task depth proportional to the work.

Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence percentages (Idea should be more than 80%).

Contents

Modes

ModeTriggerAction
Create$ARGUMENTS describes a new agentCreate agent file
Auditmentions verify, audit, review, check, qualityAudit existing agents
Enhancementions refactor, enhance, improve, optimizeImprove existing agent

Mode 1: Create Agent

  1. Clarify — ask user question tool: purpose, read-only vs read-write, model preference, memory needs
  2. Check Existing — Glob .claude/agents/*.md for similar agents. Avoid duplication.
  3. Scaffold — Create .claude/agents/{name}.md using frontmatter template below
  4. Write System Prompt — Structure: ## Role → ## Workflow → ## Key Rules → ## Output
  5. Validate — Run audit checklist below

Mode 2: Audit Agents

  1. Discover — Glob .claude/agents/*.md
  2. Read and parse — Read each complete frontmatter and body before checking or scoring it. A header preview is discovery only; follow multiline YAML through its closing delimiter.
  3. Validate — Apply the Audit Checklist and quality score; consult Agent Frontmatter Schema for field definitions and Tool Restriction Patterns for tool scope.
  4. Report — Issues grouped by severity (Error > Warning > Info), include quality scores
  5. Fix — If user confirms, fix Error-level issues automatically

Mode 3: Enhance Agent

  1. Read — Load specified agent file
  2. Analyze — Check against best practices and audit checklist
  3. Recommend — List improvements with rationale
  4. Apply — If user confirms, apply enhancements

Agent Frontmatter Schema

---
# REQUIRED
name: my-agent # Lowercase + hyphens only
description: >- # Claude uses this to decide when to delegate
    Use this agent when [specific trigger scenarios].

# OPTIONAL — Tools
tools: Read, Grep, Glob, Bash # Allowlist (omit both → inherits all)
disallowedTools: Write, Edit # Denylist (removes from inherited set)
# Task(agent1, agent2) restricts spawnable subagents

# OPTIONAL — Model
model: inherit # inherit | sonnet | opus | haiku

# OPTIONAL — Permissions
permissionMode: default # default | acceptEdits | dontAsk | bypassPermissions | plan

# OPTIONAL — Skills (content injected at startup)
skills:
    - skill-name

# OPTIONAL — MCP Servers
mcpServers:
    - server-name

# OPTIONAL — Hooks (scoped to this agent)
hooks:
    PreToolUse:
        - matcher: 'Bash'
          hooks:
              - type: command
                command: './scripts/validate.sh'

# OPTIONAL — Memory (MEMORY.md auto-injected, Read/Write/Edit auto-added)
memory: project # user (~/.claude/agent-memory/) | project (.claude/agent-memory/) | local (.claude/agent-memory-local/); .claude/.gitignore ignores both project folders

# OPTIONAL — Execution
background: false # true = always background task
isolation: worktree # Run in temporary git worktree
---

Tool Restriction Patterns

Agent TypeRecommended tools
Explorer / /investigateRead, Grep, Glob, Bash
Reviewer (read-only)Read, Grep, Glob
Writer/ImplementerRead, Write, Edit, Grep, Glob, Bash
ResearcherRead, Grep, Glob, WebFetch, WebSearch
OrchestratorRead, Grep, Glob, Task(sub1, sub2)

Available tools: Read, Write, Edit, MultiEdit, Glob, Grep, Bash, WebFetch, WebSearch, Task, NotebookRead, NotebookEdit, TaskCreate, TaskUpdate, ask user question tool, + MCP tools.

Model Selection

These are routing heuristics, not measured quality rankings or compatibility evidence. Preserve an explicit user choice; otherwise prefer inherit. Record representative model/runtime tests separately, with unavailable comparisons marked NOT RUN.

ModelBest For
haikuFast read-only: scanning, search, file listing
sonnetBalanced: code review, debugging, analysis
opusCandidate for high-stakes architecture or complex implementation; verify suitability on representative tasks
inheritDefault — match parent's model

Description Best Practices

# BAD — too vague, Claude won't auto-delegate
description: Reviews code

# GOOD — specific trigger conditions
description: >-
  Use this agent for comprehensive code review after implementing features,
  before merging PRs, or when assessing code quality and technical debt.
  • Include "Use this agent when..." phrasing with concrete scenarios
  • Add "use proactively" to encourage auto-invocation

Common Anti-Patterns

Anti-PatternFix
No tool restrictionsAdd tools allowlist
Vague descriptionWrite specific trigger conditions
Giant system promptKeep concise, use skills for detail
Recursive subagentsRestrict Task in tools
Windows long prompts (>8191 chars)Use file-based agents, not --agents CLI

Context Passing

  • Agent receives ONLY its system prompt + task prompt — NOT parent conversation
  • Parent receives ONLY agent's final result — NOT intermediate tool calls
  • This isolation is the primary context management benefit

Audit Checklist

#CheckRuleSeverity
1Frontmatter existsMust have --- delimitersError
2Name present & validLowercase + hyphens onlyError
3Description presentNon-empty, >20 charsError
4No duplicate namesUnique across all agent filesError
5Description qualitySpecific trigger scenariosWarning
6Tools minimalOnly what agent needsWarning
7Prompt structureHas ## Role + ## WorkflowWarning
8Model setWhen task differs from defaultInfo

Quality Score: Valid frontmatter (20) + Description >50 chars (20) + Tools restricted (15) + Role section (15) + Workflow section (10) + Model set (10) = 90. Rating: 80+ Excellent, 60-79 Good, 40-59 Needs Work, <40 Poor.

File Priority (highest first)

  1. --agents CLI flag (session only)
  2. .claude/agents/*.md (project)
  3. ~/.claude/agents/*.md (user)
  4. Plugin agents/ directory

Same name across levels: higher-priority wins. Use claude agents CLI to list all.

Requirements

<user-prompt>$ARGUMENTS</user-prompt>


<!-- PROTOCOL-GUIDES:START -->

Protocol guides — Apply each protocol only when its read-when condition holds. If a protocol's text is not in your context, read its file below before you act on it.

  • review-decision-autonomy — Choose supported review decisions and ask before extending the round budget; running any review or audit skill or mode → .claude/skills/shared/protocols/review-decision-autonomy.md
<!-- PROTOCOL-GUIDES:END --> <!-- SYNC:review-decision-autonomy:reminder -->

MUST ATTENTION Decide supported review choices and recommendations, record the rationale, and finish without routine user questions. Keep round-limit extension, indispensable facts and actual action authority; preserve source coverage, validation, tests, read-only boundaries and budgets. Review decisions do not accept open risks or make a failed gate pass.

<!-- /SYNC:review-decision-autonomy:reminder -->

Closing Reminders

IMPORTANT MUST ATTENTION Goal: Create new custom agents, audit existing agent quality, or enhance agent definitions so each agent is valid, least-privilege, structurally complete, and ready for safe delegation.

IMPORTANT MUST ATTENTION follow the mode-specific path: detect mode → Create: clarify, check existing agents, scaffold, write the system prompt, validate; Audit: discover, parse, validate, report, and fix only after confirmation; Enhance: read, analyze, recommend, apply only after confirmation; then run the final audit checklist and quality-score validation.

Protocols in force (concise digest of the SYNC/shared blocks this skill carries):

  • AI Mistakes: holistic-first debug, fix at responsible layer, surgical diff, verify ALL outputs.

  • Use TaskCreate before starting, including final review; keep task depth proportional to the work.

  • Search 3+ similar patterns before creating code; cite file:line for every claim, with confidence >80% to act.

EvasionRequired action
"Header preview is enough"Read complete frontmatter and body before checking or scoring
"Audit found Errors, fix now"Report first; fix Error-level issues only after user confirmation

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

[Documentation] Use when generating, smart-merging or refactoring the root AI context (CLAUDE.md, AGENTS.md) and its Claude/Codex projections. Config file only: project-config.

中文简介正在准备中。当前显示原文说明。

duc01226/EasyPlatform122026年10月20日 更新

[Code Quality] Use when a workflow step or the user asks for AI code or plan review: LLM calls, prompts, agents, RAG, evals and guardrails. --mode={code|plan}; --report-only is read-only.

中文简介正在准备中。当前显示原文说明。

duc01226/EasyPlatform122026年10月20日 更新

[Architecture] Use when a workflow step or the user asks for architecture design, compliance review, scalability grading or whole-project audit via --mode={design|review|scalability|full}.

中文简介正在准备中。当前显示原文说明。

duc01226/EasyPlatform122026年10月20日 更新

[Content] Use when a workflow step or the user asks for product/feature ideation with ranked opportunities and validation tests. --mode={roadmap|scope}.

中文简介正在准备中。当前显示原文说明。

duc01226/EasyPlatform122026年10月20日 更新

[Content] Use when a workflow step or the user asks for business viability: Business Model Canvas, financials, risks and go-to-market recommendation.

中文简介正在准备中。当前显示原文说明。

duc01226/EasyPlatform122026年10月20日 更新

[Code Quality] Use when a workflow step or the user asks for a focused code-change review: staged, unstaged, branch diff or simple pull request. --fix-loop fixes and re-reviews. Complex pull request: workflow-review-changes; rationale: why-review.

中文简介正在准备中。当前显示原文说明。

duc01226/EasyPlatform122026年10月20日 更新

查看 duc01226 的全部技能

报告此技能的问题