add-test

add-test is a skill for Claude Code from cyanheads/obsidian-mcp-server. It costs 41 tokens per session (3,843 once invoked), scanned A, original, Apache-2.0.

A test-file scaffold for an existing tool, resource, or service in a TypeScript project.

In plain words
What is it for?
Use it to add tests with Vitest, follow the repository’s test layout, and verify the tests and project checks.
Why use it?
It gives developers a consistent starting point for checking normal results, errors, and edge cases when code has no matching tests.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the obsidian-mcp-server plugin — 33 skills, 1 MCP server shipped together

Good fit Use it to add tests with Vitest, follow the repository’s test layout, and verify the tests and project checks.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cyanheads/obsidian-mcp-server/add-test
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.

Any agent
npx skills add cyanheads/obsidian-mcp-server --skill add-test
Clone the repo
git clone --depth 1 https://github.com/cyanheads/obsidian-mcp-server

Made for: Claude Code.

Or install obsidian-mcp-server, the plugin that ships this one along with the rest of its 33 skills, 1 MCP server.

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 add-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/cyanheads/obsidian-mcp-server/add-test/github.svg)](https://agentmods.dev/skills/cyanheads/obsidian-mcp-server/add-test)
Your own site
<a href="https://agentmods.dev/skills/cyanheads/obsidian-mcp-server/add-test"><img src="https://agentmods.dev/badge/skills/cyanheads/obsidian-mcp-server/add-test/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 add-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/cyanheads/obsidian-mcp-server/add-test"><img src="https://agentmods.dev/badge/skills/cyanheads/obsidian-mcp-server/add-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,843 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 medium

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 →

  • medium Agent Snooping · line 18
    Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
    Fix: Remove all code or instructions that list or read other skills' files or directories. Skills should operate independently; cross-skill access is a privilege escalation.
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.00041 $0.03843
Opus 5.5 $0.00016 $0.01537
Sonnet 5.5 $0.00008 $0.00769
Haiku 4.5 $0.00004 $0.00384

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

Security

Grade A, and why

add-test 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 19d 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.

Origin

Copies of this mod

8 near-identical copies found in the catalogue:

  • add-test — 100% identical, 0 lines differ
  • add-test — 100% identical, 0 lines differ
  • add-test — 100% identical, 35 lines differ
  • add-test — 100% identical, 0 lines differ
  • add-test — 100% identical, 0 lines differ
  • add-test — 100% identical, 28 lines differ
  • add-test — 100% identical, 0 lines differ
  • add-test — 100% identical, 0 lines differ
framework-skills/add-test/SKILL.md · 321 lines

How it starts

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

Context

Tests use Vitest and createMockContext from @cyanheads/mcp-ts-core/testing. If the repo already has tests, match the existing layout. If the repo has no existing tests, create a root tests/ directory that mirrors the src/ structure (e.g. tests/mcp-server/tools/definitions/echo.tool.test.ts for src/mcp-server/tools/definitions/echo.tool.ts).

For the full createMockContext API and testing patterns, read:

framework-skills/api-testing/SKILL.md

Steps

  1. Identify the target — which tool, resource, or service needs tests
  2. Read the source file — understand the handler's logic, input/output schemas, error paths, and which ctx features it uses
  3. Create the test file in the repo's existing test layout — search for existing *.test.ts files to confirm whether tests are colocated with source or under a root tests/ directory
  4. Write test cases covering happy path, error paths, and edge cases
  5. Run bun run test to verify
  6. Run bun run devcheck to verify lint, types, and MCP definitions

Determining What to Test

Read the handler and identify:

Aspect Test Strategy
Happy path Valid input → expected output. Include at least one.
Input variations Optional fields omitted, defaults applied, boundary values
Error paths Invalid state, missing resources, service failures → correct error thrown
ctx.state usage Available on any mock context (tenant 'default' unless { tenantId } says otherwise). It runs the production storage path, so use storage-legal keys (cache/v1/abc, never cache:v1:abc) and assert TTL expiry with fake timers.
ctx.requestInput / ctx.inputs Two rounds. First round: assert the handler throws the input-required signal (.rejects.toSatisfy(isInputRequiredSignal)), or catch it and assert on error.result.inputRequests. Second round: seed createMockContext({ inputResponses }) and assert the handler completes. Cover the decline/cancel branch too. A consent gate that redeems a ctx.state record also needs that record written into the second round's context, and a replay case showing the spent record asks again (see api-testing § Mock inputs).
ctx.clientCapabilities When the handler asks only if the client declared a capability, seed createMockContext({ clientCapabilities }) with and without it and assert it asks in one case and falls through in the other. Seeding it also filters inputResponses to the declared kinds, as production does.
ctx.signal Pass createMockContext({ signal: controller.signal }) and assert a long loop stops early rather than running to completion.
ctx.fail (typed contract) Definitions with errors[] need fail attached to the mock ctx — createMockContext({ errors: myTool.errors }) does it for you. Assert on data.reason (stable per-contract entry), not just code.
format function Test separately if defined — it's pure, no ctx needed. Verify it renders the IDs and fields the model needs, not just a count or title. For projection-style tools, test non-default field selections.
Sparse upstream payloads For third-party API integrations, build a fixture with omitted fields. Assert normalized output still validates and format() preserves unknown values instead of inventing facts.
Form-client payloads If handler has optional fields: test with empty-string inner values (form clients send "" instead of undefined). Assert handler doesn't break or produce invalid output.
Auth scopes Not tested at handler level (framework enforces) — skip

Read the full file on GitHub · 321 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. 19d ago Changed · +3 lines 290612698262
  2. 1mo ago Changed d4147ffbf280
  3. 1mo ago First seen · 318 lines · 41 tokens per session scan A 9ff05d2f4834

Subscribe to this mod's changes

add-test is a skill published in the GitHub repository cyanheads/obsidian-mcp-server (701 stars, last pushed today), licensed Apache-2.0. It adds 41 tokens to every session and 3,843 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.

Related

Other skills, from other repositories

impl-validator

Independently check whether an implementation matches its stated goal and return PASS/WARN/FAIL with actionable issues. Use for second-opinion validation of an implementation or generated output.

Ar9av/obsidian-wiki · 38 tokens

pkm-session-end

Use when wrapping up a work session — creates devlog entry, captures undocumented decisions/research/debugging, audits link health of session work, and updates project index. Primarily used via the pkm-capture agent.

AdrianV101/obsidian-pkm-plugin · 49 tokens

pkm-write

Use when writing to the vault — creating new notes (vaultwrite), editing existing notes (vaultedit, vaultappend, vaultupdatefrontmatter). Handles duplicate checking, link discovery, annotations, and index updates for new notes. Provides guidelines for modifications.

AdrianV101/obsidian-pkm-plugin · 54 tokens

pkm-explore

Use when researching what the vault knows about a topic — performs graph + semantic exploration with gap analysis to map existing knowledge and find missing connections. Primarily used via the vault-explorer agent. Not for routine session-start context loading (hooks handle that).

AdrianV101/obsidian-pkm-plugin · 55 tokens

triage-tasks

Use when you want to review and batch-update open vault task statuses for the current project or across all projects.

AdrianV101/obsidian-pkm-plugin · 27 tokens

tackle-task

Use when starting work on a specific vault task, when a task title or path is mentioned, or when coming from triage output.

AdrianV101/obsidian-pkm-plugin · 31 tokens