Skip to main content

Step 4

Step 4 — Skills · Subagents · Hooks

5 views

Table of contents

Three automation tools — each fits a different moment.

Skills — slash commands you invoke

.claude/skills/deploy.md
---
name: deploy
description: Deploy to PROD
---

1. `pnpm test` passes
2. `docker compose -f infra/prod/docker-compose.yml build`
3. `docker compose -f infra/prod/docker-compose.yml up -d`
4. `curl https://example.com/api/health` returns 200
5. Send result to Slack

Type /deploy and the steps run.

Subagents — heavy work in a separate context

For sprawling code search or multi-file edits without polluting your main context.

---
name: code-reviewer
description: Review PR changes
tools: Read, Grep, Bash
---

You're a senior reviewer checking security, performance, and test coverage.
> ask code-reviewer to review PR #123

The main context is preserved; the subagent runs in its own.

Hooks — auto triggers

.claude/settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [{ "type": "command", "command": "pnpm format" }]
      }
    ]
  }
}

Auto-format after every file edit.

Comparison

Tool Trigger Context
Skill user /cmd current
Subagent user/AI calls separate
Hook auto (post-tool) current

Try it

Create .claude/skills/test.md that "runs all tests and summarizes". Invoke with /test.

Going deeper

Next

Step 5 — Context7 + Figma MCP.