agentleFS
MicrosoftKnown publishermicrosoft/aspire.dev/.agents/skills/twoslash-validator/SKILL.md

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

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
  1. Very specific:

    Use this skill to keep aspire.dev from shipping rendered two-slash error UI.

    line 8
  2. Very specific:

    Do not add diagnostic allowlists or suppressions.

    line 20
  3. Distinctive:

    Run commands from the repository root unless noted.

    line 24
  4. Distinctive:

    Ensure dependencies are installed:

    line 26
  5. Distinctive:

    If TypeScript API JSON changed, regenerate the two-slash declaration bundle:

    line 33
  6. Distinctive:

    Run the two-slash block gate:

    line 39
  7. Very specific:

    If the test fails, read every reported file, line, block number, and ts(...) code.

    line 45
  8. Distinctive:

    Use this order when deciding what to change:

    line 49
  9. Distinctive:

    Docs sample bug: If the TypeScript snippet calls the wrong API, uses the wrong argument shape, has a stale model name, or chains …

    line 51
  10. Very specific:

    Generated type data stale: If the sample matches the product API but src/frontend/src/data/twoslash/aspire.d.ts is stale, run pnpm …

    line 52
  11. Very specific:

    Generator type-shape gap: If regeneration is not enough because scripts/generate-twoslash-types.ts loses valid SDK shape, fix the generator …

    line 53
  12. Very specific:

    Feature not representable yet: If a correct sample cannot be represented by the current two-slash type data, remove the twoslash meta from …

    line 54
  13. Very specific:

    Do not reintroduce KNOWN_TYPE_BUGS, per-page diagnostic budgets, or equivalent allowlists.

    line 58
  14. Very specific:

    Do not disable TWOSLASH_ENABLED to make the test pass.

    line 59
  15. Very specific:

    Do not change noErrorValidation as a substitute for fixing diagnostics.

    line 60
  16. Distinctive:

    Do not hide failures by changing the fence language away from TypeScript unless the sample is not TypeScript.

    line 61
  17. Very specific:

    Do not edit generated aspire.d.ts by hand.

    line 62
  18. Distinctive:

    Before finishing a two-slash-related change, run:

    line 66
  19. Distinctive:

    If you changed the generator, also run:

    line 73

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 twoslash meta flag
  • Updating TypeScript AppHost examples that import './.aspire/modules/aspire.mjs'
  • Refreshing src/frontend/src/data/ts-modules/ or src/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.

  1. Ensure dependencies are installed:

    Set-Location -Path .\src\frontend
    pnpm install --frozen-lockfile --prefer-offline
  2. If TypeScript API JSON changed, regenerate the two-slash declaration bundle:

    pnpm twoslash-types
  3. Run the two-slash block gate:

    pnpm test:unit:twoslash-blocks
  4. 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:

  1. 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.
  2. Generated type data stale: If the sample matches the product API but src/frontend/src/data/twoslash/aspire.d.ts is stale, run pnpm twoslash-types and commit the regenerated bundle.
  3. Generator type-shape gap: If regeneration is not enough because scripts/generate-twoslash-types.ts loses valid SDK shape, fix the generator and regenerate aspire.d.ts.
  4. Feature not representable yet: If a correct sample cannot be represented by the current two-slash type data, remove the twoslash meta 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_ENABLED to make the test pass.
  • Do not change noErrorValidation as 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.ts by 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-blocks

If you changed the generator, also run:

pnpm test:unit:twoslash-types

Download now (ZIP)

Does 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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.