|
| 1 | +--- |
| 2 | +title: checkly init |
| 3 | +description: 'Initialize Checkly in your project with interactive or AI-assisted onboarding.' |
| 4 | +sidebarTitle: 'checkly init' |
| 5 | +--- |
| 6 | + |
| 7 | +<Note>Available since CLI v7.8.0.</Note> |
| 8 | + |
| 9 | +The `checkly init` command sets up Checkly in your project. It detects your project's existing configuration — package.json, Playwright, and Checkly config files — and walks you through the setup accordingly. |
| 10 | + |
| 11 | +You can set up Checkly manually or let your AI coding agent handle the configuration. The command adapts its behavior based on the environment: interactive terminals get guided prompts, CI environments get non-interactive setup, and AI agents receive structured output. |
| 12 | + |
| 13 | +<Accordion title="Prerequisites"> |
| 14 | +Before using `checkly init`, ensure you have: |
| 15 | + |
| 16 | +- Node.js installed |
| 17 | +- A project directory (an existing `package.json` is optional — the command can create one) |
| 18 | + |
| 19 | +No existing Checkly account or configuration is required. |
| 20 | +</Accordion> |
| 21 | + |
| 22 | +## Usage |
| 23 | + |
| 24 | +```bash Terminal |
| 25 | +npx checkly init [options] |
| 26 | +``` |
| 27 | + |
| 28 | +| Option | Required | Description | |
| 29 | +|--------|----------|-------------| |
| 30 | +| `--target, -t` | - | Install the Checkly skill for a specific AI agent platform. | |
| 31 | + |
| 32 | +## Command Options |
| 33 | + |
| 34 | +<ResponseField name="--target, -t" type="string"> |
| 35 | + |
| 36 | +Install the [Checkly agent skill](/ai/skills) for a specific AI agent platform. Available platforms: `claude`, `cursor`, `windsurf`, `github-copilot`, `gemini-cli`, `codex`, `amp`. |
| 37 | + |
| 38 | +**Usage:** |
| 39 | + |
| 40 | +```bash Terminal |
| 41 | +npx checkly init --target=claude |
| 42 | +npx checkly init -t cursor |
| 43 | +``` |
| 44 | + |
| 45 | +</ResponseField> |
| 46 | + |
| 47 | +## What to Expect |
| 48 | + |
| 49 | +The `init` command detects your project context and adjusts its flow: |
| 50 | + |
| 51 | +- **No `package.json`** — prompts you to create one before continuing. |
| 52 | +- **No Checkly config** — creates a `checkly.config.ts` and installs `checkly` and `jiti` as dev dependencies. |
| 53 | +- **Playwright detected** — provides context-aware setup that accounts for your existing test infrastructure. |
| 54 | +- **Existing Checkly project** — refreshes your agent skill to the latest version. |
| 55 | + |
| 56 | +### AI-Assisted Setup |
| 57 | + |
| 58 | +When you choose the AI-assisted path (or pass `--target`), the command: |
| 59 | + |
| 60 | +1. Installs the [Checkly agent skill](/ai/skills) for your platform |
| 61 | +2. Creates a `checkly.config.ts` if one doesn't exist |
| 62 | +3. Installs dependencies |
| 63 | +4. Generates a starter prompt you can paste into your AI agent to begin configuring checks |
| 64 | + |
| 65 | +<Tip>The starter prompt gives your AI agent all the context it needs about your project and Checkly's capabilities. Copy it into your agent's chat to start creating checks.</Tip> |
| 66 | + |
| 67 | +### Manual Setup |
| 68 | + |
| 69 | +When you choose the manual path, the command: |
| 70 | + |
| 71 | +1. Creates a `checkly.config.ts` if one doesn't exist |
| 72 | +2. Installs dependencies |
| 73 | +3. Optionally copies example checks (API, browser, heartbeat, URL monitor) into a `__checks__` directory |
| 74 | + |
| 75 | +### CI Mode |
| 76 | + |
| 77 | +In CI environments (when `CI=true`), the command runs non-interactively and outputs setup instructions. |
| 78 | + |
| 79 | +```bash Terminal |
| 80 | +CI=true npx checkly init |
| 81 | +``` |
| 82 | + |
| 83 | +## Examples |
| 84 | + |
| 85 | +```bash Terminal |
| 86 | +# Interactive setup |
| 87 | +npx checkly init |
| 88 | + |
| 89 | +# Set up with Claude Code agent skill |
| 90 | +npx checkly init --target=claude |
| 91 | + |
| 92 | +# Non-interactive CI setup |
| 93 | +CI=true npx checkly init |
| 94 | +``` |
| 95 | + |
| 96 | +## Next Steps |
| 97 | + |
| 98 | +After initialization, the typical workflow is: |
| 99 | + |
| 100 | +1. **Log in** — `npx checkly login` to authenticate with your Checkly account |
| 101 | +2. **Test** — `npx checkly test --record` to dry-run your checks |
| 102 | +3. **Deploy** — `npx checkly deploy` to deploy checks to Checkly |
| 103 | + |
| 104 | +## Related Commands |
| 105 | + |
| 106 | +- [`checkly skills`](/cli/checkly-skills) - Print project context and install agent skills |
| 107 | +- [`checkly login`](/cli/checkly-login) - Log in to your Checkly account |
| 108 | +- [`checkly deploy`](/cli/checkly-deploy) - Deploy checks to Checkly |
0 commit comments