CtrlK
BlogDocsLog inGet started
Tessl Logo
SkillPublic

typescript-advanced-type-guards

Runtime type guards, narrowing, and exhaustiveness checking for TypeScript — typeof/instanceof/in guards, custom and generic type predicates (value is T), discriminated union narrowing, assertion functions (asserts value is T), branded/nominal types validated at runtime, and exhaustive switch statements with a never guard. Use when replacing an unsafe `as` assertion with a real runtime check, fixing "Object is possibly undefined", modeling impossible states out of existence, writing an `is*` predicate, or making a switch over a union fail to compile when a case is missing.

Quality

92%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

SKILL.md
Quality
Evals
Security

Quality

Content

86%Weight 40%Scale 1-5

Reviews the quality of instructions and guidance provided to agents. Good implementation is clear, handles edge cases, and produces reliable results.

A strong, highly actionable body: every pattern ships executable BAD/GOOD TypeScript, an explicit tsc --noEmit verification loop, and a clean references table whose six files all exist as cited. The main improvement opportunity is removing duplication between 'When to Apply'/'Use When' and between the Quick Fixes and Anti-Patterns sections, and tightening the implicit workflow into a more explicit sequence.

Suggestions

Merge the 'When to Apply' and 'Use When' sections — their bullets cover the same triggers in different phrasing, and one combined list would cut roughly ten lines without losing information.

Drop or differentiate the 'Type X is not assignable to type Y' quick fix, since its BAD/GOOD pair (getValue() as string vs. typeof-narrowing) duplicates the 'NEVER silence type errors with unchecked assertions' anti-pattern almost verbatim.

Make the apply-then-verify workflow explicit — e.g., a short numbered sequence (find unsafe patterns with the rg command, replace with a guard, re-run tsc --noEmit, fix if narrowing fails) so the validation loop is a sequence rather than guidance embedded in prose.

DimensionReasoningScore

Conciseness

Lean and competent throughout — no basic-TypeScript tutorials, and the Anti-Patterns use terse BAD/WHY/GOOD blocks. However, the 'When to Apply' and 'Use When' bullet lists largely duplicate each other, and the 'Type X is not assignable' quick fix repeats the same `as string` guard example from the Anti-Patterns section nearly verbatim. This is minor trimmable duplication, matching the 4 anchor ('efficient; minor instances of over-explanation that could be trimmed') rather than 5, and well above 3.

4 / 5

Actionability

Fully executable, copy-paste-ready TypeScript code in every BAD/GOOD pair and quick fix, plus runnable commands: `npx tsc --noEmit` and `rg -n "\bany\b|@ts-ignore| as " src`. The quick fixes target the most common real TypeScript errors ('Object is possibly undefined', incompatible assignment), matching the 5 anchor where specific examples cover the common cases.

5 / 5

Workflow Clarity

An explicit validation checkpoint is present and reinforced twice — 'Verify a narrowing actually narrows by re-running `tsc --noEmit` after the change' and the Quick Commands section — plus a discovery step (the `rg` command for unsafe patterns). But the body presents a catalog of patterns rather than a sequenced apply-then-validate workflow with error-recovery steps. Fits the 4 anchor (clear sequence with most checkpoints, minor gaps); not 3 because validation is explicit rather than missing, not 5 because there is no feedback-loop or checklist structure.

4 / 5

Progressive Disclosure

The body stays an overview and delegates depth to six one-level-deep reference files, all verified to exist exactly as cited, each with a one-line 'Covers' description in a References table, plus out-of-scope pointers routing to sibling skills. This matches the 5 anchor: clear overview, well-signaled references, easy navigation.

5 / 5

Total

18

/

20

Passed

Description

96%Weight 40%Scale 1-5

Based on the skill's description, can an agent find and select it at the right time? Clear, specific descriptions lead to better discovery.

An excellent description: it enumerates the skill's concrete capabilities comprehensively and pairs them with an explicit, natural-language 'Use when' clause containing real user trigger phrases including a verbatim TypeScript error message. The only weakness is minor overlap risk with closely related TypeScript sibling skills, which the description does not itself delimit.

DimensionReasoningScore

Specificity

Lists multiple specific concrete actions with comprehensive coverage: 'typeof/instanceof/in guards, custom and generic type predicates (value is T), discriminated union narrowing, assertion functions (asserts value is T), branded/nominal types validated at runtime, and exhaustive switch statements with a never guard'. Matches the score-5 anchor; not 4 because there are no gaps in coverage of the domain.

5 / 5

Completeness

Explicitly answers both what (the enumerated guard techniques) and when via the literal 'Use when' clause with concrete trigger phrases. This mirrors the 5-anchor example structure; not 4 because the 'when' guidance is fully explicit rather than merely present.

5 / 5

Trigger Term Quality

Comprehensive natural trigger terms users would actually say: 'replacing an unsafe `as` assertion with a real runtime check', 'fixing "Object is possibly undefined"', 'writing an `is*` predicate', and 'making a switch over a union fail to compile when a case is missing'. Includes synonyms and quoted error messages; matches the 5 anchor rather than 4, where only a few natural terms would be missing.

5 / 5

Distinctiveness Conflict Risk

A clear niche (runtime-checked narrowing) with distinct triggers such as the quoted compile error and `as`-assertion replacement, but adjacent sibling skills (typescript-type-system, typescript-utility-types) cover overlapping union/utility-type territory and the description itself draws no boundary between them. Fits the 4 anchor (minor overlap risk with closely related skills) rather than 5 (minimal conflict risk).

4 / 5

Total

19

/

20

Passed

Validation

93%

Checks the skill against the spec for correct structure and formatting. All validation checks must pass before discovery and implementation can be scored.

Validation — 15 / 16 Passed

Validation for skill structure

CriteriaDescriptionResult

allowed_tools_field

'allowed-tools' contains unusual tool name(s)

Warning

Total

15

/

16

Passed

Repository

pantheon-org/tekhne

Path

skills/development/typescript-advanced/type-guards/SKILL.md

Reviewed

Table of Contents

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.