AgentSkillsCN

clnode-agents

发现已安装的智能体/技能/规则,并创建新智能体。

SKILL.md
--- frontmatter
name: clnode-agents
description: Discover installed agents/skills/rules and create new agents
version: 2.0.0

Agent Discovery & Generator

Execute all phases below in order. Use the specified tools at each step.


Phase 1: Discovery (always run)

Scan the project's .claude/ directory to show what's installed.

Step 1-1: Scan files

Use Glob to find:

  • .claude/agents/*.md — agent definitions
  • .claude/skills/*/SKILL.md — installed skills
  • .claude/rules/*.md — active rules

Step 1-2: Extract agent details

For each file found in .claude/agents/*.md, use Read to extract YAML frontmatter fields:

  • name
  • description
  • model (default: sonnet)
  • skills (list)

Step 1-3: Display results

Output a summary in this format:

code
## Installed Agents (N)

| Name | Model | Description | Skills |
|------|-------|-------------|--------|
| backend-dev | sonnet | Backend development | compress-output |
| reviewer | opus | Code review | compress-review |

## Installed Skills (N)
- compress-output
- compress-review
- ...

## Installed Rules (N)
- team.md
- typescript.md
- ...

Phase 2: Ask User

Use AskUserQuestion to ask:

code
question: "What would you like to do?"
header: "Action"
options:
  - label: "Create new agent"
    description: "Generate a new agent definition file with proper frontmatter and structure"
  - label: "Done"
    description: "Exit — discovery complete"

If the user selects "Done", stop here.


Phase 3: Generate Agent

Step 3-1: Gather info

Use AskUserQuestion with these questions (all in one call):

Question 1:

code
question: "What should the agent be named? (use kebab-case, e.g., api-tester)"
header: "Name"
options:
  - label: "custom name"
    description: "Enter a custom agent name"

Question 2:

code
question: "What is this agent's role?"
header: "Role"
options:
  - label: "Implementer"
    description: "Writes code — backend, frontend, CLI, etc."
  - label: "Reviewer"
    description: "Reviews code for quality, security, patterns"
  - label: "Architect"
    description: "Designs systems, makes technical decisions"
  - label: "Specialist"
    description: "Domain-specific tasks (testing, docs, DevOps, etc.)"

Question 3:

code
question: "Which model should this agent use?"
header: "Model"
options:
  - label: "sonnet (Recommended)"
    description: "Best for implementation tasks — fast and capable"
  - label: "opus"
    description: "Best for review, architecture, complex reasoning"
  - label: "haiku"
    description: "Best for simple, repetitive, mechanical tasks"

Step 3-2: Check for duplicates

Use Glob to check if .claude/agents/{name}.md already exists. If it does, warn the user and ask for confirmation before overwriting.

Step 3-3: Determine skills

Apply these rules:

  • If role is Reviewerskills: [compress-review]
  • All other roles → skills: [compress-output]

Step 3-4: Determine tools

Apply these rules:

  • If role is Reviewer or Architecttools: Read, Grep, Glob, Bash
  • If role is Implementer or Specialisttools: Read, Edit, Write, Bash, Grep, Glob

Step 3-5: Write agent file

Use Write to create .claude/agents/{name}.md with this template:

markdown
---
name: {name}
description: {role description from user}
tools: {tools from Step 3-4}
model: {model}
memory: project
skills:
  - {skill from Step 3-3}
---

# {Name} Agent

{Brief role description based on user input}

## Responsibilities
- {Generate 3-4 responsibilities based on the role}

## Before Returning

MANDATORY: Before returning your final response, compress your output:
- List changed files with 1-line summary each
- Key decisions made (1-2 sentences)
- Issues encountered (if any)
- Total output MUST be under 10 lines

Phase 4: Update team.md

Step 4-1: Check if team.md exists

Use Glob to check for .claude/rules/team.md. If it does NOT exist, skip this phase entirely.

Step 4-2: Scan all agents

Use Glob for .claude/agents/*.md, then Read each file to extract name, model, and description from frontmatter.

Step 4-3: Rebuild Team Structure

Generate a new Team Structure block from the scanned agents:

code
Leader (Main Session / Opus)
├── {agent-1} ({Model}) — {description}
├── {agent-2} ({Model}) — {description}
...
└── {last-agent} ({Model}) — {description}

Rules:

  • Capitalize the model name display: sonnetSonnet, opusOpus, haikuHaiku
  • Use ├── for all agents except the last
  • Use └── for the last agent
  • Sort alphabetically by agent name

Step 4-4: Edit team.md

Use Read to get the current content of .claude/rules/team.md. Use Edit to replace the existing Team Structure code block (the content between the ``` markers under ## Team Structure) with the newly generated block.


Model Recommendation Guide

RoleRecommended ModelReason
RevieweropusNeeds deep reasoning for code quality analysis
ArchitectopusComplex system design decisions
CuratoropusCross-domain knowledge synthesis
Implementer (backend)sonnetFast, capable code generation
Implementer (frontend)sonnetFast, capable code generation
Implementer (CLI)sonnetFast, capable code generation
Test writersonnetStraightforward test generation
Simple/mechanical taskshaikuCost-efficient for repetitive work

Reference

Claude Code agent documentation: https://docs.anthropic.com/en/docs/claude-code/agents