unit-test-writer
Skill3 starsChanged 5 months agoMITView on GitHub
Plans and implements comprehensive unit tests for the PABX monorepo — Angular frontend (Jest + jest-preset-angular, .spec.ts) and Node.js backend (Jest, apps/backend/__tests__/unit/). Runs interactively (3 phases with an approval checkpoint) when called by a user, or autonomously (no pause) when dispatched by implement-feature/evaluator. Also runs in correction mode to fix a specific failing test flagged by the evaluator. Enforces PABX rules (real component imports, manual service instantiation, localStorage/jQuery mock order, Promise.all() mock correctness, cleanup, English-only). Never modifies production code.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- megamott/vibe-skillstheir own version, first seen May 15, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- megamott/vibe-skills★ 28same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- architecture-analyzerSkill
- claude-switch-accountSkill
- coupling-mapSkill
- deep-analyzerSkill
- e2e-test-validatorSkill
- e2e-test-writerSkill
- evaluatorSkill
- fix-runnerSkill
- gate-builderSkill
- handoff-writerSkill
- implement-featureSkill
- integration-test-validatorSkill
- integration-test-writerSkill
- monorepo-unit-test-validatorSkill
- monorepo-unit-test-writerSkill
- pabx-design-systemSkill
- pabx-e2e-test-validatorSkill
- pabx-e2e-test-writerSkill
- playwright-cliSkill
- prd-writerSkill
- qa-preflightSkill
- spec-writerSkill
- unit-test-validatorSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 11 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
No production code is ever modified.
- Distinctive: line 41
Interactive (user-invoked, default): run the full 3-phase process and stop at the Phase 2 checkpoint to get explicit user approval before …
- Distinctive: line 44
Autonomous (dispatched by implement-feature / evaluator): run the same 3 phases but skip the approval checkpoint — auto-accept the …
- Very specific: line 58
If test_catalog_path given, read the catalog entry (priority, gaps, methods, mocks, pattern) and validate it against the actual source.
- Distinctive: line 60
Read the target file fully.
- Very specific: line 65
Create a .unit-test.md checklist organized by method/function, using the minimum categories for the target type (component / service / …
- Distinctive: line 76
UPDATE the checklist; REPEAT until complete.
- Very specific: line 86
Follow references/pabx-rules.md exactly (component/service/model/controller patterns, mock order, cleanup, performance).
- Distinctive: line 87
Write ALL test content in English.
- Distinctive: line 88
Import the REAL component.
- Very specific: line 89
Use the correct Promise.all() mock pattern (new builder per call, .then via Promise.resolve().then.bind).
- Distinctive: line 90
Place files per the location standard (frontend co-located.
- Very specific: line 95
Use real DB/HTTP/filesystem.
- Distinctive: line 96
Write anything in Portuguese in test files.
- Distinctive: line 98
Leave shared mutable state between tests or create slow tests.
- Distinctive: line 104
Test file missing: create it in the correct location.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Unit Test Writer (PABX)
Plan and implement fast, isolated, high-quality unit tests for the PABX monorepo. Validates logic without hitting real databases, HTTP, or filesystems. Never modifies production code — if a test fails, only the test is adjusted.
Project scope: this skill assumes the PABX monorepo structure. All the hard, project-specific rules (jQuery/localStorage mock order,
Promise.all()mock pattern, file locations, execution commands) are inreferences/pabx-rules.md— read it before writing. Generic SDD flow docs:https://github.com/dayvisonassis/sdd-skills/blob/main/docs/GUIA_DO_WORKFLOW.md.
Scope:
- Frontend:
apps/frontend/— Jest + jest-preset-angular,*.spec.tsco-located with the source. - Backend:
apps/backend/__tests__/unit/— Jest,*.test.jsmirroringsrc/(1:1).
INPUT
target_file(required) — the source file to test.mode(optional) —interactive(default when a user calls directly) orautonomous(set by implement-feature/evaluator).test_file_path(optional) — existing test file to expand; otherwise created automatically.focus_areas/batch_size(optional) — prioritized methods; tests per batch (default 8, 5–10).test_catalog_path(optional) — a Test Catalog entry to accelerate Phase 1.evaluation_report(optional) — when present, run in correction mode (fix only the failing test named in the report).
OUTPUT
- New/expanded
.spec.ts/.test.jsunit tests following the PABX rules, in the correct location. - A
.unit-test.mdchecklist (planning may be Portuguese; all test code is English). - Per-batch execution confirmation (tests run in milliseconds) and a final coverage summary.
- No production code is ever modified.
Invocation Modes
Interactive (user-invoked, default): run the full 3-phase process and stop at the Phase 2 checkpoint to get explicit user approval before implementing.
Autonomous (dispatched by implement-feature / evaluator): run the same 3 phases but skip the approval checkpoint — auto-accept the checklist and proceed to batch implementation. Never pause for a human. This mirrors spec-writer's Batch Mode.
Correction mode (dispatched by evaluator on a kind:test failure): an evaluation_report
is provided. Read the failing test's testFile/location/message, and fix only that test
(smallest footprint) so it conforms to the PABX rules and passes. Do not rewrite unrelated tests
and do not touch production code. Return control to the evaluator.
EXECUTION STEPS (3 Phases)
Phase 1 — Analysis & Planning
- If
test_catalog_pathgiven, read the catalog entry (priority, gaps, methods, mocks, pattern) and validate it against the actual source. - Backend: study existing
apps/backend/__tests__/unit/for patterns. Frontend: IGNORE legacy Karma/Jasmine; write fresh Jest tests. - Read the target file fully; map functionalities, dependencies, code paths.
- Identify every external dependency to mock (HttpClient, DB, services, localStorage, jQuery, Router, ActivatedRoute).
- Map scenarios: success, error handling, edge cases, boundary conditions.
Phase 2 — Checklist Creation
Create a .unit-test.md checklist organized by method/function, using the minimum categories
for the target type (component / service / backend util / controller / model — see
references/pabx-rules.md).
- Interactive: present the checklist and ask: does it guarantee max coverage of success+failure? missing edge cases? all deps identified? → WAIT for explicit approval.
- Autonomous / correction: skip the checkpoint; treat the checklist as approved and proceed.
Phase 3 — Batch Implementation (only after approval / autonomously)
- GROUP similar tests into batches of 5–10 (same method/scenario/mocks).
- IMPLEMENT the batch in one operation, applying the PABX rules (
references/pabx-rules.md). - EXECUTE the batch — confirm milliseconds; a test > 1s means a broken mock.
- UPDATE the checklist; REPEAT until complete.
In correction mode, Phases 1–2 collapse to reading the report + the failing test; implement only the corrected test(s) and run them.
RULES
Always:
- Follow
references/pabx-rules.mdexactly (component/service/model/controller patterns, mock order, cleanup, performance). - Write ALL test content in English; keep tests independent, deterministic, fast.
- Import the REAL component; instantiate services manually; mock localStorage/jQuery before imports.
- Use the correct
Promise.all()mock pattern (new builder per call,.thenviaPromise.resolve().then.bind). - Place files per the location standard (frontend co-located; backend 1:1 mirror).
- In correction mode, fix only the flagged test (smallest footprint) and return to the evaluator.
Never:
- Modify production code (components, services, utils, controllers, models). Fix only tests.
- Use real DB/HTTP/filesystem;
TestBed.inject()/HttpClientTestingModulefor services; inline test components. - Write anything in Portuguese in test files.
- Pause for approval in autonomous/correction mode.
- Leave shared mutable state between tests or create slow tests.
Edge Cases
- Test file missing: create it in the correct location.
- Component uses jQuery: global
$mock BEFORE all imports (else CRITICAL failure). - Model uses
Promise.all(): apply the dedicated mock pattern or tests hang for minutes. - Stack not PABX (no
apps/layout): this skill is PABX-specific; report that the caller should use a generic approach instead. - Called autonomously but the checklist reveals a blocking ambiguity: apply a best-practice default, note it, and proceed (do not pause).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

