/hoangsa:fe-testingfrom hoangsa
Guides the full testing loop for React/Vite web or React Native/Expo features: define success criteria, write tests at the right layer (logic/component/E2E/visual), and confirm with real-app observation.
Ships in hoangsa. 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.
Read when SKILL.md points to them.
Green tests that stay green when you break the code verify nothing. This skill drives the loop: define verifiable criteria BEFORE coding → pick the right test layer → write the test → run and watch the real app → prove the test is honest with a mutation check.
- "How do I test this component / screen / hook?" - "Verify this feature works" / "make sure it works on web/mobile" - "Is this covered by tests?" / "what should I test here?" - "My tests pass but the feature is broken" (false-green) - "There are no tests yet" / setting up FE testing from scratch - Building a new feature, form, list, navigation flow, or data-fetching screen - Before shipping / opening a PR on any FE change This skill is an application of CLAUDE.md §4 (Goal-Driven Execution) to frontend. The core rules:# web vs mobile, and existing test tooling
cat package.json 2>/dev/null | grep -A40 '"\(dependencies\|devDependencies\|scripts\)"'
ls vite.config.* app.json app.config.* metro.config.* playwright.config.* vitest.config.* jest.config.* 2>/dev/null
ls .maestro/ e2e/ 2>/dev/null
Classify:
vite/react-dom present. Expect Vitest + Testing Library + Playwright.react-native/expo present. Expect Jest (jest-expo) +
@testing-library/react-native + Maestro (or Detox).If no test tooling exists, see the setup sections in the reference files before writing tests — do not hand-roll a runner.
Turn the feature request into concrete, observable pass/fail checks BEFORE writing code. Write them down (in the plan, a comment, or the test file's `describe` block).Format each as Given / When / Then in user-observable terms:
Feature: "Add a save button to the profile form"
- Given a filled form, When I click Save, Then a success toast appears and the button is disabled while saving.
- Given a network error, When I click Save, Then an error message appears and the form stays editable.
- Given an empty required field, When I click Save, Then a field error shows and no request is sent.
Rules:
See references/verification-playbook.md for the criteria template and how to map each
criterion to a layer.
| Behavior under test | Layer | Web tool | Mobile tool |
|---|---|---|---|
| Pure function / hook logic, formatting, reducers | Unit | Vitest | Jest (jest-expo) |
| Component renders + responds to user input (types, clicks, shows error) | Component | @testing-library/react + user-event | @testing-library/react-native |
| Network-dependent component behavior | Component + mocked network | MSW | MSW / jest.mock fetch |
| Multi-screen flow, navigation, real routing/persistence | E2E | Playwright | Maestro (preferred) or Detox |
| Exact pixels / layout / visual regression | Visual | Playwright screenshot | Maestro screenshot / device screenshot |
Guidance:
references/web-testing.md (Vitest, Testing Library queries, user-event, MSW,
Playwright).references/mobile-testing.md (Jest/jest-expo, RNTL, Maestro flows, Detox).Non-negotiables regardless of stack:
data-testid, or component internals. (testID/data-testid only as a last
resort for elements with no accessible handle.)user-event on web, fireEvent/RNTL on mobile), not by
calling handlers directly.Web:
npm run dev & # read the real script name from the package's own
# manifest (package.json "scripts"), not from memory;
# note the URL/port it prints
# Then drive it with Playwright (headed or screenshot) and read the screenshot back:
npx playwright test --headed # if E2E specs exist
# or a one-off screenshot script — see references/web-testing.md "observe" section
Prefer the built-in verify and run skills to boot and drive the app, and visual-debug
to turn screenshots/recordings into an annotated montage for inspection.
Mobile (Expo):
npx expo start & # boot Metro
# Maestro drives the simulator and can screenshot each step:
maestro test .maestro/<flow>.yaml
Maestro's takeScreenshot steps + the visual-debug skill give you frame-by-frame evidence.
Walk your criteria list from flow 2 and tick each one off against what you actually see. If a criterion can't be observed, it isn't done.
Prove the test is honest before you trust it. For each new test:A test you've only ever seen pass is a hypothesis. This 30-second step is the difference between "tests pass" and "feature verified".
| Rule | Detail | |------|--------| | **Criteria before code** | Write observable Given/When/Then checks before implementing. No criteria → nothing to verify. | | **Two legs** | Every feature needs a red-on-break automated test AND a real-app observation. One alone is not "verified". | | **Behavior over implementation** | Assert what the user/API observes. Never assert internal state, prop names, or CSS classes. | | **Query like a user** | Role / label / text / a11y. `testID`/`data-testid` is a last resort, not a default. | | **Cheapest honest layer** | Push each check to the lowest pyramid layer that still exercises real behavior. | | **Mock only the network** | Mock at the fetch/HTTP boundary (MSW). Never stub your own modules to make a test pass. | | **Mutation check** | A new test must be seen failing (break the code) before it's trusted. | | **Detect, don't assume** | Detect web vs mobile and existing tooling from the repo before writing tests. | - **`references/web-testing.md`** — Web setup (Vitest + Testing Library + `user-event` + MSW + Playwright), idiomatic component/E2E examples, and the "observe the real app" recipe. - **`references/mobile-testing.md`** — React Native/Expo setup (`jest-expo` + `@testing-library/react-native`, Maestro flows, Detox), device/simulator observation, and screenshot evidence. - **`references/verification-playbook.md`** — The pre-code criteria template, criterion→layer mapping worksheet, and the false-green anti-pattern catalog (what makes tests lie).What SKILL.md sets; muted values are Claude Code's defaults
11 skills in this plugin
/git-flowThis skill should be used when the user wants to start a new task, switch between tasks, park or resume work, finish a task (push + PR), clean up merged branches, or sync with upstream. Triggers on phrases like 'start task', 'new task', 'work on', 'switch to', 'park this', 'resume', 'continue where I left off', 'done with this', 'finish task', 'create PR', 'clean branches', 'delete merged', 'rebase', 'pull latest', or 'sync with main'./memory-cliUse when the user needs to run hoangsa-memory CLI commands — init / index / query / watch / memory / archive / impact / context / changes / graph / projects. Examples: "index this repo", "show memory", "trace the graph", "find taint paths", "consolidate memory".
/memory-debuggingnpx claudepluginhub unknown-studio-dev/hoangsa --plugin hoangsaOther plugins' skills for the same job