---
description: Create a SmartStack agent extension project
argument-hint: <name> [description]
---

# Create Agent Extension

Scaffold a complete SmartStack **agent** extension project.

## What is an Agent?

An agent is a specialized execution unit:
- Launched by commands for parallel execution
- Focused on specific tasks (search, analysis, etc.)
- Defined in markdown with YAML frontmatter
- Optimized with model selection (haiku/sonnet/opus)

## Arguments

Parse from `$ARGUMENTS`:
- **name** (required): Agent name in kebab-case
- **description** (optional): What the agent does

## Project Structure

```
smartstack-{name}/
├── package.json
├── tsconfig.json
├── tsup.config.ts
├── README.md
├── .gitignore
├── src/
│   └── index.ts
└── templates/
    └── agents/
        └── {name}.md          # Agent template
```

## Generated Agent Template

Create `templates/agents/{name}.md`:

```markdown
---
name: {name}
description: {description}
color: yellow
model: haiku
---

# {PascalCaseName} Agent

{description}

## Purpose

This agent specializes in:
- [Primary capability 1]
- [Primary capability 2]
- [Primary capability 3]

## Search Strategy

### 1. Initial Discovery
- Use `Glob` to find files matching patterns
- Focus on: `**/*.{relevant-extensions}`

### 2. Deep Analysis
- Use `Grep` for specific code patterns
- Look for: `pattern1`, `pattern2`

### 3. Context Building
- Use `Read` to examine key files
- Extract: imports, exports, dependencies

### 4. Synthesis
- Compile findings
- Identify patterns
- Generate recommendations

## Output Format

**CRITICAL**: Output findings directly in response. NEVER create files.

### Findings Report

#### Relevant Files
| File | Purpose | Key Patterns |
|------|---------|--------------|
| path/to/file | description | patterns found |

#### Analysis
[Detailed analysis of findings]

#### Recommendations
1. [First recommendation]
2. [Second recommendation]
3. [Third recommendation]

## Tool Usage

Preferred tools for this agent:
- `Glob` - File discovery
- `Grep` - Pattern search
- `Read` - File content

## Anti-Patterns

- **NEVER** create markdown files
- **NEVER** guess without evidence
- **NEVER** skip verification
- **ALWAYS** cite specific file paths

## Priority

Accuracy > Completeness > Speed
```

## Model Selection Guide

| Use Case | Model | Reason |
|----------|-------|--------|
| Simple search | haiku | Fast, cheap |
| Analysis | sonnet | Good balance |
| Complex reasoning | opus | Best quality |

## Workflow

1. Parse name and description from `$ARGUMENTS`
2. Validate name is kebab-case
3. Create project directory
4. Generate all files using Write tool
5. Display success message

---

User: $ARGUMENTS
