sg-record
/sg-record — Macro Recorder
Record your browser interactions and convert them into replayable ShipGuard YAML test manifests. Like Excel's macro recorder, but for visual testing.
Pipeline Position
sg-visual-discover (auto) ──┐
├──► manifests/ ──► sg-visual-run ──► sg-visual-review ──► sg-visual-fix
sg-record (human) ───┘
sg-discover scans code to auto-generate tests. sg-record captures what a human does manually. Both produce the same YAML format — zero changes to the rest of the pipeline.
Invocations
| Command | Behavior |
|---|---|
/sg-record http://localhost:6969 |
Open recorder on the given URL |
/sg-record http://localhost:6969 --name login-flow |
Record with a preset manifest name |
/sg-record http://localhost:6969 --storage auth.json |
Skip login by loading saved auth state |
/sg-record --save-storage auth.json |
Save auth state after recording (for reuse) |
How It Works
1. Launch
Run the recorder script:
node visual-tests/sg-record.mjs <url> [--name <name>] [--storage <auth.json>]
This opens a Playwright Chromium browser targeting the URL with a floating recording toolbar injected in the bottom-right corner.
2. Record
The user navigates the app normally. Every interaction is captured automatically:
| User action | Recorded as |
|---|---|
| Click a button/link | action: click, target: "Button text" |
| Fill an input field | action: fill, target: "Field label", value: "typed text" |
| Select a dropdown option | action: select, target: "Label", value: "Option" |
| Upload a file | action: upload, file: "filename.pdf" |
| Navigate to a new page | action: open, url: "/new-page" |
3. Toolbar Controls
The floating toolbar shows recorded steps in real-time:
| Control | What it does |
|---|---|
| Step list | See every recorded action, scrollable |
| Undo | Remove the last step (repeatable) |
| Delete (x) | Remove a specific step without affecting others |
| Pause / Resume | Stop recording temporarily (navigate freely without capturing) |
| Check | Mark an element as an assertion (see below) |
| Stop | End recording, save manifest |
| Minimize | Collapse toolbar to a compact bar |
4. Check Mode (Assertions)
Click Check to enter assertion mode:
- Toolbar border turns amber
- Hover over elements to see what will be captured (amber highlight)
- Click on the element you want to verify
- The recorder captures its text content as an
assert_textstep - If the text is long (>80 chars), it becomes an
llm-checkinstead (AI judges the assertion at replay time) - A screenshot is auto-captured at each check point
- Check mode deactivates after one capture
5. Stop and Save
Click Stop in the toolbar:
- If no
--namewas given, the recorder asks for a manifest name - Actions are converted to ShipGuard YAML format
- Manifest saved to
visual-tests/manifests/recorded-<name>.yaml - Terminal shows the command to replay:
sg-visual-run --manifests manifests/recorded-<name>.yaml
Output Format
The recorder produces standard ShipGuard YAML manifests:
name: "login-flow"
description: "Recorded session — login-flow"
priority: medium
requires_auth: false
timeout: 60s
tags: [recorded]
source: recorded
recorded_at: "2026-04-11T14:30:00Z"
steps:
- action: open
url: "{base_url}/login"
- action: fill
target: "Nom d'utilisateur"
value: "vlad"
- action: fill
target: "Mot de passe"
value: "loic"
- action: click
target: "Se connecter"
- action: assert_text
expected: "Tableau de bord"
screenshot: "login-flow-check-1.png"
- action: screenshot
path: "login-flow-check-1.png"
The source: recorded field distinguishes recorded manifests from auto-generated ones (source: discovered).
Test Library in Review Page
Recorded manifests appear as cards in a dedicated "Recorded Tests" tab in the review page (/sg-visual-review):
- Each card shows: name, step summary, step count, check count, recording date
- Select one or multiple cards
- Click "Run N tests" to get the CLI command for
sg-visual-run - Results appear in the existing Visual Tests tab after execution
Authentication
Playwright opens a fresh Chromium — the user is not logged in by default.
- Without
--storage: Login manually during recording. Login steps become part of the manifest. - With
--storage auth.json: Load saved cookies/localStorage to skip login. - First time: Use
--save-storage auth.jsonto capture auth state after logging in. Reuse with--storage auth.jsonon subsequent recordings.
Execution Steps for the Skill
When the user invokes /sg-record, follow ALL steps in order. Do NOT skip any step.
Step 1: Parse arguments
Parse the URL from the user's input. If missing, ask: "What URL do you want to record on?"
Store any flags: --name, --storage, --save-storage.
Step 2: Bootstrap — Install recorder files into the project
The recorder runtime files ship with this plugin. They must be copied to the target project's visual-tests/ directory before first use.
Determine the plugin skill directory. This is the directory containing THIS SKILL.md file. It is shown in the "Base directory for this skill" header when the skill loads. Store it as SKILL_DIR.
Check if recorder is already installed:
test -f visual-tests/sg-record.mjs && echo "INSTALLED" || echo "NOT_INSTALLED"
If NOT_INSTALLED, copy all recorder files from the plugin:
mkdir -p visual-tests/lib visual-tests/manifests
# Copy from this skill's directory (SKILL_DIR)
cp "${SKILL_DIR}/sg-record.mjs" visual-tests/
cp "${SKILL_DIR}/lib/actions-to-yaml.mjs" visual-tests/lib/
cp "${SKILL_DIR}/lib/recorder-toolbar.js" visual-tests/lib/
cp "${SKILL_DIR}/lib/recorder-toolbar.css" visual-tests/lib/
cp "${SKILL_DIR}/lib/actions-to-yaml.test.mjs" visual-tests/lib/
cp "${SKILL_DIR}/lib/integration-test.mjs" visual-tests/lib/
Also check the review page files (needed for the Recorded Tests tab):
test -f visual-tests/build-review.mjs && echo "REVIEW_INSTALLED" || echo "REVIEW_NOT_INSTALLED"
If REVIEW_NOT_INSTALLED, copy from the sg-visual-review skill:
REVIEW_DIR="${SKILL_DIR}/../sg-visual-review"
cp "${REVIEW_DIR}/build-review.mjs" visual-tests/
cp "${REVIEW_DIR}/_review-template.html" visual-tests/
Print: Recorder files installed to visual-tests/
Step 3: Check Playwright
npx playwright --version 2>/dev/null
If the command fails, install Playwright:
npx playwright install chromium
If that also fails, tell the user: "Playwright is required for the recorder. Run: npx playwright install chromium" and stop.
Step 4: Check target URL is reachable
curl -s -o /dev/null -w "%{http_code}" --max-time 5 <url>
If not 200, warn the user but continue (they may want to record on a page that requires auth).
Step 5: Create config if missing
If visual-tests/_config.yaml does not exist, create a minimal one:
cat > visual-tests/_config.yaml << EOF
base_url: "<url_origin>"
EOF
Where <url_origin> is extracted from the user's URL (e.g., http://localhost:3000 from http://localhost:3000/dashboard).
Step 6: Launch the recorder
node visual-tests/sg-record.mjs <url> <flags>
Tell the user: "Browser is open. Navigate your app, click Check to mark verifications, click Stop when done."
Step 7: Wait and report
Wait for the process to complete (the user clicks Stop in the browser toolbar).
Report: manifest path, step count, and the command to replay.
Offer: "Want to run these tests now with /sg-visual-run? Or see all recordings with /sg-visual-review?"
File Structure (after bootstrap)
visual-tests/
sg-record.mjs # CLI entry point (copied from plugin)
lib/
recorder-toolbar.js # Injected toolbar (copied from plugin)
recorder-toolbar.css # Toolbar styles (copied from plugin)
actions-to-yaml.mjs # Conversion: actions → YAML (copied from plugin)
actions-to-yaml.test.mjs # Unit tests — 11 tests (copied from plugin)
integration-test.mjs # Pipeline smoke test (copied from plugin)
manifests/
recorded-*.yaml # Output from recordings (user-generated)
build-review.mjs # Review page builder (from sg-visual-review)
_review-template.html # Review page template (from sg-visual-review)
_config.yaml # Project config (base_url, credentials)
More from bacoco/shipguard
sg-scout
GitHub intelligence for ShipGuard — scans repos for code audit, debugging, and self-improving agent techniques, then files actionable improvement proposals. Use when you want to discover new approaches, benchmark against similar tools, or find inspiration for ShipGuard improvements. Trigger on "sg-scout", "scout github", "find skills", "benchmark shipguard", "veille technique", "competitive analysis", "what are others doing", "find improvements".
1sg-visual-fix
Process human-annotated Visual screenshots — analyze marked problem areas, trace to source code, implement fixes, capture before/after screenshots, and regenerate the review page with a comparison tab. Trigger on "sg-visual-fix", "fix annotated tests", "process review annotations", "visual fix", "fix les annotations", "traite la review".
1sg-improve
Auto-improve ShipGuard from real session learnings. Run this after any /sg-code-audit, /sg-visual-run, or debugging session. Analyzes what worked, what broke, and what was slow — saves project-specific learnings locally (zone sizing, patterns, infra timing) and files generic improvements as GitHub issues. The local learnings feed back into the next audit run automatically. Trigger on "sg-improve", "improve shipguard", "ameliore shipguard", "shipguard feedback", "session insights", "retex", "retrospective", "what did we learn".
1sg-visual-review
Generate an interactive HTML screenshot review page from Visual test results. Browse all test screenshots in a grid, filter by status/category, annotate problems with a pen tool, multi-select failed tests, and export re-run manifests. Trigger on "sg-visual-review", "visual review", "review screenshots", "show test results", "review visual", "visual-review", "show results", "test review".
1sg-code-audit
Parallel AI codebase audit — dispatches agents to find and fix bugs across the entire repo. Produces structured JSON results viewable in /sg-visual-review. Trigger on "sg-code-audit", "code audit", "audit codebase", "find bugs", "code-audit", "audit code", "static audit", "security audit", "ship guard".
1sg-visual-run
Execute Visual test manifests using agent-browser with hybrid scripted+LLM assertions. Accepts natural language to describe what to test or what changed — the skill finds and runs the right tests, generating missing ones if needed. Trigger on "sg-visual-run", "visual run", "run visual tests", "test regressions", "run tests", "visual-run", "check if the app works", "I changed X check it still works".
1