/samocode:testingfrom samocode
Tests the specific feature or bug fix implemented in the current session using browser (Playwright/Puppeteer) or API tools (curl/httpie). Includes worktree guard to prevent project file mutations.
Ships in samocode. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Tests the specific feature or bug fix implemented in the current session. NOT full E2E testing - focused on the session's work.
Read session context:
_overview.md to understand what was implementedWorktree guard (every run): The worker snapshots project HEAD and
git status --porcelain before and after each testing iteration. Never edit,
generate, format, or commit tracked project files; if a build touches a tracked file,
restore it before signaling (git checkout -- <path>). Only untracked, temporary, or
user-level configuration may change; put reports and screenshots under SESSION_PATH.
A mutated iteration is rejected as workflow_error — a mutation is a violation, never
a route. Non-git working dirs skip the guard with a notice. Final Comment Hygiene
already made the last allowed project mutation before the post-quality regression run.
Determine test strategy:
Select browser testing tool (if frontend testing needed):
Default: playwright-cli — use the playwright-cli skill. It handles auth, screenshots, clicks, form fills, route mocking, and extraction via a single CLI. First choice for all E2E work in this environment.
Backup: Puppeteer via bash — use only if playwright-cli is unavailable (missing install, broken Chromium, or the scenario specifically needs Puppeteer APIs).
| Tool | Role | When to use |
|---|---|---|
| playwright-cli | Primary | All E2E: auth flows, clicks, screenshots, network mocking, extraction |
Puppeteer (npx puppeteer) | Backup | Only if playwright-cli is unavailable or unsuitable |
| chrome-devtools MCP | Niche | Live console/network inspection when driving a human-operated browser |
Recommendation: Start with playwright-cli. Fall back to Puppeteer only with a stated reason.
If adding MCP (e.g., chrome-devtools): After modifying .mcp.json, signal continue to restart the agent process (MCP doesn't hot-reload).
Start the application from THIS worktree:
.samocode file or README for startup instructions.blocked with needs: "environment" and cite the commands.Execute feature tests:
Browser E2E is MANDATORY when implementation touched frontend files (any *.tsx/*.ts/*.jsx/*.js/*.css in the project's frontend directories). Deferring to "human verification" or to a "manual" phase in the plan is NOT allowed — regardless of what the plan labels it.
Required per FE-touching session:
[SESSION_PATH]/_screenshots/[NN]-[view-slug].png. At minimum: default state, post-interaction state, one edge case.Mock data: if the feature needs data density (lists, charts, timelines, pagination), seed it via the project's existing scripts or fixtures (check the project README, seed/fixture directories, or database*/scripts/). Empty states alone are not sufficient coverage.
API testing:
# Example: Test endpoint
curl -X POST http://localhost:8000/api/endpoint \
-H "Content-Type: application/json" \
-d '{"test": "data"}'
Smoke test (side effect):
Document results:
Create [SESSION_PATH]/[TIMESTAMP_FILE]-test-report.md:
# Test: [feature name]
Date: [TIMESTAMP_LOG]
Run: [1st (post-implementation) | 2nd (post-quality)]
Result: PASS | FAIL
Tested HEAD: [full SHA, required for the 2nd run]
## What Was Tested
[Brief description of implemented feature]
## Test Environment
- Working Dir: [path]
- App Status: [running/failed to start]
- Testing Tools: [playwright-cli/puppeteer/chrome-devtools/curl]
## Test Steps
1. [Step and result]
2. [Step and result]
...
## Results
- Feature Test: [PASS/FAIL]
- Smoke Test: [PASS/FAIL]
## Issues Found
[None or list of issues]
Use exactly one listed Run value with no added qualifier. Tested HEAD must
be the plain, full 40-character SHA with no Markdown backticks.
Update session:
_overview.md:
- [TIMESTAMP_ITERATION] Feature tested: [result] -> [filename].md- [filename].md - Test reportcd [SESSION_DIR] && git add . && git commit -m "Test: [feature]"Signal result:
continue to qualitycontinue to
PR readinessblocked with needs: "error_resolution"
and failure details (don't auto-fix)blocked with needs: "environment" and cite the reproducible commands
that demonstrate it. An unavailable browser/app after documented retries is an
environment blocker, NOT human_decision, unless a genuine human choice is
required. The worker escalates testing once to the next semantic profile before
surfacing an environment blocker to a human.environment blocker instead of
signaling continue.Invoke the playwright-cli skill. It handles browser automation via a single CLI — navigate, click, fill, screenshot, extract, and route-mock without writing a driver script. On hosts where the bundled Chromium is missing or unsuitable, configure .playwright/cli.config.json with an executablePath pointing at a system Chromium and any required launch flags (e.g. --no-sandbox).
Use only when playwright-cli is unavailable or the scenario needs Puppeteer-specific APIs (e.g. CDP access patterns that playwright-cli doesn't expose). State the reason for the fallback in the test report.
# Quick test script
npx puppeteer <<'EOF'
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
await page.goto('http://localhost:3000');
// ... test steps
await browser.close();
})();
EOF
Useful when you need to inspect a live, human-operated session (console, network tab) rather than drive the browser yourself. Add to .mcp.json:
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": ["chrome-devtools-mcp@latest", "--headless=true"]
}
}
}
Then signal continue to restart with new MCP.
_overview.md -> Check project .samocode file for MAIN_REPO, or ask userblocked with needs: "environment" and cite the reproducing commandsneeds: "environment"), never a silent skipWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (yuvasee/samocode) — no native marketplace selected
npx claudepluginhub p/yuvasee-samocode20 skills in this plugin
/claudeRun Anthropic Claude CLI as a subagent for second opinions, code reviews, and questions. Use from a Codex (or other) session when you want Claude's perspective./code-clarityReview changed code for human comprehension cost — names, local reasoning, hidden state, working-memory load — and report findings with an impact/cost/risk assessment table. Review-only; never modifies code. Use when asked for a clarity review, readability review, comprehension-cost analysis of a diff/PR, or when running /code-clarity. Works in Claude Code and Codex./codexRun OpenAI Codex CLI as a subagent for second opinions, code reviews, and questions. Use when you want a different AI model's perspective./comment-hygieneCurate source-code comments and docstrings — delete AI-slop and stale comments, keep only the non-obvious WHY, and never change executable code. Use when cleaning up comments/docstrings, during a samocode cleanup or quality-review step, when running /comment-hygiene, or when reviewing a diff for comment quality. Works in Claude Code and Codex./companionStart and supervise Samocode while the parent does independent scoped work and maintains a human-readable HTML explanation in the session. Use when asked to run Samocode with a live walkthrough, companion, or parallel parent work; not for a standalone status query./create-pr-commentsCreate GitHub PR review comments from review findings. Use after running a code review to post findings as line-bound comments.Other plugins' skills for the same job