agentleFS
DailybotHQDailybotHQ/deepworkplan-website/.agents/skills/write-tests/SKILL.md

write-tests

Skill15 starsChanged 5 months agoMITView on GitHub

Add or expand unit/integration tests for existing code (when testing is configured). Use proactively when tests need to be added or expanded.

76 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use close-spec, design-with-images and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • dzhngSkill

    close-spec

    When a spec under specs/<feature>/ is done shipping (a write-spec build, or any planned task that produced a spec), archive it to specs/done/ and rewrite it from a build-plan into a durable rationale — the why, the principles, the invariants — pointing back to the real code for the how. Use when implementation has landed and the plan no longer matches what shipped, or the user says a feature/spec is finished. Pairs with [write-spec](../write-spec/SKILL.md) (the plan this closes) and [review](../review/SKILL.md) (run before closing).

    Also in 5 projects that use this

  • dzhngSkill

    design-with-images

    Explore UI and visual design with image generation, then iterate the real implementation against the user-selected concept. Use when brainstorming visual directions, offering mockup variants, or implementing an approved generated design; do not stop at the mockups or the first code approximation.

    Also in 5 projects that use this

  • transitive-bullshitSkill

    compare-screenshots

    Compare screenshots against the intended design, distinguishing approved references from historical baselines. Use for iterative implementation matching, before/after visual review, objective image telemetry, or checking a lone capture for flat, empty, or badly framed content.

    Also in 5 projects that use this

  • LucasMatuszewskiSkill

    audit-agents

    Audit and maintain agent configuration files (.claude/agents, AGENTS.md, CLAUDE.md, agent-memory). Checks for duplicates, outdated info, naming conflicts, wrong technical facts, and files over 200 lines. Fixes all issues and commits.

    Also in 5 projects that use this

  • wolverin0Skill

    audit-decisions

    Standardize remediation decisions, baseline-policy entries, and legal-review banners for accepted, deferred, or policy-blocked audit findings.

    Also in 4 projects that use this

  • rhnfzlSkill

    explore-unknowns

    Walk the user through mapping the unknowns of a task before, during, and after they build it, and hand them a four-quadrant map (settled ground, open decisions, taste, and landmines) they keep. Reach for this eagerly whenever a request is ambiguous or underspecified, the codebase or domain is unfamiliar, the user will "know it when they see it", a reference implementation must be understood before porting, a build-queue or architecture-changing task is about to start, a mid-build deviation needs capturing, or a finished change needs buy-in or verified understanding before merge. Trigger even when the skill is not named: "do a blindspot pass", "find my unknown unknowns", "interview me about this change", "brainstorm the approach for a task I am about to build", "help me scope this", "what am I missing here", "plan this before I build", "I know nothing about X in this codebase". When a territory profile is present it reads memory and the graph first and feeds the map into the build pipeline; without one it degrades to a plain general map. Not for trivial or mechanical tasks with clear acceptance criteria, single-fact lookups, pure debugging of a known symptom, or pure code review, those have their own tools. Do not use it to run the build itself; the map is the deliverable and implementation remains a separate task, whether it has not started or is already underway.

    Also in 5 projects that use this

  • +5 more from dzhng

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 10 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 71 edited versions we read keep these.

  • 10

    Distinctive

    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
  1. Distinctive:

    Add or expand tests for existing code.

    line 20
  2. Distinctive:

    Does NOT implement new production code

    line 32
  3. Distinctive:

    Does NOT refactor production logic

    line 33
  4. Distinctive:

    Does NOT change function signatures for the sake of testability without agreement

    line 34
  5. Distinctive:

    Does NOT set up E2E tests (Playwright not configured)

    line 35
  6. Very specific:

    Use as never cast for mock entries passed to functions expecting a CollectionEntry

    line 119
  7. Very specific:

    Do NOT test async functions that depend on astro:content directly — mock the collection instead

    line 121
  8. Distinctive:

    Read the target file(s) and identify public behavior to test

    line 127
  9. Very specific:

    Check for existing tests in tests/unit/

    line 128
  10. Very specific:

    Create or update test file in tests/unit/

    line 139
  11. Distinctive:

    Use Vitest (describe, it, expect)

    line 140
  12. Very specific:

    Import fixtures from tests/fixtures/ when applicable

    line 141
  13. Distinctive:

    Keep tests focused; avoid testing implementation details

    line 142
  14. Distinctive:

    Stop and escalate: if:

    line 185
  15. Distinctive:

    Escalate to Tier 3: if: integration/E2E design needed, or test architecture decisions.

    line 201

“Common” is measured: kept by at least 6 in 10 of the 71 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: Write Tests

Objective

Add or expand tests for existing code. This skill creates or extends test files with meaningful cases, edge cases, and mocks.

Current Status

  • Testing Framework: Vitest 4.x (configured and active)
  • Component Testing: @testing-library/svelte 5.x
  • DOM Environment: happy-dom
  • Coverage: V8 provider, 80%+ threshold on src/lib/
  • Test file naming: *.test.ts

Non-Goals

  • Does NOT implement new production code
  • Does NOT refactor production logic
  • Does NOT change function signatures for the sake of testability without agreement
  • Does NOT set up E2E tests (Playwright not configured)

Tier Classification

Tier: 2 - Standard

Reasoning: Writing tests requires moderate reasoning (understanding behavior, edge cases, mocks). Scope typically 1-10 files, 100-500 LOC; standard development work.

Inputs

Required Parameters

  • $TARGET: File(s) or module to add tests for (e.g., src/lib/i18n.ts)
  • $SCOPE: What to cover (e.g., "unit for props", "interaction tests", "edge cases for null")

Optional Parameters

  • $EXISTING: Path to existing test file to extend

Prerequisites

  • Target code is stable (no pending refactors)
  • Test fixtures understood (tests/fixtures/)
  • Vitest config reviewed if testing new module types

Test Infrastructure

Configuration

  • Config: vitest.config.ts at project root
  • Environment: happy-dom
  • Path aliases: @/ maps to src/ (matches tsconfig)
  • Svelte: @sveltejs/vite-plugin-svelte with hot: false
  • Browser resolve: conditions: ['browser'] for Svelte 5 component tests
  • astro:content mock: tests/mocks/astro-content.ts (aliased in vitest config)

Test File Structure

tests/
├── unit/
│   ├── lib/                            # Utility function tests
│   │   ├── i18n.test.ts
│   │   ├── markdown-for-agents.test.ts
│   │   └── translations.test.ts
│   └── components/                     # Svelte component tests
├── fixtures/                           # Shared mock data
├── helpers/
│   └── setup.ts                        # Test setup (jest-dom matchers)
└── mocks/
    └── astro-content.ts                # Mock for astro:content virtual module

Key Patterns

Utility function tests:

import { describe, expect, it } from 'vitest';
import { getUrlPrefix } from '@/lib/i18n';

describe('getUrlPrefix', () => {
  it('returns /es for Spanish', () => {
    expect(getUrlPrefix('es')).toBe('/es');
  });
});

Svelte component tests:

import { render, screen } from '@testing-library/svelte';
import { describe, expect, it } from 'vitest';
import MethodologyCard from '@/components/MethodologyCard.svelte';

const doc = { data: { title: 'Introduction', order: 1, lang: 'en' } };

describe('MethodologyCard', () => {
  it('renders doc title', () => {
    render(MethodologyCard, { props: { doc: doc as never } });
    expect(screen.getByText('Introduction')).toBeDefined();
  });
});

Important notes:

  • Use as never cast for mock entries passed to functions expecting a CollectionEntry
  • Svelte 5 components require resolve.conditions: ['browser'] in vitest config
  • Do NOT test async functions that depend on astro:content directly — mock the collection instead

Steps

Step 1: Understand Target

  • Read the target file(s) and identify public behavior to test
  • Check for existing tests in tests/unit/
  • Review testing patterns in existing test files

Step 2: Plan Cases

  • List unit cases (happy path, edge cases, errors)
  • Identify dependencies to mock
  • Decide: new file or extend existing test

Step 3: Implement Tests

  • Create or update test file in tests/unit/
  • Use Vitest (describe, it, expect)
  • Import fixtures from tests/fixtures/ when applicable
  • Keep tests focused; avoid testing implementation details

Step 4: Validate

pnpm run test           # Run tests
pnpm run biome:check    # Lint check

Output Format

Success Output

## Tests Added/Updated

### Target
{What was tested}

### Files
- `tests/.../foo.test.ts`: {created|updated} — {brief description}

### Coverage
- {list of cases covered}

### Validation
- pnpm run test: pass
- pnpm run biome:check: pass

### Commit Message
test: add|expand tests for {target}

Guardrails

Scope Limits

  • Maximum files: 10 (test files + any small test helpers)
  • Maximum LOC: 500 (test code)
  • Naming: *.test.ts

Stop Conditions

Stop and escalate if:

  • Target is auth/security-critical (coordinate with team)
  • Requires new test infrastructure not in project
  • Scope exceeds 10 files or 500 LOC
  • Need to mock astro:content beyond the existing stub

Definition of Done

  • New or updated test files
  • All tests pass (pnpm run test)
  • pnpm run biome:check passes
  • Tests are meaningful (not only coverage padding)

Escalation Conditions

Escalate to Tier 3 if: integration/E2E design needed, or test architecture decisions.

Related

  • quick-fix - Small fixes
  • reviewer - Review test quality
  • docs/TESTING_GUIDE.md - Full testing conventions and setup

Changelog

  • 2026-02-17: Updated from placeholder to actual Vitest setup. Removed "NOT CONFIGURED" status. Added real patterns, config details, and Svelte 5 compatibility notes.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.