Typescript Testing logo

Typescript Testing

Community
shinpr
typescript-testing

Applies repository-aware TypeScript test design, behavior evidence, isolation, and mock-boundary criteria. Use when writing or reviewing unit tests.

Overview

Publishershinpr
Repositoryai-coding-project-boilerplate
Skill nametypescript-testing
Stars
234
Forks
28
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by shinpr on GitHub. Read the source before you install it.

Installation

Install the Typescript Testing AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/shinpr/ai-coding-project-boilerplate/tree/main/.claude/skills-en/typescript-testing
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/shinpr/ai-coding-project-boilerplate.git /tmp/ai-coding-project-boilerplate
mkdir -p .claude/skills
cp -r /tmp/ai-coding-project-boilerplate/.claude/skills-en/typescript-testing .claude/skills/typescript-testing
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Typescript Testing in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Typescript Testing on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Typescript Testing is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

TypeScript Testing Rules

Prerequisite Detection

Inspect package.json, the lockfile, test configuration, and existing test imports before selecting a framework or command. Apply Vitest-specific rules only when Vitest is configured; otherwise use the repository's configured TypeScript test harness while preserving the behavior, isolation, and evidence rules below. If no runnable harness is identifiable, report the inspected paths and missing command or configuration.

Test Framework

  • Vitest: Use when selected by repository configuration or existing tests
  • Test imports: import { describe, it, expect, beforeEach, vi } from 'vitest'
  • Mock creation: Use vi.mock()

Basic Testing Policy

Quality Requirements

  • Regression protection: concentrate tests on critical paths, business logic, and behavior whose regression would matter. Add a test when an unguarded behavior creates a material regression risk
  • Independence: Each test can run independently without depending on other tests
  • Reproducibility: Control time, randomness, environment values, and external I/O so identical inputs produce the same observable result
  • Readability: Each test names one behavior, separates setup/action/assertion, and keeps fixtures limited to values used by that behavior

Test Types and Scope

  1. Unit Tests

    • Verify behavior of individual functions or classes
    • Mock all external dependencies
  2. Integration Tests

    • Verify coordination between multiple components
    • Use real in-process components that are part of the behavior under test; for external I/O see Mock Scope Decision
    • Verify flows that implement a primary acceptance criterion or cross an in-process component boundary
  3. Cross-functional Verification

    • When a new feature reaches a shared integration point, continuity of the existing feature becomes a proof obligation if its failure would break a primary user journey or public contract, or degrade a secondary observable behavior. Prove it at the cheapest boundary that can expose its failure
    • Verification pattern: Existing feature operation -> Enable new feature -> Verify continuity of existing features
    • Success criteria: Preserve the response fields and observable behavior named by the source acceptance criteria; apply a processing-time threshold only when a requirement or project configuration defines its value and measurement method
    • Designed for automatic execution in CI/CD pipelines

Test Implementation Conventions

Directory Structure and Naming

  • Tests live in a __tests__/ directory beside the module under test
  • Test files: {target-file-name}.test.ts
  • Integration test files: {target-file-name}.int.test.ts
  • Test suites: Names describing target features or situations
  • Test cases: Names describing expected behavior

Test Code Quality Rules

Keep every committed test active. Repair a test that protects current behavior. Remove a test when its behavior is no longer required and the source requirement or implementation contract confirms the removal, or when another retained test fails for every regression the removed test detects.

Test Quality Criteria

Boundary and Error Case Coverage

Include boundary values and error cases alongside happy paths.

Literal Expected Values

Use expected values that are independent of the implementation calculation: state the contract's value directly as a literal, or take it from a separate authoritative fixture or specification. An expectation computed from the same constants or formula as the subject passes even when both are wrong. When a mock supplies the input, the expected value differs from the mock's return value wherever the implementation transforms it.

Result-Based Verification

Verify results, not invocation order or count.

Meaningful Assertions

Each test asserts the property its consumer depends on and the state the operation established, not merely that a value came back.

Capability Probe Postconditions

A probe that checks whether something works passes only when it uses the consumer's boundary and asserts the exact property the consumer needs.

Command exit status, successful import, and object existence show the thing is reachable, so treat them as the probe's preconditions and put the consumer-facing property in the assertion.

Probe intentSetup evidence (insufficient alone)Assert instead
The module is usableimport resolves, expect(mod).toBeDefined()Call the exported function through the consumer's entry point and assert its returned value or effect
The command worksExit code 0The output, file, or state change the caller consumes
The config is appliedThe config file parsesThe observable behavior the config is supposed to change
The migration ranThe command reported successA query through the real engine returns the migrated shape

Mock Scope Decision

Use real implementations for every in-process component whose coordination is under test. Substitute a direct external I/O dependency when the test targets higher-layer behavior; use the real engine or a production-equivalent test instance when the external adapter, query, migration, or service contract itself is the target. When substituting, still assert the request the subject sends and the response shape it accepts, so the boundary contract stays verified.

Property-based Testing (fast-check)

Use fast-check in fc.assert(fc.property(...)) form when a Design Doc AC carries a Property annotation.

Mock Type Safety Enforcement

Type a mock to the surface the subject under test actually consumes — Pick<T, 'usedMethod'> — rather than the full interface, so an unused method changing shape does not break the test and a consumed one does. Constrain mock object literals with satisfies against that picked type so an extra or misnamed property fails at compile time.

Data Layer Testing

What Mocks Cannot Verify

Mocks validate call patterns, so these data-layer properties pass through undetected under mock-only testing:

  • Schema mismatches (table names, column names, data types)
  • Query correctness (joins, filters, aggregations, grouping)
  • Database constraints (NOT NULL, UNIQUE, foreign keys)
  • Migration compatibility (schema changes that leave code out of sync)

Routing rule: when one of these properties is the target — including the repository or data-access implementation itself — verify against a real engine per the ladder below. When data access is a dependency rather than the subject, mocks are correct: business logic receiving data (mock the repository, test the service), error-handling paths (connection failures, timeouts), and unit tests where the data layer is not under test.

Real Database Testing (Environment-Dependent)

Options for verifying data layer correctness against a real database engine:

  • Containerized databases for CI environments
  • In-memory databases for fast feedback (note: dialect differences may mask issues)
  • Dedicated test databases with seed data

Select the first option that matches repository evidence:

  1. Use the CI-configured database harness when present.
  2. Otherwise use the same database engine in a container when container execution is available.
  3. Use an in-memory database only when the verified behavior is dialect-independent; record the dialect behavior left unproven.
  4. Use a dedicated test database when the repository already provisions and isolates one.

When none is available and data-layer correctness is the target, stop and report the missing environment prerequisite. A mock-only result is not evidence of query, schema, constraint, or migration correctness.

AI-Generated Code and Schema Awareness

Generated data-access code can be syntactically correct while referencing schema elements that do not exist, and mock-based tests pass either way. Design Docs therefore carry explicit schema references, so review can cross-check documented schema against the data-access code.

Frequently asked questions

What does the Typescript Testing AI skill do?

Applies repository-aware TypeScript test design, behavior evidence, isolation, and mock-boundary criteria. Use when writing or reviewing unit tests.

Why use Typescript Testing on TypingMind?

Because you install it once and use it with any model. Typescript Testing is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Typescript Testing in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/shinpr/ai-coding-project-boilerplate/tree/main/.claude/skills-en/typescript-testing. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Typescript Testing?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Typescript Testing?

As many as you like. As long as a model supports skills, you can use Typescript Testing with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Typescript Testing AI skill free?

Yes. It is published on GitHub by shinpr under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇