pi-anthropic-auth: Skill for Claude Code

.pi/skills/testing/SKILL.md

testing is a skill for Claude Code, Codex from gotgenes/pi-anthropic-auth. It costs 43 tokens per session (5,418 once invoked), scanned A, original, MIT.

A testing guide for Vitest, a JavaScript and TypeScript test framework, with mock patterns and general test-planning rules. Test-driven development, or TDD, means writing tests as part of the design process before or alongside code.

In plain words
What is it for?
Use it when planning, writing, or debugging tests and when configuring Vitest mocks such as vi.mock, vi.fn, vi.spyOn, and vi.hoisted.
Why use it?
It helps avoid common mock setup errors, especially around reset behavior, hoisting, constructors, and built-in modules.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

This is gotgenes/pi-anthropic-auth's own configuration. It tells Claude Code and Codex how to work on pi-anthropic-auth itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything pi-anthropic-auth configures →

Reuse

Borrowing it

Nothing to install: this file belongs to gotgenes/pi-anthropic-auth. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/gotgenes/pi-anthropic-auth/main/.pi/skills/testing/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/gotgenes/pi-anthropic-auth

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 testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/gotgenes/pi-anthropic-auth/testing/github.svg)](https://agentmods.dev/skills/gotgenes/pi-anthropic-auth/testing)
Your own site
<a href="https://agentmods.dev/skills/gotgenes/pi-anthropic-auth/testing"><img src="https://agentmods.dev/badge/skills/gotgenes/pi-anthropic-auth/testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/gotgenes/pi-anthropic-auth/testing"><img src="https://agentmods.dev/badge/skills/gotgenes/pi-anthropic-auth/testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,418 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 76
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
How audits are shown
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.1 $0.00043 $0.05418
Opus 5.5 $0.00017 $0.02167
Sonnet 5.5 $0.00009 $0.01084
Haiku 4.5 $0.00004 $0.00542

Measured 29d ago against content hash 55f16d4de115, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

testing 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 29d 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.

.pi/skills/testing/SKILL.md · 209 lines

How it starts

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

Testing

Load this skill when writing, debugging, or planning tests.

Vitest mock patterns

vi.mock and hoisting

  • When using vi.mock(), extract each vi.fn() stub to a module-scope variable and reset it in beforeEach — vi.restoreAllMocks() only operates on vi.spyOn() spies, not on vi.fn() instances. Use .mockReset() when the stub has no default implementation. Use .mockClear() when the vi.mock() factory provides a default implementation that tests must preserve.
  • When a vi.mock() factory references a module-scope vi.fn() stub, wrap the stub declaration in vi.hoisted() — Vitest hoists vi.mock() above normal declarations, so unhoisted variables are undefined when the factory runs.
  • When mocking a class constructor with vi.mock(), use vi.fn() with no implementation — not vi.fn(() => ({})). Arrow-function implementations are not constructable; new MockClass() throws "is not a constructor".
  • When mocking node:* built-in modules with vi.mock(), include a default key mirroring the named exports — omitting it causes "No default export defined on the mock" errors.
  • A vi.mock("node:*") factory that returns an object literal replaces the module: every export it omits becomes undefined, so a later call to a sibling export (lstatSync, tmpdir) throws TypeError in unrelated tests in that file. To stub one export and keep the rest, spread await vi.importActual<typeof import("node:fs")>("node:fs") in the factory and override only the target.
  • Import the module-under-test with a static top-level import, not a per-test await import(...) — Vitest hoists vi.mock()/vi.hoisted() above static imports, so the mock still applies. A per-test dynamic import of a module that transitively pulls heavy deps pays the transform/resolve cost inside each test's testTimeout window and can flake CI.

Typing mock functions

  • When a vi.fn() factory returns an empty array or narrow literal, annotate its return type explicitly — vi.fn((): string[] => []), not vi.fn(() => []). Without the annotation TypeScript infers never[], and subsequent mockReturnValueOnce([...]) calls fail with “not assignable to never”. Use import type to pull domain types (e.g., AgentConfig, PreloadedSkill) for the annotation.
  • When typing a mock field on an interface, use Mock<specific-signature> — e.g., Mock<() => void>, Mock<(arg: string) => Promise<void>>. Do not use ReturnType<typeof vi.fn> — in Vitest v4 it expands to Mock<Procedure | Constructable>, a union that TypeScript cannot call.

Read the full file on GitHub · 209 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. 29d ago Changed · +6 lines 55f16d4de115
  2. 1mo ago Changed · +29 lines · +7 tokens per session 30d3f3134fdd
  3. 2mo ago First seen · 174 lines · 36 tokens per session scan A e211a2cf2bc8

Subscribe to this mod's changes

testing is a skill published in the GitHub repository gotgenes/pi-anthropic-auth (426 stars, last pushed 13d ago), licensed MIT. It adds 43 tokens to every session and 5,418 once invoked, about $0.0002 per session on Opus 5.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.