Skip to main content

Overview

Stably CLI is an AI agent that can control a browser — it navigates pages, fills forms, clicks buttons, and interacts with your application just like a real user. This makes it a powerful sub-agent for Claude Code when you need to:
  • Validate that a feature actually works in the browser
  • Create end-to-end tests by interacting with your live application
  • Debug and fix failing tests with real browser context
Claude Code itself cannot control browsers, but by using Stably as a sub-agent, it gains the ability to verify features, generate tests, and maintain your test suite — all through real browser interactions.

Setup

Install the Stably agent skills to teach Claude Code how to use Stably CLI:
npx skills add stablyai/agent-skills
Once installed, Claude Code automatically knows when to invoke Stably. When you request tasks that require browser interaction (like “verify the login works” or “create tests for checkout”), Claude Code will recognize this and spawn Stably as a sub-agent to handle the browser automation. You can also explicitly ask Claude Code to use Stably:
“Use Stably to test the signup flow” “Run Stably to verify the payment form works”

Usage Patterns

1. Validate a New Feature

Use Stably to validate that a feature works correctly without saving the test. This is useful for quick verification during development.
stably create "verify the login form accepts valid credentials and shows an error for invalid ones" --no-save
Or instruct Claude Code with a prompt like:
“Use Stably to validate that the new checkout flow works, but don’t save the test”
The agent will run stably create with instructions to validate the feature and report results without persisting test files.
You: Validate that the new user registration form works correctly

Claude Code (invoking Stably sub-agent):
  → Running: stably create "validate user registration form -
     check required fields, email validation, password requirements,
     and successful submission" --no-save

  ✓ Validation complete:
    • Required field validation: PASS
    • Email format validation: PASS
    • Password requirements: PASS
    • Form submission: PASS

  The registration feature is working as expected.

2. Create New Tests

Generate and save Playwright tests for new features or existing functionality.
stably create "comprehensive tests for the shopping cart - add items, update quantities, remove items, apply discount codes"
The prompt is optional. When omitted, Stably automatically analyzes the current PR (in CI) or git diffs against origin/HEAD (locally) to generate relevant tests.
Or ask Claude Code:
“Create tests for the payment processing flow”
The agent will invoke stably create to generate test files in your project’s test directory.
You: Create tests for the dashboard analytics widgets

Claude Code (invoking Stably sub-agent):
  → Running: stably create "tests for dashboard analytics widgets -
     verify data loading, chart rendering, date range filtering,
     and export functionality"

  Created files:
  - tests/dashboard-analytics-data-loading.spec.ts
  - tests/dashboard-analytics-charts.spec.ts
  - tests/dashboard-analytics-filters.spec.ts
  - tests/dashboard-analytics-export.spec.ts

  ✓ 4 test files generated covering the dashboard analytics features.

3. Run and Fix Tests

Execute tests and automatically fix failures using AI-powered analysis.
# Run tests
stably test

# If failures occur, fix them automatically
stably fix
Or ask Claude Code:
“Run the tests and fix any failures”
The agent will execute stably test, analyze any failures, and apply fixes with stably fix.
You: Run all tests and fix any issues

Claude Code (invoking Stably sub-agent):
  → Running: stably test

  Test Results: 47 passed, 3 failed

  → Running: stably fix

  Analyzing 3 failures...

  checkout.spec.ts > apply discount code
    Issue: Selector '.discount-input' not found
    Fix: Updated to '[data-testid="promo-code-field"]'
    ✓ Fixed

  user-profile.spec.ts > update avatar
    Issue: File upload timeout
    Fix: Increased timeout and added wait for upload complete
    ✓ Fixed

  navigation.spec.ts > mobile menu
    Issue: Element not visible in viewport
    Fix: Added scroll into view before interaction
    ✓ Fixed

  ✓ All 3 failures auto-fixed. Re-running verification...
  → Running: stably test

  Test Results: 50 passed, 0 failed

Sub-Agent Commands Reference

TaskCommandDescription
Validate featurestably create ["<description>"] --no-saveTest a feature without saving files
Create testsstably create ["<description>"]Generate tests from prompt, PR context, or git diffs
Run testsstably testExecute the test suite
Fix failuresstably fixAuto-repair failing tests
Run and fixstably test || stably fixRun tests, fix if failures occur

Best Practices

When asking Claude Code to work with Stably, be specific about what you want to test. Include:
  • The feature or flow to test
  • Edge cases to cover
  • Whether to save or just validate

Effective Prompts

GoodWhy
”Create tests for user authentication including login, logout, password reset, and session timeout”Specific scope with clear test scenarios
”Validate the new API integration works with valid and invalid responses”Clear validation goal without saving
”Run tests for the checkout module and fix any selector issues”Targeted scope with expected fix type

Integration Tips

  1. Use validation first — Before committing a feature, ask Claude Code to validate it with Stably. This catches issues early without cluttering your test suite.
  2. Batch test creation — When adding multiple features, create tests for all of them in one request to maintain consistent coverage.
  3. Automate fix cycles — For flaky tests, use the run-and-fix pattern to automatically heal tests during development.

Next Steps