Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Unit Test Writer

ASecurity

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 instantiati...

2 stars
0 votes
0 copies
1 views
Added 9/19/2026
developmentgoangularnodetestinggitdatabasefrontendbackendperformance

Works with

cli

Security Analysis

A100/100

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

Scanned 9/19/2026

$npx -y skills add dayvisonassis/sdd-skills --skill unit-test-writer --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Unit Test Writer?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Unit Test Writer
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dayvisonassis-unit-test-writer/badge)](https://www.skillsdirectory.com/skills/dayvisonassis-unit-test-writer)

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

Download with Pro
Files
SKILL.md
---
name: unit-test-writer
description: 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.
---

# 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 in **`references/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.ts` co-located with the source.
- **Backend:** `apps/backend/__tests__/unit/` — Jest, `*.test.js` mirroring `src/` (1:1).

## INPUT

- `target_file` (required) — the source file to test.
- `mode` (optional) — `interactive` (default when a user calls directly) or `autonomous` (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.js` unit tests following the PABX rules, in the correct location.
- A `.unit-test.md` checklist (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
1. If `test_catalog_path` given, read the catalog entry (priority, gaps, methods, mocks, pattern) and validate it against the actual source.
2. **Backend:** study existing `apps/backend/__tests__/unit/` for patterns. **Frontend:** IGNORE legacy Karma/Jasmine; write fresh Jest tests.
3. Read the target file fully; map functionalities, dependencies, code paths.
4. Identify every external dependency to mock (HttpClient, DB, services, localStorage, jQuery, Router, ActivatedRoute).
5. 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)
1. GROUP similar tests into batches of 5–10 (same method/scenario/mocks).
2. IMPLEMENT the batch in one operation, applying the PABX rules (`references/pabx-rules.md`).
3. EXECUTE the batch — confirm milliseconds; a test > 1s means a broken mock.
4. 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.md` exactly (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, `.then` via `Promise.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()`/`HttpClientTestingModule` for 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).

Attribution

dayvisonassisdayvisonassis
View sourceSee grades on GitHubMore from dayvisonassis →
SSkills Directory ProSkills Directory

Get any skill into Claude in one click.

Download any skill as a ZIP for Claude.ai, Claude Desktop, or .claude/skills. $9/mo.

See Pro

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

Comments (0)

No comments yet. Be the first to comment!

SSkills Directory ProSkills Directory

Get any skill into Claude in one click.

Download any skill as a ZIP for Claude.ai, Claude Desktop, or .claude/skills. $9/mo.

See Pro

Related Skills

Clean Code

Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments

304955 votes

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

285172 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2222 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

10311 votes
View all in development →