CtrlK
BlogDocsLog inGet started
Tessl Logo

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.

72

Quality

89%

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

78%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 reference skill: executable BAD/GOOD pairs, real commands, and a clean one-level-deep bundle that checks out against the actual references/ directory. Its main weakness is redundancy — overlapping 'When to Apply'/'Use When' sections, a prose-heavy Mindset section, and a duplicated `as`-assertion example — that costs tokens without adding guidance.

Suggestions

Merge 'When to Apply' and 'Use When' into a single trigger list — they currently restate the same conditions in two forms.

Trim the Mindset paragraph to its actionable core (verify with tsc --noEmit, prefer narrowing over asserting, use exhaustive switches) and cut the philosophical framing.

Remove the duplication between the 'Type X is not assignable to type Y' Quick Fix and the 'NEVER silence type errors with unchecked assertions' Anti-Pattern, which show the same before/after code.

DimensionReasoningScore

Conciseness

The code-heavy sections are lean, but there is avoidable slack: the "Mindset" paragraph carries philosophical prose Claude does not need ("A type guard is a promise the compiler will hold you to only if the runtime check underneath it is honest"), "When to Apply" and "Use When" restate the same triggers, and the unsafe-`as` fix appears in both Quick Fixes and Anti-Patterns. This fits the anchor for 'mostly efficient but could be tightened' better than the minor-trim anchor above it.

3 / 5

Actionability

Guidance is fully executable: runnable commands ("npx tsc --noEmit", "rg -n \"\\bany\\b|@ts-ignore| as \" src") and complete copy-paste TypeScript BAD/GOOD pairs covering the common cases (undefined guard, `as` replacement, discriminant widening, exhaustive switch), matching the anchor for copy-paste ready coverage.

5 / 5

Workflow Clarity

Each pattern is an unambiguous BAD-to-GOOD transform and an explicit verification checkpoint is written ("Verify a narrowing actually narrows by re-running `tsc --noEmit` after the change"), but the find-fix-verify pieces sit in separate sections with no sequencing that binds them into a workflow, leaving a minor gap versus the explicit-sequence anchor.

4 / 5

Progressive Disclosure

A References table clearly signals six one-level-deep files with a "Covers" description each; all six referenced paths exist in references/ and match their advertised topics, while high-frequency patterns are kept inline and deeper detail (multi-level brands, pattern matching) is correctly deferred — matching the well-signaled, easy-navigation anchor.

5 / 5

Total

17

/

20

Passed

Description

100%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 exemplary description: a dense, specific capability list followed by an explicit "Use when" clause whose triggers include a verbatim compiler error message. It is distinguishable from sibling TypeScript skills and free of fluff despite its length.

DimensionReasoningScore

Specificity

The description enumerates concrete, specific capabilities — "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" — comprehensively covering the runtime-narrowing domain with no meaningful gaps, matching the anchor-5 example.

5 / 5

Completeness

It explicitly answers both what (the first sentence's full capability list) and when (four concrete trigger phrases in the "Use when" clause), mirroring the rubric's anchor-5 good example; the when is fully explicit rather than merely present.

5 / 5

Trigger Term Quality

The "Use when" clause quotes phrases users naturally say, including a verbatim compiler error ("fixing 'Object is possibly undefined'") plus "replacing an unsafe `as` assertion", "writing an `is*` predicate", and "making a switch over a union fail to compile when a case is missing", with strong synonym coverage across the domain.

5 / 5

Distinctiveness Conflict Risk

It carves a clear niche — runtime validation and narrowing — with triggers (runtime check, narrowing, exhaustiveness) that would not fire for the adjacent concerns it steers away from (compiler config, utility-type mechanics, type-system theory, schema-validation libraries).

5 / 5

Total

20

/

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.

Validation15 / 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
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.