ericrisco/rsc-harness / skills/typescript
typescript
VerifiedUse when writing or fixing TypeScript type code (.ts/.tsx/.d.ts), modeling data with generics/unions/branded types, diagnosing narrowing failures, or configuring tsconfig and the build toolchain. NOT runtime code, fs/streams/http (that is `nodejs`); NOT component/route typing (that is `react`/`nextjs`); NOT ORM type-gen (that is `drizzle-orm`).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.8 KB |
| evals/README.md | markdown | 1.0 KB |
| evals/cases.yaml | config | 3.1 KB |
| references/build-and-monorepo.md | markdown | 5.6 KB |
| references/type-system.md | markdown | 5.5 KB |
| scripts/verify.shexecutable | script | 1.7 KB |
scripts/verify.sh
View on GitHub#!/usr/bin/env bash
# verify.sh — prove the TS toolchain enforces strictness + exhaustiveness.
# Read-only on the target: writes ONLY to its own temp dir. Exits 0 with a clear
# message when no TS/node is available (no false failure on a clean machine).
set -euo pipefail
# Resolve a type-checker: prefer tsgo (TS7 preview), else npx typescript's tsc.
# Strict flags are passed on the CLI because naming files on the CLI bypasses tsconfig.
FLAGS="--noEmit --strict --noUncheckedIndexedAccess --target esnext --module nodenext --moduleResolution nodenext"
if command -v tsgo >/dev/null 2>&1; then
CHECK="tsgo"
elif command -v npx >/dev/null 2>&1; then
CHECK="npx -y -p typescript tsc"
else
echo "SKIP: no tsgo and no npx on PATH — cannot type-check. (exit 0)"
exit 0
fi
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT
# good.ts: exhaustive never guard MUST pass.
cat > "$TMP/good.ts" <<'TS'
type S = { k: "a" } | { k: "b" };
export function f(s: S): number {
switch (s.k) {
case "a": return 1;
case "b": return 2;
default: { const _: never = s; return _; }
}
}
TS
# bad.ts: missing "b" case -> never guard MUST fail to compile.
cat > "$TMP/bad.ts" <<'TS'
type S = { k: "a" } | { k: "b" };
export function f(s: S): number {
switch (s.k) {
case "a": return 1;
default: { const _: never = s; return _; }
}
}
TS
run() { ( cd "$TMP" && $CHECK $FLAGS "$1" ) >/dev/null 2>&1; }
fail=0
if run good.ts; then echo "PASS: good.ts type-checks"; else echo "FAIL: good.ts should compile"; fail=1; fi
if run bad.ts; then echo "FAIL: bad.ts should NOT compile (exhaustiveness)"; fail=1; else echo "PASS: bad.ts rejected"; fi
if [ "$fail" -ne 0 ]; then echo "verify.sh: FAILED"; exit 1; fi
echo "verify.sh: OK — strict + exhaustiveness enforced"
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |