Get the FREE Ultimate OpenClaw Setup Guide →

test

npx machina-cli add skill brsbl/ottonomous/test --openclaw
Files (1)
SKILL.md
3.1 KB

Arguments: $ARGUMENTS

CommandBehavior
runLint + type check + run tests
writeGenerate tests, then run pipeline
browserVisual verification
allrun + browser combined

Scope (optional, default: branch):

ScopeCommand
branchgit diff main...HEAD --name-only
stagedgit diff --cached --name-only

Run Mode

1. Detect Tools

ConfigToolCommand
package.json + vitestVitestnpx vitest run
package.json + jestJestnpx jest
package.json + "test"npmnpm test
pyproject.tomlpytestpytest
Cargo.tomlcargocargo test
go.modgogo test ./...
.eslintrc* / eslint.config.*ESLintnpx eslint .
biome.jsonBiomenpx biome check .
tsconfig.jsonTypeScriptnpx tsc --noEmit

2. Setup (if missing)

# JS/TS test runner
npm install -D vitest

# JS/TS linter
npm install -D eslint @eslint/js

# JS/TS types
npm install -D typescript && npx tsc --init

# Python
pip install pytest ruff mypy

3. Run Pipeline

# 1. Lint
npx eslint . --fix  # or: npx biome check . --write

# 2. Type check
npx tsc --noEmit    # or: mypy .

# 3. Test
npx vitest run      # or: pytest, cargo test, go test ./...

Fix errors, re-run until all pass.


Write Mode

1. Get Changed Files

git diff main...HEAD --name-only  # branch scope
git diff --cached --name-only     # staged scope

Filter to source files (exclude tests, configs, docs).

2. Launch Test Writers

Hand off files to test-writer subagents. They determine testability and write tests.

FilesSubagents
1-31
4-82-3
9+3-5
// Task tool
{
  subagent_type: "test-writer",
  prompt: "Write tests for: [file list]. Runner: vitest. Convention: *.test.ts"
}

3. Run Pipeline

Same as Run Mode step 3.


Browser Mode

Visual verification using browser automation. See /browser skill for full API.

import { connect, waitForPageLoad } from '../otto/lib/browser/client.js'

const client = await connect({ headless: true })
const page = await client.page('test')

// Determine URL from package.json scripts or running processes
await page.goto(url)  // e.g., http://localhost:5173
await waitForPageLoad(page)
await page.screenshot({ path: '.otto/test-screenshots/page.png' })

// Interact using ARIA snapshot refs
const snapshot = await client.getAISnapshot('test')
const btn = await client.selectSnapshotRef('test', 'e3')
await btn.click()

await client.disconnect()

After completing browser verification, remove screenshots:

rm -rf .otto/test-screenshots

All Mode

  1. Run Mode (lint, type check, test)
  2. Browser Mode (visual verification)
  3. Report results

Source

git clone https://github.com/brsbl/ottonomous/blob/main/skills/test/SKILL.mdView on GitHub

Overview

The test skill orchestrates linting, type checking, tests, and optional visual verification across Run, Write, Browser, and All modes. It auto-detects the project tooling (Vitest, Jest, pytest, cargo, ESLint, and more) and runs the appropriate commands.

How This Skill Works

It inspects config files (e.g., package.json, pyproject.toml, tsconfig.json) to pick a test runner, installs missing tooling per Setup, and then executes lint, type check, and tests in order. In Browser mode, it uses a browser client to perform visual checks and capture snapshots; in Write mode, it hands off changed files to test-writer subagents before running the pipeline.

When to Use It

  • After making code changes, run lint, type checks, and tests to validate impact.
  • Use Write mode to generate tests with test-writer subagents.
  • Use Browser mode for visual verification of UI flows.
  • Use All mode to run lint, type check, tests, and browser checks in one pass.
  • Validate multi-language projects by auto-detecting appropriate tools (JS/TS, Python, Rust, Go).

Quick Start

  1. Step 1: Detect tooling in your repo (package.json, pyproject.toml, tsconfig.json).
  2. Step 2: Run the desired mode (e.g., Run: lint + type check + tests; Write: generate tests; Browser: visual checks).
  3. Step 3: Review results; in Write mode, hand files to test-writers and re-run.

Best Practices

  • Ensure the repository contains known configs (e.g., vitest, pytest, eslint, tsconfig.json) so tools can be auto-detected.
  • Install missing tooling as shown in the Setup section before running.
  • Run lint with --fix where possible (npx eslint . --fix or biome check . --write).
  • Separate lint, type check, and tests during development to reduce feedback time.
  • For Browser mode, prepare and review ARIA snapshot refs and UI interactions.

Example Use Cases

  • Node/TS project using Vitest, ESLint, and TypeScript
  • Python project with pytest, ruff, and mypy
  • Rust project with cargo test
  • Go project with go test ./...
  • JS project using Jest and TypeScript type checks

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers