Skip to content
Back to skills

Unit Testing

ASecurity

Validate Caxri logic with focused Vitest unit and integration coverage. Use after changing pure logic, Runtime or shared services, persistence, security, configuration, or repository skill scripts; when reproducing a bug below the Electron desktop boundary; or when selecting the narrowest behavior-level regression before a changed-file check. Do not use for Playwright Electron workflows or full E2E delivery.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 24, 2026
developmentbashreacttestingsecurity

Works with

  • terminal
  • cli

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 24, 2026

npx -y skills add tjx666/caxri --skill unit-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Unit Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Unit Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tjx666-unit-testing/badge)](https://www.skillsdirectory.com/skills/tjx666-unit-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: unit-testing
description: Validate Caxri logic with focused Vitest unit and integration coverage. Use after changing pure logic, Runtime or shared services, persistence, security, configuration, or repository skill scripts; when reproducing a bug below the Electron desktop boundary; or when selecting the narrowest behavior-level regression before a changed-file check. Do not use for Playwright Electron workflows or full E2E delivery.
---

# Unit Testing

Validate the smallest observable behavior below the Electron desktop boundary.

1. Put tests with their source domain. Renderer logic stays beside its source; Main, Runtime, CLI,
   shared, and skill code use their domain-local `__tests__/` or `scripts/*.test.ts` convention.
   Placement details live in `source-layout`. Before creating a test file, confirm the path does
   not exist; when it does, extend it with an edit instead of writing the file whole, which
   silently deletes its existing cases.
2. New features ship with a behavior-level test for the functionality they add. For a
   reproducible bug, add a regression that fails for the bug before the fix, in the same commit.
   Prefer observable output and integration boundaries over internal call assertions. When the
   fix sits above a testable boundary, extract the logic so the failure mode is testable rather
   than skipping the test. Existing untested modules are debt, not precedent: touching an
   untested area does not require backfilling its whole suite, but the behavior you add or change
   there must be covered.
   Callback regressions must assert the callback was actually registered before invoking it;
   a no-op fallback can make an unreachable scenario falsely pass.
   For repeated asynchronous operations, wait for the requested operation's identity before accepting completion.
   For example, a new Chat send must complete a new turn id; the previous completed turn still in the snapshot
   cannot satisfy its wait.
   For chunked or asynchronously parsed streams, preserve the original chunk boundaries and
   exercise the real encoder/parser when its buffering affects the result. Joining chunks before
   the assertion or checking enqueue alone cannot prove correct consumer output or reset ordering.
   A coding convention that a single file's syntax can show (always notify listeners through
   `notifyListeners`) belongs in a `scripts/eslint-rules/` rule, not a test that scans the tree;
   lint reports it in the editor and in `check --lint`. A contract test that asserts on a
   repository file's text imports that file (`import css from '.../theme.css?raw'`, or
   `import.meta.glob(..., { query: '?raw', eager: true })` for a directory) instead of reading
   it with `fs`, so `check --test` and Vitest's module graph select the test when the file changes.
3. Do not unit-test React components by default. Extract meaningful state into a hook or pure
   function; route rendering and interaction to `e2e-testing`.
4. Run the narrowest relevant files from the repository root, so `vitest.config.ts` maps workspace
   packages to their sources. Inside a workspace without its own Vitest config, such as
   `apps/mobile`, imports can load a stale `dist` build: a newly added
   `@caxri/mobile-transport` enum member then reads as `undefined`.

   ```bash
   bunx vitest run --silent='passed-only' <test-file...>
   ```

5. Finish a source batch with `quality-check`:

   ```bash
   bun run check <changed-files...> --lint --test [--type] [--knip]
   ```

6. Keep fixtures content-free. Never copy real tokens, user code, Terminal output, Agent
   transcripts, production paths, or credentials into tests or artifacts.
   A test that writes a real `StructuredLogger` into a temporary directory awaits `logger.flush()`
   before removing it: the logger drains asynchronously and recreates a vanished log folder, so the
   removal fails with `ENOTEMPTY` (a shared fixture such as `delegatedFixture` takes the flush
   through its `beforeCleanup`).
7. Leave the full `bun run test` suite to CI; it refuses to run locally unless the user sets
   `CAXRI_FULL_SUITE_AUTHORIZED=1` (see `quality-check`).

This skill does not own Playwright, Electron desktop lifecycle, real PTYs, window focus, or
remote full E2E. Call the Skill tool with "e2e-testing" for those surfaces.

Files in this skill

  • SKILL.md4.2 KB
  • agents/openai.yaml205 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.