---
description: Create a complete SmartStack plugin with all extension types
argument-hint: <name> [description]
---

# Create Plugin Extension

Scaffold a complete SmartStack **plugin** with command, agent, skill, and hook.

## What is a Plugin?

A plugin is a full-featured extension package containing:
- **Command**: Main entry point for users
- **Agent**: Specialized execution unit
- **Skill**: Multi-phase workflow
- **Hook**: Validation trigger

## Arguments

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

## Project Structure

```
smartstack-{name}/
├── package.json
├── tsconfig.json
├── tsup.config.ts
├── README.md
├── .gitignore
├── LICENSE
├── src/
│   └── index.ts
├── templates/
│   ├── commands/
│   │   ├── {name}.md              # Main command
│   │   └── {name}/
│   │       ├── analyze.md         # Sub-command
│   │       └── execute.md         # Sub-command
│   ├── agents/
│   │   └── {name}.md              # Plugin agent
│   ├── skills/
│   │   └── {name}/
│   │       ├── SKILL.md           # Skill definition
│   │       ├── 1-setup.md
│   │       ├── 2-analyze.md
│   │       ├── 3-execute.md
│   │       └── templates.md
│   └── hooks/
│       └── {name}-check.md        # Plugin hook
└── examples/
    └── usage.md                   # Usage examples
```

## Generated Files

### Main Command (templates/commands/{name}.md)

```markdown
---
description: {description}
argument-hint: <task> [options]
---

# {PascalCaseName}

{description}

## Available Sub-Commands

| Command | Description |
|---------|-------------|
| `/{name}` | Run default workflow |
| `/{name}:analyze` | Analysis only |
| `/{name}:execute` | Execution only |

## Quick Start

```
/{name} <your-task>
```

## Workflow

### 1. ANALYZE
Launch `{name}` agent for exploration.

### 2. PLAN
Design approach based on analysis.

### 3. EXECUTE
Implement using skill phases.

### 4. VALIDATE
Verify with `{name}-check` hook.

## Priority

Quality > Speed > Cost

---

User: $ARGUMENTS
```

### Plugin Agent (templates/agents/{name}.md)

```markdown
---
name: {name}
description: Agent for {name} operations
color: cyan
model: sonnet
---

# {PascalCaseName} Agent

Specialized agent for {name} analysis and execution.

## Capabilities

1. **Discovery**: Find relevant files and patterns
2. **Analysis**: Deep code analysis
3. **Recommendations**: Actionable suggestions

## Search Strategy

1. Use `Glob` for file discovery
2. Use `Grep` for pattern matching
3. Use `Read` for detailed analysis

## Output Format

### Analysis Report

#### Files Analyzed
[List of relevant files]

#### Findings
[Detailed findings]

#### Recommendations
[Actionable recommendations]

## Priority

Accuracy > Completeness > Speed
```

### Plugin Skill (templates/skills/{name}/SKILL.md)

```markdown
---
name: {name}
description: Multi-phase workflow for {name}
---

# {PascalCaseName} Skill

## Phases

| Phase | Command | Model | Cost |
|-------|---------|-------|------|
| 1 | `/{name}:1-setup` | Haiku | ~$0.02 |
| 2 | `/{name}:2-analyze` | Sonnet | ~$0.10 |
| 3 | `/{name}:3-execute` | Opus | ~$0.30 |

## Workflow

```
┌──────────┐     ┌──────────┐     ┌──────────┐
│  SETUP   │ ──▶ │ ANALYZE  │ ──▶ │ EXECUTE  │
└──────────┘     └──────────┘     └──────────┘
```

## Usage

```
/{name}            # Full workflow
/{name}:1-setup    # Setup only
```

## Priority

Quality > Cost > Speed
```

### Plugin Hook (templates/hooks/{name}-check.md)

```markdown
---
description: Validation hook for {name}
trigger: pre-commit
blocking: true
---

# {PascalCaseName} Check Hook

Validates {name} operations before commit.

## Patterns

### BLOCKING
- `DANGEROUS_PATTERN` - Prevents commit

### WARNING
- `MILD_CONCERN` - Logs warning

## Integration

Runs automatically in `/gitflow:3-commit`.

## Bypass

```bash
SKIP_{NAME_UPPER}_CHECK_HOOK=1 git commit
```
```

### package.json

```json
{
  "name": "@smartstack/{name}",
  "version": "1.0.0",
  "description": "{description}",
  "author": "AtlasHub",
  "license": "MIT",
  "type": "module",
  "main": "./dist/index.js",
  "files": ["dist", "templates"],
  "scripts": {
    "build": "tsup",
    "dev": "tsup --watch"
  },
  "peerDependencies": {
    "@atlashub/smartstack-cli": ">=1.0.0"
  },
  "keywords": ["smartstack", "claude", "extension", "{name}"]
}
```

### README.md

```markdown
# SmartStack {PascalCaseName} Plugin

{description}

## Installation

```bash
npm install @smartstack/{name}
smartstack install --extension @smartstack/{name}
```

## Components

| Type | Command | Description |
|------|---------|-------------|
| Command | `/{name}` | Main entry point |
| Agent | `{name}` | Analysis agent |
| Skill | `/{name}:*` | Multi-phase workflow |
| Hook | `{name}-check` | Validation |

## Usage

```
/{name} <your-task>
```

## License

MIT
```

## Workflow

1. Parse name and description from `$ARGUMENTS`
2. Validate name format (kebab-case)
3. Create complete directory structure
4. Generate all component files:
   - Command + sub-commands
   - Agent
   - Skill + phases
   - Hook
5. Generate package.json, README, etc.
6. Display success message with component list

## Validation

Before creating:
- Name must be kebab-case
- Directory must not exist
- All paths must be valid

## Success Output

```
╔═══════════════════════════════════════════════════════════╗
║           SMARTSTACK PLUGIN CREATED                       ║
╠═══════════════════════════════════════════════════════════╣
║  Name:     smartstack-{name}                              ║
║  Type:     Full Plugin                                    ║
╠═══════════════════════════════════════════════════════════╣
║  Components:                                              ║
║  ✓ Command:  /{name}                                      ║
║  ✓ Agent:    {name}                                       ║
║  ✓ Skill:    /{name}:* (3 phases)                         ║
║  ✓ Hook:     {name}-check                                 ║
╠═══════════════════════════════════════════════════════════╣
║  Next steps:                                              ║
║  1. cd smartstack-{name}                                  ║
║  2. npm install                                           ║
║  3. Customize templates                                   ║
║  4. npm run build                                         ║
║  5. npm publish                                           ║
╚═══════════════════════════════════════════════════════════╝
```

## Priority

Completeness > Quality > Speed

---

User: $ARGUMENTS
