typescript-test-writing

typescript-test-writing is a skill for Claude Code, Codex from vybestack/llxprt-code. It costs 66 tokens per session (1,767 once invoked), scanned A, original, Apache-2.0.

A guide for writing TypeScript tests in the llxprt-code repository. TDD, or test-driven development, means writing a failing test before the code that makes it pass.

In plain words
What is it for?
Use it when adding or changing tests, including choosing Bun's test tools, structuring fixtures, handling mocks, and following the repository's strict TypeScript rules.
Why use it?
It prevents inconsistent test styles, weak tests, and code written without a verified expected behavior.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/vybestack/llxprt-code/typescript-test-writing
Any agent
npx skills add vybestack/llxprt-code --skill typescript-test-writing
Clone the repo
git clone --depth 1 https://github.com/vybestack/llxprt-code

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for typescript-test-writing

README.md
[![agentmods](https://agentmods.dev/badge/skills/vybestack/llxprt-code/typescript-test-writing.svg)](https://agentmods.dev/skills/vybestack/llxprt-code/typescript-test-writing)
Your own site
<a href="https://agentmods.dev/skills/vybestack/llxprt-code/typescript-test-writing"><img src="https://agentmods.dev/badge/skills/vybestack/llxprt-code/typescript-test-writing.svg" alt="Measured on agentmods" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,767 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00066 $0.01767
Opus 5 $0.00033 $0.00883
Sonnet 5 $0.00013 $0.00353
Haiku 4.5 $0.00007 $0.00177

Measured 4d ago against content hash 7a946a2997e1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

typescript-test-writing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.llxprt/skills/typescript-test-writing/SKILL.md · 174 lines

How it starts

The opening of the file, as written. The whole thing — 174 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Writing TypeScript Tests in llxprt-code

Distilled from dev-docs/RULES.md. When in doubt, read RULES.md in full — it is the source of truth for development guidelines.

Core principle: TDD is mandatory

Every line of production code must be written in response to a failing test. No exceptions.

Red-Green-Refactor, followed strictly:

  1. RED: Write a failing test for the next small behavior.
  2. GREEN: Write ONLY enough code to make the test pass.
  3. REFACTOR: Only if it improves clarity.
  4. COMMIT: Feature + tests together; refactoring separately.

Stack rules (non-negotiable)

  • Bun + bun:test ONLY. Never create Vitest or Node test suites, and never add new .js files — everything is TypeScript run with bun.

  • TypeScript strict mode: no any (use unknown with type guards), no type assertions (use type predicates), explicit return types.

  • Import pattern (bun:test re-exports vi, mock, and Mock):

    import {
      describe,
      it,
      expect,
      beforeEach,
      afterEach,
      vi,
      type Mock,
    } from 'bun:test';
    
  • Prefer immutable data in tests and fixtures ({ ...cart, items: [...cart.items, item] }); never mutate shared fixtures between tests.

Test behavior, not implementation

✅ Test:

  • Public API behavior
  • Input → Output transformations
  • Edge cases and error conditions
  • Integration between units
  • Schema validation

❌ Never test:

  • Implementation details
  • Private methods
  • Third-party libraries
  • Mock interactions

❌ Never enshrine bugs as specification: do not write a passing test that asserts incorrect behavior, even if that is what the code currently does. If you discover a bug while writing tests: (1) file an issue or ask the user, (2) write a failing test that asserts the CORRECT behavior, (3) fix the production code so the test passes. A suite that encodes bugs as passing tests is worse than no tests — it actively prevents future fixes.

Test structure

  • describe: feature/component name.
  • it: specific behavior in plain English.
  • Arrange-Act-Assert: clear sections; one behavior per test.
  • DRY setup: never copy-paste identical beforeEach/afterEach boilerplate (e.g. temp-dir creation, cleanup) across describe blocks. Extract a shared helper that wires the lifecycle hooks (e.g. a useTempDir() helper that registers beforeEach/afterEach internally and returns a lazy accessor). Repeating 5+ lines of identical setup in N describe blocks is a maintenance hazard; one line of shared setup per describe block is the target.

Read the full file on GitHub · 174 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 174 lines · 66 tokens per session scan A 7a946a2997e1

Subscribe to this mod's changes

typescript-test-writing is a skill published in the GitHub repository vybestack/llxprt-code (700 stars, last pushed today), licensed Apache-2.0. It adds 66 tokens to every session and 1,767 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens