> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stably.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart: Stably CLI

> Set up the CLI, generate your first test with AI, run it, and auto-fix failures.

<Tip>
  Browser-backed agent commands can run in a Stably-hosted browser with `--browser=cloud` or `STABLY_CLOUD_BROWSER=1`. See [Cloud Browsers for Stably CLI](/stably-cli/cloud-browser).
</Tip>

## Prerequisites

* Node 20+ and npm
* Playwright available in the project (`npx stably install` if you're starting fresh)
* Stably account: Signup at [app.stably.ai](https://forms.stably.ai/sign-up) or grab an API key from **Settings → API Keys**

## Installation

Install the Stably CLI globally:

```bash theme={null}
npm install -g stably
```

Verify the installation:

```bash theme={null}
stably --version
```

<Note>
  You can also use `npx stably` without global installation if you prefer. The commands below will work with both approaches. To see all available commands, run `stably --help`.
</Note>

### Install CLI Skill (Recommended)

If you're using an AI coding agent (e.g., Claude Code, Cursor), install the Stably CLI skill for the best experience:

```bash theme={null}
npx skills add https://github.com/stablyai/agent-skills --skill stably-cli
```

## Step-by-step

<Steps>
  <Step title="Initialize your project">
    ```bash theme={null}
    stably init
    ```

    Set up Playwright and the Stably SDK in your project. If you're not logged in, authentication will be handled automatically via browser. The AI agent will install dependencies, configure `playwright.config.ts`, and set up the Stably reporter.
  </Step>

  <Step title="Create tests with AI">
    ```bash theme={null}
    stably create [prompt]
    ```

    Create tests from a prompt, or omit the prompt to automatically analyze:

    * **PR changes** — when running in CI with PR context
    * **Git diffs** — changes against `origin/HEAD` when running locally

    If you want the agent to use a Stably-hosted browser:

    ```bash theme={null}
    stably create [prompt] --browser=cloud
    ```
  </Step>

  <Step title="Run tests locally">
    ```bash theme={null}
    stably test
    ```

    Stably executes your test suite and provides detailed results with run IDs for any failures.
  </Step>

  <Step title="Fix failing tests">
    ```bash theme={null}
    stably fix
    ```

    Diagnose failures and apply AI fixes automatically. The run ID is auto-detected from your last `stably test` run.
  </Step>
</Steps>

## What you get

* Playwright and Stably SDK configured in your project
* Playwright tests created with AI assistance, ready for version control
* Automated fixes for test failures, locally or in the cloud
* Optional cloud-browser mode for browser-backed CLI agents

## Next steps

<Card title="CLI guide" icon="terminal" href="/stably-cli/commands">
  Explore commands, agent workflows, and maintenance tools
</Card>

<Card title="Plan Coverage" icon="list-check" href="/stably-cli/plan">
  Optional: discover coverage gaps and generate `test.fixme()` plan files
</Card>

<Card title="Cloud Browsers for CLI" icon="cloud" href="/stably-cli/cloud-browser">
  Run `stably`, `create`, `fix`, and `verify` in a Stably-hosted browser
</Card>
