twoslash-validator
Skill196 starsChanged 6 months agoMITView on GitHub
Validate and fix two-slash TypeScript examples for aspire.dev. Use when adding or editing `twoslash` code fences, TypeScript AppHost samples, generated TypeScript API data, or failures from `pnpm test:unit:twoslash-blocks`.
- Installs packages
In this repository12 other files it gives its agents.
- aspireSkill
- code-reviewSkill
- container-imagesSkill
- doc-pr-reviewerSkill
- doc-testerSkill
- doc-writerSkill
- hex1bSkill
- playwright-cliSkill
- update-integrationsSkill
- update-samplesSkill
- whatsnewSkill
- getting-started-with-aspireSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. About 0 are common, 9 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 8
Use this skill to keep aspire.dev from shipping rendered two-slash error UI.
- Very specific: line 20
Do not add diagnostic allowlists or suppressions.
- Distinctive: line 24
Run commands from the repository root unless noted.
- Distinctive: line 26
Ensure dependencies are installed:
- Distinctive: line 33
If TypeScript API JSON changed, regenerate the two-slash declaration bundle:
- Distinctive: line 39
Run the two-slash block gate:
- Very specific: line 45
If the test fails, read every reported file, line, block number, and ts(...) code.
- Distinctive: line 49
Use this order when deciding what to change:
- Distinctive: line 51
Docs sample bug: If the TypeScript snippet calls the wrong API, uses the wrong argument shape, has a stale model name, or chains …
- Very specific: line 52
Generated type data stale: If the sample matches the product API but src/frontend/src/data/twoslash/aspire.d.ts is stale, run pnpm …
- Very specific: line 53
Generator type-shape gap: If regeneration is not enough because scripts/generate-twoslash-types.ts loses valid SDK shape, fix the generator …
- Very specific: line 54
Feature not representable yet: If a correct sample cannot be represented by the current two-slash type data, remove the twoslash meta from …
- Very specific: line 58
Do not reintroduce KNOWN_TYPE_BUGS, per-page diagnostic budgets, or equivalent allowlists.
- Very specific: line 59
Do not disable TWOSLASH_ENABLED to make the test pass.
- Very specific: line 60
Do not change noErrorValidation as a substitute for fixing diagnostics.
- Distinctive: line 61
Do not hide failures by changing the fence language away from TypeScript unless the sample is not TypeScript.
- Very specific: line 62
Do not edit generated aspire.d.ts by hand.
- Distinctive: line 66
Before finishing a two-slash-related change, run:
- Distinctive: line 73
If you changed the generator, also run:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Two-slash Validator Skill
Use this skill to keep aspire.dev from shipping rendered two-slash error UI. Any TypeScript diagnostic in a twoslash code block renders an error box on the site, so diagnostics must be fixed rather than suppressed.
When to use this skill
- Adding or editing a TypeScript code fence with the
twoslashmeta flag - Updating TypeScript AppHost examples that import
'./.aspire/modules/aspire.mjs' - Refreshing
src/frontend/src/data/ts-modules/orsrc/frontend/src/data/twoslash/aspire.d.ts - Investigating failures from
pnpm test:unit:twoslash-blocks - Reviewing docs changes that affect TypeScript sample rendering
Core rule
Do not add diagnostic allowlists or suppressions. A two-slash diagnostic is user-visible output on aspire.dev. Fix the docs sample, fix/regenerate the generated type surface, or remove the twoslash meta until the sample compiles cleanly.
Validation workflow
Run commands from the repository root unless noted.
Ensure dependencies are installed:
Set-Location -Path .\src\frontend pnpm install --frozen-lockfile --prefer-offlineIf TypeScript API JSON changed, regenerate the two-slash declaration bundle:
pnpm twoslash-typesRun the two-slash block gate:
pnpm test:unit:twoslash-blocks- If the test fails, read every reported file, line, block number, and
ts(...)code. Fix every diagnostic before considering the work complete.
Fix strategy
Use this order when deciding what to change:
- Docs sample bug: If the TypeScript snippet calls the wrong API, uses the wrong argument shape, has a stale model name, or chains incompatible resources, fix the MDX sample.
- Generated type data stale: If the sample matches the product API but
src/frontend/src/data/twoslash/aspire.d.tsis stale, runpnpm twoslash-typesand commit the regenerated bundle. - Generator type-shape gap: If regeneration is not enough because
scripts/generate-twoslash-types.tsloses valid SDK shape, fix the generator and regenerateaspire.d.ts. - Feature not representable yet: If a correct sample cannot be represented by the current two-slash type data, remove the
twoslashmeta from that block and leave the code sample visible without two-slash rendering. Do not leave a rendered diagnostic.
What not to do
- Do not reintroduce
KNOWN_TYPE_BUGS, per-page diagnostic budgets, or equivalent allowlists. - Do not disable
TWOSLASH_ENABLEDto make the test pass. - Do not change
noErrorValidationas a substitute for fixing diagnostics; it exists so the audit can collect all failures at once. - Do not hide failures by changing the fence language away from TypeScript unless the sample is not TypeScript.
- Do not edit generated
aspire.d.tsby hand; update the generator or source JSON and regenerate.
Expected final checks
Before finishing a two-slash-related change, run:
Set-Location -Path .\src\frontend
pnpm test:unit:twoslash-blocksIf you changed the generator, also run:
pnpm test:unit:twoslash-typesDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

