Files
gh-vanman2024-domain-plugin…/skills/build-assistant/examples.md
2025-11-30 09:04:17 +08:00

6.5 KiB

Build-Assistant - Examples

Complete Workflow Examples

Example 1: Building a New Agent from Scratch

Scenario: Create an agent that analyzes code complexity

Steps:

  1. Read the template
Read: templates/agents/agent.md.template
  1. Study the example
Read: templates/agents/agent-example.md
  1. Create the agent file
---
name: complexity-analyzer
description: Analyzes code complexity and suggests improvements
tools: Read, Grep, Bash
model: claude-sonnet-4-5-20250929
color: purple
---

You are a code complexity analyzer...

## Your Process

### Step 1: Scan Codebase
...
  1. Validate the agent
scripts/validate-agent.sh agents/complexity-analyzer.md
# ✅ Agent validation passed

Example 2: Creating a Slash Command

Scenario: Create a command to run complexity analysis

Steps:

  1. Read the documentation
Read: docs/01-claude-code-slash-commands.md
  1. Read the template
Read: templates/commands/command.md.template
  1. Create the command
---
description: Analyze code complexity and generate report
argument-hint: [target-directory]
---

User input: $ARGUMENTS

Task
  1. Validate the command
scripts/validate-command.sh commands/analyze-complexity.md
# ✅ Command validation passed

Example 3: Building a Skill with Supporting Files

Scenario: Create a skill for database design

Steps:

  1. Decide it should be a skill
Read: docs/04-skills-vs-commands.md
# Decision: Skill (automatic discovery, complex capability)
  1. Create directory structure
mkdir -p skills/database-designer/templates
mkdir -p skills/database-designer/scripts
  1. Read the template
Read: templates/skills/SKILL.md.template
  1. Create SKILL.md
---
name: Database Designer
description: Design database schemas with normalization and optimization. Use when designing databases, creating schemas, or working with ERDs.
allowed-tools: Read, Write, Bash
---

# Database Designer

## Instructions

1. Analyze requirements to identify entities
2. Define relationships and cardinality
3. Apply normalization (1NF through 3NF)
4. Generate SQL schema files
5. Create migration scripts

## Available Resources

- templates/schema.sql - SQL schema template
- templates/migration.sql - Migration template
- scripts/generate-erd.py - ERD diagram generator

...
  1. Add supporting files
# Create template
Write: skills/database-designer/templates/schema.sql

# Create script
Write: skills/database-designer/scripts/generate-erd.py
  1. Validate the skill
scripts/validate-skill.sh skills/database-designer/
# ✅ Skill validation passed

Example 4: Building a Complete Plugin

Scenario: Create a testing plugin with commands, agents, and skills

Steps:

  1. Read plugin documentation
Read: docs/03-claude-code-plugins.md
  1. Study the example
Read: templates/plugins/example-plugin/
  1. Create plugin structure
mkdir -p multiagent-testing/.claude-plugin
mkdir -p multiagent-testing/{commands,agents,skills,docs}
  1. Create manifest
{
  "name": "multiagent-testing"
  "version": "1.0.0"
  "description": "Comprehensive testing tools for multiagent projects"
  "components": {
    "commands": 3
    "agents": 2
    "skills": 1
  }
}
  1. Add commands
# /testing:unit
Write: multiagent-testing/commands/unit.md

# /testing:integration
Write: multiagent-testing/commands/integration.md

# /testing:e2e
Write: multiagent-testing/commands/e2e.md
  1. Add agents
# test-generator agent
Write: multiagent-testing/agents/test-generator.md

# test-runner agent
Write: multiagent-testing/agents/test-runner.md
  1. Add skill
# testing-assistant skill
mkdir -p multiagent-testing/skills/testing-assistant
Write: multiagent-testing/skills/testing-assistant/SKILL.md
  1. Create README
# multiagent-testing

Comprehensive testing tools for multiagent projects.

## Components

- **Commands**: 3 slash commands
- **Agents**: 2 specialized agents
- **Skills**: 1 testing skill

## Commands

- `/testing:unit` - Run unit tests
- `/testing:integration` - Run integration tests
- `/testing:e2e` - Run end-to-end tests
  1. Validate the plugin
scripts/validate-plugin.sh multiagent-testing/
# ✅ Plugin validation passed

Example 5: Deciding Between Skill and Command

Scenario 1: Git commit helper

Analysis:

Question: Should user explicitly trigger it?
- NO - User might just ask "help me write a commit"

Question: Should Claude discover automatically?
- YES - When user mentions "commit" or "git commit"

Decision: SKILL
- Create skill with "Use when writing commit messages"
- Claude activates when context matches

Scenario 2: Deployment workflow

Analysis:

Question: Should user explicitly trigger it?
- YES - Deployment is critical, needs explicit control

Question: Is it a sequential workflow?
- YES - Multiple steps that user controls

Decision: COMMAND
- Create /deploy command
- User explicitly invokes for safety

Example 6: Using Validation Scripts

Running Individual Validations:

# Validate an agent
scripts/validate-agent.sh agents/my-agent.md
# ✅ Agent validation passed

# Validate a command
scripts/validate-command.sh commands/my-command.md
# ✅ Command validation passed

# Validate a skill
scripts/validate-skill.sh skills/my-skill/
# ⚠️  WARNING: Description should include 'Use when' trigger context
# (Fix required)

# Validate a plugin
scripts/validate-plugin.sh plugins/my-plugin/
# ❌ ERROR: Missing .claude-plugin/plugin.json
# (Fix required)

Running Comprehensive Tests:

# Test entire build system
scripts/test-build-system.sh
# Running comprehensive build system tests...
# ✅ All validations passed
# ✅ All templates exist
# ✅ All scripts executable

Quick Reference: Build Workflows

Agent Workflow

  1. Read template → 2. Study example → 3. Create agent → 4. Validate

Command Workflow

  1. Read docs → 2. Read template → 3. Create command → 4. Validate

Skill Workflow

  1. Decide vs command → 2. Read template → 3. Create skill → 4. Add resources → 5. Validate

Plugin Workflow

  1. Read docs → 2. Study example → 3. Create structure → 4. Add components → 5. Create README → 6. Validate

Use these examples as templates when creating your own components!