feat(typescript): add tsc-blindspots and type-safe authoring, JS->TS migration skills - #69
feat(typescript): add tsc-blindspots and type-safe authoring, JS->TS migration skills#69MajorLift wants to merge 11 commits into
tsc-blindspots and type-safe authoring, JS->TS migration skills#69Conversation
…d by the `typescript-typing` skill Their content now ships as the `typescript-typing` skill in MetaMask#69, where it distributes via the CLI — knowledge/ files are never synced.
typescript-typing skill (any-handling + type derivation)typescript domain: avoid-any, derive-types, decompose-large-files
…-types, decompose-large-files
…ary-identification is step one of any migration
…d exception (bivariant callback `any`)
…und unit conversion, swap in the stronger derive-types example, slim CHANGELOG - migration-context-cost: line count is a factor not a non-factor; fan-in is a reading cost (not a change/review surface), fan-out is the change surface; drop the wrong "upstream types land first" and off-topic barrel bullet - decompose-large-files: the point is converting to TS in small self-contained units, not extraction - derive-types: replace the NetworkState restatement with the reinvented-messenger + hand-copied-return example (derive via `ReturnType<Action['handler']>`) - CHANGELOG: list the domain, not each skill
…action is optional
5e7bc67 to
801758f
Compare
CHANGELOG.md tracks consumer-facing changes to the `@metamask/skills` package, per CONTRIBUTING's "CLI / tooling changes" section. No merged skill-only PR adds an entry (MetaMask#80, MetaMask#78, MetaMask#70, MetaMask#62, MetaMask#61 all touch zero changelog lines). It was also the sole source of this branch's conflict with `main`, since every skill PR edits the same `[Unreleased]` block.
typescript domain: avoid-any, derive-types, decompose-large-files…main Was a separate PR against `domains/testing`. It belongs here: its subject is whether a hand-written type agrees with its authoritative source, which is the question `derive-types` answers from the authoring side, and it shares this domain's premise that a green `tsc` is not evidence the types are correct. Directory name and frontmatter `name` already agree; only the domain moved.
typescript-compiler-blindspot and authoring, migration skills
typescript-compiler-blindspot and authoring, migration skillstypescript-compiler-blindspots and type-safe authoring, JS->TS migration skills
Context budgetWhat this PR costs an agent, measured from an install rather than read from the diff. Three tiers, and only the first is unavoidable.
Frontmatter is the only tier paid unconditionally — every agent loads it on every run once the skill is installed, used or not, because it is what the agent reads to decide relevance. The 28 skills across the eleven open skill PRs sit at a median of ~1,716 tokens selected and ~1,860 with references followed. All are within the 1,536-character description budget. Selected is paid only when the agent picks the skill. + refs & knowledge is the ceiling if every bundled reference is then read; it is a worst case, not an expectation. Method
These figures are pinned to the commit above and drift on every push; #96 tracks automating them. |
The skill lives in the `typescript` domain, so the prefix repeated information already carried by the path and by every discovery surface that shows it. Installed as `mms-compiler-blindspots`.
typescript-compiler-blindspots and type-safe authoring, JS->TS migration skillscompiler-blindspots and type-safe authoring, JS->TS migration skills
compiler-blindspots and type-safe authoring, JS->TS migration skillstsc-blindspots and type-safe authoring, JS->TS migration skills
Skills install flat as `mms-<name>`, so `domains/typescript/` does not disambiguate the name at the callsite — and "compiler" reads as React Compiler in a repo where that is a live subject. The skill is about `tsc` specifically: its own first clause is "the type defects `tsc` is structurally unable to report". Also adds the slash trigger to the description, which listed only prose phrases.
Adds a
typescriptdomain with five experimental skills — the reasoning layer for TypeScript authoring and JS→TS migration thatcoding-guidelinesonly gestures at.Why it earns a place as an extension skill: the extension is a large, ongoing JS→TS migration authored increasingly by AI agents (Claude, Cursor, Codex, headless cloud agents). Three failure modes recur under conversion pressure — reaching for
any, hand-writing ad-hoc types that duplicate an authoritative source, and converting a multi-thousand-line file in one unreviewable pass.@typescript-eslint/no-explicit-anyis a CI hard-gate for the first; the reasoning behind all three is un-lintable and belongs in a skill that reaches every operator.Skills
avoid-any—anyis a directive that disables type checking, not a wide type. Substitute by position (assignee →unknown, assigned →never); the one exception is a generic constraint, declared with an inline eslint-disable.derive-types— derive from authoritative sources (indexed access,typeof,ReturnType/Parameters,Pick/Omit,Infer<typeof struct>) instead of ad-hoc types that duplicate, run too wide, and drift. Grounded in a real extension counterexample (#42583).decompose-large-files— decompose a large file by coherent, independently-mergeable units to improve modularity, maintainability, and reviewability, and to unblock incremental TS migration. Extract by coherent subject; never fragment for its own sake. Modeled on theMetamaskControllerdecomposition (#41735).migration-context-cost— reason about the fan-in/fan-out cost of a conversion: how much context a file drags in, and therefore whether it is a cheap first migration or one that pulls half the repo with it.tsc-blindspots— find the type defectstscis structurally unable to report. A green build is not evidence the types are correct: hand-written types that restate an authoritative source can disagree with it, and the language and config carry standing blind spots.Grounded in
MetaMask/contributor-docsdocs/typescript.md. Shipped experimental (opt-in via--maturity experimental); norepos/overlay, so it applies tometamask-extension,metamask-mobile, andcorealike. Commits GPG-signed.tsc-blindspotslives here rather than intesting(it supersedes #85, which placed it there). Its subject is whether a hand-written type agrees with its authoritative source — the questionderive-typesanswers from the authoring side, one step earlier. Both rest on this domain's premise that a greentscproves well-formedness, not correctness; in a partially-migrated repo withcheckJsoff it often cannot prove even that. It shipsscripts/substitution-ab.shplus three references.Validation runs
Trial runs of this PR's skills against merged
metamask-extensionPRs nobody flagged. Every claim was re-verified against the real diff before posting. Clean results are included on purpose — a skill that only ever reports problems cannot be calibrated.tsc-blindspotsLog.topics; naive probe reports false cleanEach comment carries a trial-run disclaimer and links back here for feedback.