Agent skill

Testing Guide

by jmfederico in jmfederico/pi-web

Repository-specific testing guide. An agent skill from jmfederico/pi-web.

MITAuto-check passedTesting & QA

Install Testing Guide

skills CLI
$ npx skills add jmfederico/pi-web --skill testing-guide -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jmfederico/pi-web testing-guide --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jmfederico/pi-web.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/testing-guide .claude/skills/testing-guide && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
testing-guide
GitHub stars
861
Token cost
~2.6k tokens
SKILL.md length
1,371 words
Files
1
Skills in repo
7
Repo updated
First seen
Licence
MIT

At a glance

Repository-specific testing guide. An agent skill from jmfederico/pi-web.

  • Works in 3 steps: What meaningful failure does it catch? → What protection does it add beyond… → What is the smallest boundary that…
  • Any test work: planning coverage
  • SKILL.md covers Core principles, Decide whether a test adds…, Choosing the test layer and Test helpers and fakes, plus 2 more sections
  • Calls npm and npx

What it does

Testing Guide is an agent skill from jmfederico/pi-web. Repository-specific testing guide. Use for any test work: planning coverage, writing/fixing/reviewing Vitest tests, test helpers/fakes, failure triage, choosing test layers, and Lit UI tests, including the happy-dom DOM harness and TemplateResult handler extraction rules.

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Unit testing. It works with Vitest. The repository describes itself as: Web UI for Pi Coding Agent that keeps sessions alive in real workspaces. The licence is MIT.

When your agent uses it

  • Any test work: planning coverage
  • Writing/fixing/reviewing Vitest tests
  • Test helpers/fakes
  • Choosing test layers

Example prompts

  • “/testing-guide”

Requirements

  • Node.js

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. What meaningful failure does it catch?
  2. What protection does it add beyond existing tests, required delivery steps, or normal usage?
  3. What is the smallest boundary that proves the invariant?

What it can do on your machine

Read from SKILL.md and the folder at commit 15c13a4. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm
    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm and npx, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Testing Guide loads about 2.6k tokens when it runs. Until then it costs about 72 tokens; SKILL.md has 1,371 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~72
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jmfederico/pi-web at commit 15c13a4, republished under its MIT licence (© jmfederico). 1,371 words, ~2,565 tokens.

Download SKILL.mdSave it as .claude/skills/testing-guide/SKILL.md (or your agent's skills folder).
name
testing-guide
description
Repository-specific testing guide. Use for any test work: planning coverage, writing/fixing/reviewing Vitest tests, test helpers/fakes, failure triage, choosing test layers, and Lit UI tests, including the happy-dom DOM harness and TemplateResult handler extraction rules.

Testing guide

Use this skill for test-specific decisions in this repository. The goal is useful regression coverage without letting test helpers, mocks, or component harnesses become a second application that is harder to maintain than the code under test.

For production-code design and testability seams, also use the code-quality-architecture skill. This guide owns test strategy, test helper conventions, and UI test escape hatches.

Core principles

  • Test behavior and contracts that matter, not branches for their own sake.
  • Prefer the smallest layer that proves the behavior: pure helper, service, controller, route/API contract, component boundary, then broader integration.
  • Keep tests deterministic. Fake clocks, browser globals, filesystem/process/network boundaries, and hard-to-trigger errors when needed.
  • Assert observable outcomes: return values, state transitions, emitted calls/events, HTTP responses, rendered user-facing state, or durable side effects.
  • Avoid asserting incidental implementation details unless the selected gap is specifically about that implementation contract.
  • Keep setup readable. A small explicit fixture is better than a magical factory that hides the scenario.
  • Clean up global stubs, fake timers, DOM state, and pending promises so tests do not leak into one another.

Decide whether a test adds protection

Use three questions when adding or reviewing a test:

  1. What meaningful failure does it catch?
  2. What protection does it add beyond existing tests, required delivery steps, or normal usage?
  3. What is the smallest boundary that proves the invariant?

Apply these as a review habit:

  • Give each invariant one primary owner. For example, test validation cases at the service boundary and use a route test to prove HTTP wiring.
  • Assign compilation to typecheck/build and packaging contracts to delivery checks against already-built artifacts, such as public declarations and deployment URLs.
  • Rely on normal usage for obvious, recoverable workflow failures it reliably exposes. Automate protection where failures can escape notice, especially security, durable state, resource cleanup, and uncommon supported deployments.
  • Use real processes, sockets, or browsers when their behavior is the invariant; for example, verify process termination with a real child process.
  • Treat feedback time and fixture complexity as maintenance costs. Review slow additions and periodically consolidate overlapping coverage, preserving each meaningful invariant at its chosen boundary.
  • Prefer small explicit fixtures and controllable collaborators. Keep review proportional to the change rather than adding mandatory forms or new testing infrastructure.

Choosing the test layer

Prefer this order unless the behavior requires a higher layer:

  1. Pure helper/service tests for data shaping, validation, cache decisions, command construction, and conversion logic.
  2. Controller/runtime adapter tests for state orchestration, endpoint selection, cancellation, timers, and injected collaborators.
  3. Route/API contract tests for HTTP status mapping, path/query/body parsing, proxy allowlists, and compatibility contracts.
  4. Component-boundary tests for UI event wiring and rendered state. Prefer real DOM/custom-element interaction via the per-file happy-dom harness (see Lit component tests).
  5. Broad verification (npm run verify) when a change is cross-cutting, changes shared helpers/types, or before final merge review.

Do not jump to a broad UI or integration test just because it feels more realistic if a lower layer proves the same behavior with less noise and less flake risk.

Test helpers and fakes

  • Keep helpers local until reuse is clear. If a pattern appears in multiple files, consolidate deliberately rather than copy-pasting variants.
  • Type helpers and fakes strictly; avoid any unless the test is intentionally modeling an untyped external boundary.
  • Fake only the boundary needed for the scenario. Do not mock the unit under test or so many collaborators that the assertion stops proving real behavior.
  • Prefer controllable promises, fake timers, and explicit injected dependencies over sleeps or timing guesses.
  • Name helpers after the domain behavior they support, not the mechanics of the fake.

Lit component tests

Test Lit components through public/component boundaries, choosing the narrowest seam that proves the behavior, in this order:

  1. Pure exported seam for content, ordering, and composition logic: extract an exported pure function from the component (for example sessiondPanelNotices or chatQueuedMessageSections) and test that, rather than scraping rendered output.
  2. happy-dom harness for rendered state and real user-like interaction (see below).
  3. TemplateResult handler extraction only as a narrow legacy escape hatch (see its rule below).
happy-dom harness

happy-dom is the standard DOM environment for Lit component tests. It is a declared devDependency, opted into per file with a docblock on the first line of the test file:

ts
// @vitest-environment happy-dom

Keep the opt-in per file; never set a global environment in vitest.config.ts. Pure logic tests stay on the fast default node environment, and only DOM-touching tests pay the harness cost.

Use the harness for what the node environment cannot provide and the extraction escape hatch forbids: rendered shadow-DOM state, real events (click(), dispatchEvent), focus and activeElement, native form semantics (radio/checkbox grouping, checked), and ARIA wiring such as aria-describedby or aria-live. Instantiate the component, set properties per its contract, append it to document.body, and interact with the rendered controls instead of invoking Lit handlers.

happy-dom is not a browser. Do not assert layout, styling, visual state, real scroll geometry, or IntersectionObserver/ResizeObserver behavior with it. Stub missing APIs at the boundary — spy on Element.prototype.scrollIntoView, stub window.matchMedia — and assert the calls, not geometry.

Conventions:

  • Clean up in afterEach: document.body.replaceChildren() and localStorage.clear() so DOM and storage state do not leak between tests.
  • Await element.updateComplete after property changes or events before asserting; await it twice when the component schedules another render from within updated(), so any follow-up render has settled.
  • Assert user-visible rendered state or controller calls caused by the interaction, not Lit internals.
Show full SKILL.md (472 more words)Show less
TemplateResult event-handler extraction rule

Lit TemplateResult event-handler extraction means calling render(), inspecting the returned template's strings/values, finding an event handler near a marker, and invoking that handler directly. It is a legacy escape hatch, not the default: with the happy-dom harness available, the "render harness impractical" precondition below rarely holds, so rule out the pure-seam and happy-dom options before reaching for extraction.

Use TemplateResult handler extraction only when all of these are true:

  1. The test is specifically verifying Lit template event wiring.
  2. A happy-dom render would add disproportionate setup, flakiness, or noise for the behavior being checked — rare now that the harness exists, so justify it in the required comment.
  3. The assertion checks observable component/controller effects, not Lit internals.
  4. The lookup is anchored to stable semantic markup, labels, or user-facing text rather than incidental handler order.
  5. The test stays narrow; it is not trying to cover a full user flow, accessibility behavior, or visual/layout behavior.

Do not use TemplateResult handler extraction for:

  • general content assertions;
  • styling, layout, focus, keyboard navigation, or accessibility behavior;
  • broad user flows where real DOM events are the point;
  • scenarios with an existing public controller/service/helper seam;
  • copying a new ad hoc helper variant into another file without reviewing whether the shared helper or the happy-dom harness is now warranted.

When using this escape hatch:

  • Add a short comment above the helper or test explaining why direct handler extraction is proportionate.
  • Prefer the shared, type-guarded helpers in src/client/src/templateInspection.testSupport.ts; keep any genuinely file-specific lookup small and type-guarded rather than copying new variants.
  • Anchor searches to stable semantic markers such as accessible labels, button text, ids intentionally used by the component, or nearby form markup.
  • Assert the behavior caused by the handler, such as state changes or calls to injected callbacks/controllers.
  • Avoid assertions about the exact shape of Lit's private data beyond the minimum needed to find the handler; fail with clear errors if the template cannot be inspected.

Existing extraction tests are acceptable as-is. Convert them to a pure seam or the happy-dom harness opportunistically when the file is touched for other reasons; do not run a big-bang migration.

Checks to run

Delivery artifact checks are separate from the ordinary suite: run npm run build followed by npm run check:artifacts when changing emitted package contracts. The latter consumes the existing dist output and never refreshes it. See development and delivery checks for check ownership.

Run the narrowest meaningful check first:

  • Changed test file: npm test -- --run <test-file>.
  • Source or exported type changes: also run npm run typecheck.
  • Non-trivial test helper, component, or lint-sensitive changes: run npx eslint <changed-file> or npm run lint when broader lint coverage is needed.
  • Cross-cutting changes or final merge review: prefer npm run verify.

Record exact commands and results when working under relay/audit workflows or when handing work to another agent.

© jmfederico, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/testing-guide of jmfederico/pi-web.

Open the folder on GitHubat commit 15c13a4

Compare with similar skills

Testing Guide next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Testing Guide compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Testing Guide this skilljmfederico/pi-web861—~2.6kAutomated safety check: PassMIT
Test Writing WorkflowiOfficeAI/AionUi33k1 repos~1.2kAutomated safety check: PassApache-2.0
Test GuardamElnagdy/guard-skills1.3k2 repos~2.1kAutomated safety check: PassMIT
Adding LLM MCP ToolsTriliumNext/Trilium38k—~2.5kAutomated safety check: PassAGPL-3.0
Concept Page Test Writerleonardomso/33-js-concepts67k—~5.5kAutomated safety check: PassMIT
Archestra Dev Testingarchestra-ai/archestra4.3k—~3.2kAutomated safety check: PassCustom licence

Similar skills

  • Test Writing Workflow

    iOfficeAI/AionUi

    Sets the test-writing workflow for the repository: risk-first scenario lists, behavior-focused Vitest tests, a full run before each commit and a coverage target.

    33k GitHub starsUsed in 1 repo~1.2k tokens
    Testing & QAAuto-check passed
  • Test Guard

    amElnagdy/guard-skills

    Reviews newly written or edited tests against nine rules that cut test bloat, such as mock-heavy checks and near-duplicate cases, before they are committed.

    1.3k GitHub starsUsed in 2 repos~2.1k tokens
    Testing & QAAuto-check passed
  • Adding LLM MCP Tools

    TriliumNext/Trilium

    A skill your agent uses when adding, changing, or reviewing an LLM/MCP tool in Trilium (the defineTools definitions under packages/trilium-core/src/services/llm/tools/ —…

    38k GitHub stars~2.5k tokensUpdated today
    Testing & QAAuto-check passed
  • Concept Page Test Writer

    leonardomso/33-js-concepts

    Generates Vitest tests for every runnable code example on a JavaScript concept documentation page, following a four-phase extraction and conversion process.

    67k GitHub stars~5.5k tokensUpdated 27 days ago
    Testing & QAAuto-check passed
  • Archestra Dev Testing

    archestra-ai/archestra

    A skill your agent uses for test selection and quality across backend, frontend, and e2e; load its backend reference for Vitest projects, mocking, DB fixtures, and performance.

    4.3k GitHub stars~3.2k tokensUpdated today
    Testing & QAAuto-check passed
  • Vitest

    pixel-point/animate-text

    Vitest testing framework patterns for test setup, async testing, mocking with vi., snapshots, and test performance (formerly test-vitest).

    149 GitHub starsUsed in 2 repos~1.3k tokens
    Testing & QAAuto-check passed

More from jmfederico/pi-web

  • Changeset Changelog

    jmfederico/pi-web

    A skill your agent uses whenever the user asks about changelogs, Changesets, release notes, conventional commits, commit messages for release notes, or making user-visible project changes that…

    861 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed
  • A skill your agent uses whenever the user asks for a new npm version, npm release, package release, new release, version bump, publishing to npm, cutting a GitHub release, tagging a release, or…

    861 GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • Code Quality Architecture

    jmfederico/pi-web

    Project code quality and architecture expectations for implementation, refactoring, planning, and code review.

    861 GitHub stars~2.1k tokensUpdated yesterday
    Auto-check passed
  • Documentation Guide

    jmfederico/pi-web

    Repository documentation placement and writing guidance. An agent skill from jmfederico/pi-web.

    861 GitHub stars~1.7k tokensUpdated yesterday
    Auto-check passed
  • Relay

    jmfederico/pi-web

    Foundational, tool-agnostic Relay method for carrying long work across a chain of independent agent contexts, one bounded leg at a time.

    861 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Relay Runner

    jmfederico/pi-web

    Opinionated full-lifecycle software-delivery profile for Relay chains in Git repositories.

    861 GitHub stars~8k tokensUpdated yesterday
    Auto-check passed

Works with

Categories

Questions about Testing Guide

What does Testing Guide do?

Repository-specific testing guide. An agent skill from jmfederico/pi-web. Testing Guide is an agent skill from jmfederico/pi-web. Repository-specific testing guide.

When should I use Testing Guide?

Testing Guide fits situations like: any test work: planning coverage; writing/fixing/reviewing Vitest tests; test helpers/fakes; choosing test layers.

How do I install Testing Guide in Claude Code?

Run `npx skills add jmfederico/pi-web --skill testing-guide -a claude-code`. Or copy the skill folder (.agents/skills/testing-guide in jmfederico/pi-web) into .claude/skills/testing-guide in your project. Claude Code loads it when a task matches its description.

How do I install Testing Guide in Codex?

Run `npx skills add jmfederico/pi-web --skill testing-guide -a codex`. Or copy the skill folder (.agents/skills/testing-guide in jmfederico/pi-web) into .agents/skills/testing-guide in your project. Codex loads it when a task matches its description.

Can I use Testing Guide in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jmfederico/pi-web --skill testing-guide -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/testing-guide, .gemini/skills/testing-guide, .github/skills/testing-guide and .opencode/skills/testing-guide in your project.

What does Testing Guide need to run?

Going by SKILL.md and its folder, Testing Guide needs the command-line tools its instructions call (npm and npx). Our summary lists: Node.js.

Does Testing Guide access the network?

SKILL.md contains no URLs. Its commands use npm and npx, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Testing Guide safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Testing Guide use?

Testing Guide is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Testing Guide use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Testing Guide?

Skills that share tags, products or a category with Testing Guide: Test Writing Workflow (iOfficeAI/AionUi, 33k stars), Test Guard (amElnagdy/guard-skills, 1.3k stars), Adding LLM MCP Tools (TriliumNext/Trilium, 38k stars) and Concept Page Test Writer (leonardomso/33-js-concepts, 67k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Testing Guide?

jmfederico (a GitHub user) maintains it in jmfederico/pi-web, which has 861 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 6, 2026.

Source: jmfederico/pi-web on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.