Claude
Skills
Sign in
Back

automate

Included with Lifetime
$97 forever

Expert advisor that helps decide and create the right Claude Code automation

AI Agents

What this skill does


# Claude Code Automation

Arguments: $ARGUMENTS

---

## Registry Bootstrap

Before routing commands, ensure the registry is available.

**If `~/.claude/automations-registry.json` does NOT exist:**

Scan for existing automations created by this plugin (they have `created-by: automate` markers). This handles reinstallation after uninstall.

1. Scan `~/.claude/skills/*/SKILL.md` and `.claude/skills/*/SKILL.md` for frontmatter containing `created-by: automate`
2. Scan `~/.claude/agents/*.md` and `.claude/agents/*.md` for frontmatter containing `created-by: automate`
3. Scan `~/.claude/settings.json` for hook entries with `"_meta": {"createdBy": "automate"}`
4. Scan `.claude/settings.json` for the same
5. Scan `.mcp.json` and `~/.claude.json` for MCP entries with `"_meta": {"createdBy": "automate"}`
6. Scan `.lsp.json` and `~/.claude/lsp.json` for LSP entries with `"_meta": {"createdBy": "automate"}`

For each found automation, reconstruct a registry entry:
```json
{
  "id": "recovered-<type>-<name>",
  "name": "<extracted from frontmatter or key name>",
  "type": "<skill|hook|subagent|permission|custom-command|mcp-server|lsp-server>",
  "scope": "<global if in ~/.claude/, project if in .claude/>",
  "path": "<absolute path to the file>",
  "created": "<file modification time>",
  "modified": "<file modification time>",
  "description": "<extracted from frontmatter or empty>",
  "recovered": true
}
```

Write the rebuilt registry and report:
> "Found N existing automations created by this plugin. Registry rebuilt."

If nothing found → proceed normally (clean start).

---

## Command Router

Parse `$ARGUMENTS` to check for sub-commands:

**If `$ARGUMENTS` is `list`, `help`, `verify`, `edit`, `delete`, `export`, `import`, or `cleanup`:**

Tell the user:
> "Management commands are now separate skills for faster execution. Use `/automate-{command}` instead. For example: `/automate-list`, `/automate-edit <name>`, etc. Run `/automate-help` for the full reference."

Then STOP. Do not proceed to the creation workflow.

**Otherwise:** Proceed to **Create New Automation** below.

---

# Create New Automation

---

## CRITICAL RULE: COMPLETE ALL COMPONENTS

**This skill MUST create EVERYTHING it promises. Partial implementations are FORBIDDEN.**

If you decide "Hook + Skill is needed":
- You MUST create the hook AND the skill
- You MUST test that both work
- You MUST NOT finish until both are verified

If ANY component fails:
- FIX IT before proceeding
- DO NOT remove it and continue
- DO NOT leave it for "later"

**An incomplete automation is worse than no automation.**

---

## Step 0: Load validation schemas

Read the schema files from this plugin to know what values are valid:
- `plugin/schemas/hooks.json` - Valid hook events, types, matchers
- `plugin/schemas/skills.json` - Skill frontmatter requirements
- `plugin/schemas/subagents.json` - Subagent configuration
- `plugin/schemas/permissions.json` - Permission patterns
- `plugin/schemas/custom-commands.json` - Custom command format
- `plugin/schemas/mcp-servers.json` - MCP server configuration
- `plugin/schemas/lsp-servers.json` - LSP server configuration
- `plugin/schemas/agent-teams.json` - Agent team configuration

**CRITICAL: Only use values listed in these schemas. Never invent event names or fields.**

---

## Step 1: Adaptive interview

Use AskUserQuestion for each phase. The interview adapts based on answers to minimize questions.

### Phase 1: Quick classification (1 question)

Ask the user to pick the closest category:

```
What best describes what you want to create?
1. Something that must happen automatically every time (e.g., check before every commit)
2. Knowledge or rules Claude should follow (e.g., coding standards, project conventions)
3. A workflow I'll trigger manually (e.g., generate boilerplate, run analysis)
4. Integration with external tools/services (e.g., database, API, GitHub)
5. Multiple agents working in parallel on different aspects
6. I'm not sure, help me decide
```

### Phase 2: Refinement (1-2 questions, based on Phase 1)

**If answer is 1 (automatic/every time) → Hook path:**
Ask: "Does it need Claude's intelligence to decide, or is a simple script enough?"
- Simple script → Hook only
- Needs intelligence → Hook + Skill combination

**If answer is 2 (knowledge/rules) → Skill or CLAUDE.md path:**
Ask: "Must this rule be GUARANTEED (can never be skipped), or is it advisory (Claude should follow it but it's not critical)?"
- Guaranteed → Hook (not CLAUDE.md, which is advisory)
- Advisory → ask: "Should Claude apply this automatically when relevant, or only when you invoke it?"
  - Automatically → Skill with `disable-model-invocation: false`
  - Only on invocation → Skill with `disable-model-invocation: true`
  - Simple one-liner rule → CLAUDE.md

**If answer is 3 (manual workflow) → Skill (manual) path:**
Ask: "Does this workflow need a separate, isolated context (e.g., deep analysis that shouldn't pollute your main conversation)?"
- Yes → Skill + Subagent
- No → Skill with `disable-model-invocation: true`

**If answer is 4 (external integration) → MCP/LSP path:**
Ask: "What kind of integration do you need?"
- External tool/service/API → MCP Server (ask: "What service/tool do you want to integrate?")
- Code intelligence (diagnostics, hover, go-to-definition) → LSP Server

**If answer is 5 (parallel agents) → Agent Team path:**
Proceed directly. Warn about experimental status.

**If answer is 6 (not sure) → Full interview:**
Ask ALL of these questions (one AskUserQuestion with numbered items):
1. When should this happen? (always/on specific action/on request/in certain contexts)
2. Must it be guaranteed or is it advisory?
3. Does it need Claude's intelligence or can a script handle it?
4. Should it apply to all projects or just this one?
5. Does it involve external tools/services?
6. Does it need multiple agents working in parallel?

### Phase 3: Conflict check (automatic, no user question needed)

Before proceeding, read `~/.claude/automations-registry.json` and check for conflicts:
- Any existing automation with the same name or similar description
- Any hook on the same event + matcher combination

If conflicts are found, use AskUserQuestion to show them:
```
Found existing automation that may conflict:
  - "pre-commit-check" (hook, PreToolUse → Bash) — "Blocks pushes to main"

What would you like to do?
1. Overwrite the existing automation
2. Rename the new automation
3. Cancel
```

### Phase 4: Name proposal (1 question)

Propose 3 name options based on the automation's purpose:

```
Suggested names:
1. pre-commit-tests
2. test-runner-hook
3. commit-guard
Which do you prefer? (or type your own)
```

Also ask about scope if not yet determined:
- Global (all projects): `~/.claude/...`
- Project-only: `.claude/...`

---

## Step 2: Analysis and decision

Based on the answers, use this decision matrix:

| Criterion | Hook | Skill | Skill (manual) | Subagent | Permissions | CLAUDE.md | Custom Cmd | MCP Server | LSP Server | Agent Team |
|-----------|------|-------|----------------|----------|-------------|-----------|------------|------------|------------|------------|
| Must happen ALWAYS without exceptions | YES | no | no | no | no | no | no | no | no | no |
| Rule about what Claude can/cannot do | no | no | no | no | YES | maybe | no | no | no | no |
| Domain knowledge applied automatically | no | YES | no | no | no | maybe | no | no | no | no |
| Complex workflow invoked manually | no | no | YES | no | no | no | no | no | no | no |
| Needs separate/isolated context | no | no | no | YES | no | no | no | no | no | no |
| Independent review/analysis | no | no | no | YES | no | no | no | no | no | no |
| Simple global rule | no | no | no | no | no | YES | no | no | no | no |
| Shortcut for frequent prompt | no | no | no | no | no | no | YES | no | no | no |
| External tool/service integration | no | no | no | no | no | no | no | YES | no | no |
| Code intelligence/language anal

Related in AI Agents