kjanat/skills · Archived

twoslash

Guides authoring and review of Twoslash-powered TypeScript docs examples, including hidden setup, type queries, completions, diagnostics, and multi-file snippets.

First seen Jun 6, 2026

Installation

$ npx skills add kjanat/skills --skill twoslash

Summary

  • Guides authoring and review of Twoslash-powered TypeScript docs examples, including hidden setup, type queries, completions, diagnostics, and multi-file snippets.
  • Use when writing or reviewing `ts twoslash` fences or when docs examples need `---cut---`, `^?`, `^|`, `@filename`, or exact error assertions.

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from kjanat/skills · top by installs.

npx skills add kjanat/skills

Browse all from kjanat/skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

License LICENSE
Default branch master
Open issues 0
Status Archived

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.0
LicenseMIT
CompatibilityRequires Claude Code CLI for eval runs. `scripts/run-evals.py` uses `uv run` with Python 3.14.
Declared agents claude-code
More metadata
author
kjanat
version
1.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 6,912 B
  • docs AGENTS.md 3,260 B
  • docs SUMMARY.md 258 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 4 installs

SKILL.md

Twoslash

Use for docs examples powered by Twoslash.

Scope and defaults

  • Prefer the smallest rendered snippet that still teaches the point.
  • Keep setup imports, helper declarations, and fake files type-visible but reader-hidden with cut directives.
  • Prefer // @errors: ... when the error itself is part of the lesson.
  • Prefer // @noErrors only when the snippet is intentionally incomplete for some other reason, such as completion demos.
  • Prefer // @filename: for multi-file context instead of explaining missing imports in prose.
  • Prefer // @showEmit only when the emitted JS, .d.ts, or map file is the teaching target.
  • Do not reach for this skill for plain TypeScript snippets that do not rely on Twoslash behavior.

Gotchas

  • ^?, ^|, and ^^^ always apply to the previous line.
  • Do not eyeball marker spacing like // ^|; use uv run scripts/inspect-markers.py <file> or another column-aware tool to count columns.
  • Hidden code still participates in type checking and editor metadata; prefer cutting setup over deleting it.
  • @filename: stays visible unless you cut it away on purpose.
  • @showEmittedFile is only meaningful together with @showEmit.

Fast triage

What does the user need?
├─ Show an inferred type or resolved symbol
│  └─ references/notations.md -> query markers
├─ Show autocomplete or highlight a span
│  └─ references/notations.md -> query markers
├─ Hide setup, fixtures, or boilerplate
│  └─ references/patterns.md -> hidden-setup patterns
├─ Model multiple files or fake imports
│  └─ references/patterns.md -> multi-file patterns
├─ Show or validate diagnostics
│  └─ references/notations.md -> error flags
├─ Show emitted JS / .d.ts / source maps
│  └─ references/notations.md -> emit flags
└─ Explain provenance or edge options
   └─ references/source-index.md

Response workflow

  1. Identify whether this is new authoring or review of an existing snippet.
  2. Identify the teaching goal: type, completion, highlight, hidden setup, diagnostics, or emit.
  3. Keep the rendered sample minimal; move scaffolding into cut regions or virtual files.
  4. Add the smallest directive set that proves the point.
  5. If errors are intentional, prefer exact validation with @errors over blanket suppression.
  6. If the snippet is multi-file or emit-focused, verify the visible file is the one the reader actually needs.
  7. Name the exact directives in the answer so the user can copy them directly.

Authoring defaults

  • ^? for inferred or resolved types.
  • ^| for completion lists; pair with @noErrors when the expression is intentionally unfinished.
  • ^^^ for visual emphasis, not semantic explanation.
  • ---cut--- or ---cut-before--- to hide setup above the visible snippet.
  • ---cut-after--- or ---cut-start--- / ---cut-end--- to hide trailing or middle noise.
  • @filename: to create virtual files, including fake node_modules/@types shims.

Reading Order

Task Files to read
New to Twoslash authoring [SKILL.md] -> [references/notations.md] -> [references/patterns.md]
Pick the right directive [references/notations.md]
Copy a known-good shape [references/examples.md]
Hide fixtures or multi-file setup [references/patterns.md]
Explain lesser-used options or provenance [references/source-index.md]
Do a wider upstream docs sweep [example-docs.txt] -> [references/source-index.md]
Run or inspect evals [evals/README.md] -> [scripts/run-evals.py]
Check marker alignment [scripts/inspect-markers.py]
Review a noisy or broken snippet [references/patterns.md] -> [references/notations.md]

Scripts

Script Purpose
[scripts/run-evals.py] Runs response-quality evals and trigger checks against the Twoslash skill
[scripts/inspect-markers.py] Prints real line/column counts for ^?, ^^^, `^\ markers. (NOTE: IN , ^\ ` THE SLASH IN FRONT OF THE PIPE IS ONLY HERE FOR MARKDOWN ESCAPING)

In This Reference

File Purpose
[references/notations.md] Exact notation names, flags, and when to use them
[references/examples.md] Small copy-paste examples for common Twoslash patterns
[references/patterns.md] Authoring defaults, hidden-setup patterns, and review checklist
[references/source-index.md] Upstream source URLs and provenance notes
[example-docs.txt] Local gitingest snapshot of upstream Twoslash docs
[evals/README.md] How to run the regression harness and read its outputs

[references/notations.md]: ./references/notations.md [references/examples.md]: ./references/examples.md [references/patterns.md]: ./references/patterns.md [references/source-index.md]: ./references/source-index.md [example-docs.txt]: ./example-docs.txt [evals/README.md]: ./evals/README.md [scripts/run-evals.py]: ./scripts/run-evals.py [scripts/inspect-markers.py]: ./scripts/inspect-markers.py [SKILL.md]: ./SKILL.md