# Automations

Automations are reusable workflows that combine multiple actions: running commands, analyzing with AI, and creating files. They can run manually or on a schedule (daily, hourly, etc.).

Think of them as recipes for tasks you repeat regularly.

## [What Is an Automation?](/content/docs/automations#what-is-an-automation/index.html)

An automation strings together steps that execute one after another. Each step can:

- **Run a shell command** — `npm test`, `git push`, etc.
- **Analyze with AI** — review code, summarize logs, etc.
- **Create or modify files** — generate reports, update docs, etc.

Steps can pass results to each other, so the output of one step becomes input for the next.

## [Two Ways to Run Automations](/content/docs/automations#two-ways-to-run-automations/index.html)

### [Manual Trigger](/content/docs/automations#manual-trigger/index.html)

Click a button whenever you need it. Great for:

- One-off code reviews
- Emergency cleanup tasks
- On-demand report generation

### [Scheduled Trigger](/content/docs/automations#scheduled-trigger/index.html)

Runs automatically on a schedule. Great for:

- Daily test reports (every morning at 9 AM)
- Weekly code quality checks
- Hourly backup operations

## [Types of Steps](/content/docs/automations#types-of-steps/index.html)

### [Run a Command](/content/docs/automations#run-a-command/index.html)

Execute any shell command from your project.

```
Run: npm test
In folder: /project
```

Commands can reference results from earlier steps:

```
Run: echo "Previous step found: {step-1-result}"
```

### [AI Analysis](/content/docs/automations#ai-analysis/index.html)

Ask Claude to analyze files or results with specific capabilities.

```
Analyze these test results and suggest which tests to focus on
Available tools: read files, edit files, run commands
```

The AI gets full context from your files and can suggest fixes, improvements, or summaries.

### [Write Files](/content/docs/automations#write-files/index.html)

Create or update files, including results from earlier steps.

```
File: REPORT.md
Mode: write (create new) / append (add to end) / prepend (add to start)
Content: {AI analysis from previous step}
```

## [Creating an Automation](/content/docs/automations#creating-an-automation/index.html)

### [Define What You Want](/content/docs/automations#define-what-you-want/index.html)

Think about your workflow:

- What commands need to run?
- What analysis should happen?
- What files should be generated?

### [Set Up the Steps](/content/docs/automations#set-up-the-steps/index.html)

Add steps in order. Each step can use results from earlier steps.

### [Choose a Trigger](/content/docs/automations#choose-a-trigger/index.html)

- **Manual** — Run whenever you click the button
- **Scheduled** — Set a schedule (9 AM daily, every 2 hours, etc.)

### [Save & Run](/content/docs/automations#save--run/index.html)

Your automation is ready. Run it manually or let the schedule take care of it.

## [Real-World Examples](/content/docs/automations#real-world-examples/index.html)

### [Daily Test Report](/content/docs/automations#daily-test-report/index.html)

1. **Run** `npm test`
2. **AI analyzes** test output — "Which tests failed? Why?"
3. **Save** summary to `TEST_REPORT.md`
4. **Schedule:** Every day at 9 AM

Result: Automated test reports every morning.

### [Code Review Automation](/content/docs/automations#code-review-automation/index.html)

1. **Run** `git diff` (get recent changes)
2. **AI reviews** the code — "Any issues? Security problems?"
3. **Save** review to `REVIEW.md`
4. **Trigger:** Manual (run when you need a review)

Result: Get instant code reviews without waiting for a teammate.

### [Documentation Generator](/content/docs/automations#documentation-generator/index.html)

1. **Run** `grep -r "TODO" .` (find all TODO comments)
2. **AI organizes** them — "Create a prioritized list"
3. **Write** to `TODOS.md`
4. **Schedule:** Weekly on Monday morning

Result: Your TODO list auto-updates every week.

## [How Automations Work](/content/docs/automations#how-automations-work/index.html)

### [Execution Flow](/content/docs/automations#execution-flow/index.html)

1. Trigger fires (manual button or scheduled time)
2. Steps run in order, one after another
3. Each step completes before the next starts
4. Output from each step is captured
5. Final results are saved and available for review

### [Passing Data Between Steps](/content/docs/automations#passing-data-between-steps/index.html)

Reference earlier step results:

```
Step 1: npm test (output: 5 passed, 2 failed)
Step 2: echo "Test results: {step-1-result}"
Step 3: AI analyzes "{step-2-result}"
```

## [Safety & Reliability](/content/docs/automations#safety--reliability/index.html)

- **Automatic timeouts** — Commands that hang get stopped automatically
- **Error tracking** — See exactly what failed and why
- **Run history** — Review past automation runs anytime
- **Easy debugging** — Each step shows its output and any errors
- **Simple activation** — Turn automations on/off without deleting them

## [Managing Your Automations](/content/docs/automations#managing-your-automations/index.html)

| Action         | How to do it                       |
|----------------|------------------------------------|
| View all       | Go to **Automations** view         |
| Create new     | Use `/automation` slash command    |
| Edit           | Click **Edit** on any automation    |
| Run now        | Click **Run manually** button      |
| Change schedule | Edit the automation details        |
| View history   | See all past runs and results     |
| Delete         | Remove automations you no longer need|

## [Tips](/content/docs/automations#tips/index.html)

- **Start simple** — Begin with a single command, then add AI analysis
- **Chain results** — Use outputs from one step as input to the next
- **Schedule wisely** — Don't run automations too frequently (saves resources)
- **Test first** — Run manually before setting up a schedule
- **Review results** — Check automation run history to catch issues early
