Generator

From masharratt/claude-flow-novice · View interactive version

Generator is an AI agent skill from the GitHub repository masharratt/claude-flow-novice. Generates new agent profiles with consistent structure, automatic validation pattern injection, and test-driven protocols

How to use this skill

Skill file

Agent Template Generator Skill

Purpose: Creates new agent profiles with enforced consistency, automatic validation pattern inclusion, and test-driven development protocols.

Benefits:


Quick Start

Generate a Specialist Agent

./.claude/skills/agent-template-generator/generate-agent.sh \
  --name "api-security-specialist" \
  --type "specialist" \
  --description "MUST BE USED for API security audits, penetration testing, and vulnerability assessment"

Generate a Validator Agent

./.claude/skills/agent-template-generator/generate-agent.sh \
  --name "security-validator" \
  --type "validator" \
  --description "MUST BE USED for Loop 2 security validation and threat model review"

Generate with Custom Configuration

./.claude/skills/agent-template-generator/generate-agent.sh \
  --name "custom-agent" \
  --type "specialist" \
  --description "Agent description here" \
  --model "haiku" \
  --provider "anthropic" \
  --provider-model "claude-3-haiku-20240307" \
  --tools "[Read, Write, Bash, TodoWrite]"

Command Reference

Required Arguments

| Argument | Description | Example |

|----------|-------------|---------|

| --name | Agent name (lowercase-with-hyphens) | api-security-specialist |

| --description | Agent description (MUST BE USED pattern) | MUST BE USED for API security audits |

Optional Arguments

| Argument | Description | Default |

|----------|-------------|---------|

| --type | Agent type (specialist\|validator\|coordinator\|utility) | specialist |

| --tools | Tool list (JSON array) | [Read, Write, Edit, Bash, Grep, Glob, TodoWrite] |

| --model | Claude model (sonnet\|opus\|haiku) | sonnet |

| --acl-level | Access control level (1-3) | 1 |

| --output-dir | Output directory (overrides type-based default) | Auto-determined |

| --provider | AI provider (zai\|kimi\|openrouter\|anthropic) | zai |

| --provider-model | Provider-specific model | glm-4.6 |


Agent Types and Output Directories

| Type | Description | Default Output Directory |

|------|-------------|--------------------------|

| specialist | Domain-specific implementation (Loop 3) | .claude/agents/cfn-dev-team/developers/ |

| validator | Code review and validation (Loop 2) | .claude/agents/cfn-dev-team/reviewers/quality/ |

| coordinator | Multi-agent orchestration | .claude/agents/cfn-dev-team/coordinators/ |

| utility | Supporting tools and helpers | .claude/agents/cfn-dev-team/utility/ |


Generated Template Structure

1. YAML Frontmatter

---
name: agent-name
description: MUST BE USED description
tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
model: sonnet
type: specialist
acl_level: 1
validation_hooks:
  - agent-template-validator
  - test-coverage-validator
---

2. Provider Configuration

<!-- PROVIDER_PARAMETERS
provider: zai
model: glm-4.6
-->

3. Success Criteria Integration ✅ AUTO-INJECTED

Automatically includes:

source .claude/skills/json-validation/validate-success-criteria.sh
validate_success_criteria || exit 1

4. TDD Protocol ✅ AUTO-INJECTED

Automatically includes:

5. Test-Driven Validation ✅ AUTO-INJECTED

Automatically includes:

6. Customization Sections

Generated template includes placeholders for:


Workflow: Creating a New Agent

Step 1: Generate Template

./.claude/skills/agent-template-generator/generate-agent.sh \
  --name "graphql-security-specialist" \
  --type "specialist" \
  --description "MUST BE USED for GraphQL schema security audits and injection prevention"

Output:

✅ Agent template created: .claude/agents/cfn-dev-team/developers/graphql-security-specialist.md

Next steps:
1. Customize the [DOMAIN EXPERTISE] placeholder
2. Fill in Core Responsibilities
3. Customize Domain-Specific Guidelines
4. Define Success Metrics
5. Add Example Workflows
6. Document Integration Points
7. Add relevant references

Validation Pattern: ✅ Automatically included
Test-Driven Protocol: ✅ Automatically included
Provider Configuration: ✅ Set to zai (glm-4.6)

Step 2: Customize Template

Open generated file and replace placeholders:

# Edit the generated file
code .claude/agents/cfn-dev-team/developers/graphql-security-specialist.md

Customize:

  1. Replace [DOMAIN EXPERTISE - TO BE CUSTOMIZED] with specific domain
  2. Fill in 3-5 core responsibilities
  3. Add domain-specific best practices
  4. Define success metrics
  5. Add 2-3 example workflows
  6. Document integration with other agents

Step 3: Validate Structure

# Verify frontmatter is valid YAML
head -20 .claude/agents/cfn-dev-team/developers/graphql-security-specialist.md

# Verify validation skill is sourced
grep -A 5 "source .claude/skills/json-validation" .claude/agents/cfn-dev-team/developers/graphql-security-specialist.md

Step 4: Test Agent

# Test with sample criteria
AGENT_SUCCESS_CRITERIA='{"test_suites":[{"name":"security-tests","command":"npm run test:security","pass_threshold":0.95}]}' \
  cfn-spawn agent graphql-security-specialist \
    --task "Test validation integration"

Examples

Example 1: API Security Specialist

./.claude/skills/agent-template-generator/generate-agent.sh \
  --name "api-security-specialist" \
  --type "specialist" \
  --description "MUST BE USED for API security audits, penetration testing, and vulnerability assessment. Use PROACTIVELY for OAuth2 security, rate limiting, input validation. Keywords - API security, OWASP, penetration testing, vulnerability assessment"

Example 2: Performance Validator

./.claude/skills/agent-template-generator/generate-agent.sh \
  --name "performance-validator" \
  --type "validator" \
  --description "MUST BE USED for Loop 2 performance validation, load testing review, and bottleneck identification"

Example 3: Epic Coordinator (Haiku Model)

./.claude/skills/agent-template-generator/generate-agent.sh \
  --name "sprint-coordinator" \
  --type "coordinator" \
  --description "MUST BE USED for multi-sprint orchestration and epic decomposition" \
  --model "haiku" \
  --acl-level "3"

Example 4: Custom Output Directory

./.claude/skills/agent-template-generator/generate-agent.sh \
  --name "custom-specialist" \
  --type "specialist" \
  --description "Custom agent" \
  --output-dir ".claude/agents/cfn-dev-team/custom"

Validation Features

Automatic Injection

All generated agents automatically include:

  1. Centralized Validation Skill:

```bash

source .claude/skills/json-validation/validate-success-criteria.sh

validate_success_criteria || exit 1

```

  1. Test-Driven Protocol:
  1. Completion Protocol:

Prevented Anti-Patterns

Generator prevents:


Benefits vs Manual Creation

| Aspect | Manual Creation | Template Generator |

|--------|----------------|-------------------|

| Time | 60 minutes | 5 minutes (setup) + 10 minutes (customization) |

| Validation Pattern | Must remember to include | ✅ Automatic injection |

| Test-Driven Protocol | Must copy from existing agent | ✅ Automatic injection |

| Structure Consistency | Prone to variation | ✅ Enforced consistency |

| Security | May forget validation | ✅ Always includes CVSS 8.2 protection |

| Provider Config | May forget to add | ✅ Always included |

Time Savings: ~75% reduction in agent creation time


Testing

Test Template Generation

# Test basic generation
./.claude/skills/agent-template-generator/generate-agent.sh \
  --name "test-agent" \
  --type "specialist" \
  --description "Test agent for validation"

# Verify output file
ls -la .claude/agents/cfn-dev-team/developers/test-agent.md

# Cleanup
rm .claude/agents/cfn-dev-team/developers/test-agent.md

Verify Validation Integration

# Generate agent
./.claude/skills/agent-template-generator/generate-agent.sh \
  --name "test-validator" \
  --type "validator" \
  --description "Test"

# Verify validation skill is sourced
grep "source .claude/skills/json-validation/validate-success-criteria.sh" \
  .claude/agents/cfn-dev-team/reviewers/quality/test-validator.md

# Cleanup
rm .claude/agents/cfn-dev-team/reviewers/quality/test-validator.md

Integration with Other Skills

1. JSON Validation Skill

Dependency: All generated agents automatically source json-validation skill.

Integration:

source .claude/skills/json-validation/validate-success-criteria.sh
validate_success_criteria || exit 1

2. CFN Loop Orchestration

Integration Point: Generated agents include test execution pattern using the CFN Loop parse-test-results.ts helper. The old bash parse-test-results.sh was removed; the TypeScript CLI takes the same <framework> <output> arguments and prints the same JSON.

Pattern:

RESULTS=$(npx tsx "$HOME/.claude/skills/cfn-loop-orchestration-v2/lib/orchestrator/src/helpers/parse-test-results.ts" \
    "jest" "$TEST_OUTPUT")

Future Enhancements

v1.1.0 (Planned)

v2.0.0 (Future)


Troubleshooting

Error: Agent file already exists

Cause: Attempting to generate agent that already exists.

Solution:

# Remove existing file or choose different name
rm .claude/agents/cfn-dev-team/developers/existing-agent.md

# Or use different name
--name "existing-agent-v2"

Error: Invalid agent type

Cause: Using invalid agent type.

Valid types:

Generated agent has customization placeholders

Expected Behavior: All generated agents include [CUSTOMIZE] and [TO BE CUSTOMIZED] markers.

Solution: Replace all placeholders with domain-specific content.


Status: Production-ready (v1.0.0)

Time Savings: 75% reduction in agent creation time

Security: Auto-injection of CVSS 8.2 validation protection

Consistency: 100% structure enforcement across all new agents

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.