Typescript Advanced Types
rolling-scopes/rsschool-app
Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.
A skill your agent uses when encountering TypeScript any types, type errors, or lax type checking - eliminates type holes and enforces strict type safety through proper interfaces, type guards, and…
$ npx skills add pr-pm/prpm --skill typescript-type-safety -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install pr-pm/prpm typescript-type-safety --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/pr-pm/prpm.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/typescript-type-safety .claude/skills/typescript-type-safety && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "typescript-type-safety" agent skill from https://github.com/pr-pm/prpm/tree/main/.claude/skills/typescript-type-safety into .claude/skills/typescript-type-safety/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "typescript-type-safety", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/pr-pm/prpm/tree/main/.claude/skills/typescript-type-safetyType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add pr-pm/prpm --skill typescript-type-safety -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install pr-pm/prpm typescript-type-safety --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pr-pm/prpm.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.claude/skills/typescript-type-safety .agents/skills/typescript-type-safety && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "typescript-type-safety" agent skill from https://github.com/pr-pm/prpm/tree/main/.claude/skills/typescript-type-safety into .agents/skills/typescript-type-safety/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "typescript-type-safety", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add pr-pm/prpm --skill typescript-type-safety -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install pr-pm/prpm typescript-type-safety --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pr-pm/prpm.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.claude/skills/typescript-type-safety .cursor/skills/typescript-type-safety && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "typescript-type-safety" agent skill from https://github.com/pr-pm/prpm/tree/main/.claude/skills/typescript-type-safety into .cursor/skills/typescript-type-safety/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "typescript-type-safety", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/pr-pm/prpm.git --path .claude/skills/typescript-type-safety--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add pr-pm/prpm --skill typescript-type-safety -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install pr-pm/prpm typescript-type-safety --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pr-pm/prpm.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.claude/skills/typescript-type-safety .gemini/skills/typescript-type-safety && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "typescript-type-safety" agent skill from https://github.com/pr-pm/prpm/tree/main/.claude/skills/typescript-type-safety into .gemini/skills/typescript-type-safety/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "typescript-type-safety", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install pr-pm/prpm typescript-type-safetyInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add pr-pm/prpm --skill typescript-type-safety -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/pr-pm/prpm.git skills-src && mkdir -p .github/skills && cp -r skills-src/.claude/skills/typescript-type-safety .github/skills/typescript-type-safety && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "typescript-type-safety" agent skill from https://github.com/pr-pm/prpm/tree/main/.claude/skills/typescript-type-safety into .github/skills/typescript-type-safety/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "typescript-type-safety", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add pr-pm/prpm --skill typescript-type-safety -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install pr-pm/prpm typescript-type-safety --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pr-pm/prpm.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.claude/skills/typescript-type-safety .opencode/skills/typescript-type-safety && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "typescript-type-safety" agent skill from https://github.com/pr-pm/prpm/tree/main/.claude/skills/typescript-type-safety into .opencode/skills/typescript-type-safety/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "typescript-type-safety", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
typescript-type-safetyA skill your agent uses when encountering TypeScript any types, type errors, or lax type checking - eliminates type holes and enforces strict type safety through proper interfaces, type guards, and…
Typescript Type Safety is an agent skill from pr-pm/prpm. Use when encountering TypeScript any types, type errors, or lax type checking - eliminates type holes and enforces strict type safety through proper interfaces, type guards, and module augmentation
Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development, covering Type safety. It works with TypeScript. The repository describes itself as: The universal registry for AI coding tools. The licence is MIT.
5 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 5f993e6. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
npmFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use npm, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Typescript Type Safety loads about 2.1k tokens when it runs. Until then it costs about 55 tokens; SKILL.md has 565 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from pr-pm/prpm at commit 5f993e6, republished under its MIT licence (© pr-pm). 565 words, ~2,128 tokens.
.claude/skills/typescript-type-safety/SKILL.md (or your agent's skills folder).Zero tolerance for any types. Every any is a runtime bug waiting to happen.
Replace any with proper types using interfaces, unknown with type guards, or generic constraints. Use @ts-expect-error with explanation only when absolutely necessary.
Use when you see:
: any in function parameters or return typesas any type assertionsanyDon't use for:
.d.ts files (contribute upstream instead)Prefer in this order:
unknown (with type guards)never (for impossible states)Never use: any
| Pattern | Bad | Good |
|---|---|---|
| Error handling | catch (error: any) | catch (error) { if (error instanceof Error) ... } |
| Unknown data | JSON.parse(str) as any | const data = JSON.parse(str); if (isValid(data)) ... |
| Type assertions | (request as any).user | (request as AuthRequest).user |
| Double casting | return data as unknown as Type | Align interfaces instead: make types compatible |
| External libs | const server = fastify() as any | declare module 'fastify' { ... } |
| Generics | function process(data: any) | function process<T extends Record<string, unknown>>(data: T) |
// ❌ BAD
try {
await operation();
} catch (error: any) {
console.error(error.message);
}
// ✅ GOOD - Use unknown and type guard
try {
await operation();
} catch (error) {
if (error instanceof Error) {
console.error(error.message);
} else {
console.error('Unknown error:', String(error));
}
}
// ✅ BETTER - Helper function
function toError(error: unknown): Error {
if (error instanceof Error) return error;
return new Error(String(error));
}
try {
await operation();
} catch (error) {
const err = toError(error);
console.error(err.message);
}// ❌ BAD
const data = await response.json() as any;
console.log(data.user.name);
// ✅ GOOD - Type guard
interface UserResponse {
user: {
name: string;
email: string;
};
}
function isUserResponse(data: unknown): data is UserResponse {
return (
typeof data === 'object' &&
data !== null &&
'user' in data &&
typeof data.user === 'object' &&
data.user !== null &&
'name' in data.user &&
typeof data.user.name === 'string'
);
}
const data = await response.json();
if (isUserResponse(data)) {
console.log(data.user.name); // Type-safe
}// ❌ BAD
const user = (request as any).user;
const db = (server as any).pg;
// ✅ GOOD - Augment third-party types
import { FastifyRequest, FastifyInstance } from 'fastify';
interface AuthUser {
user_id: string;
username: string;
email: string;
}
declare module 'fastify' {
interface FastifyRequest {
user?: AuthUser;
}
interface FastifyInstance {
pg: PostgresPlugin;
}
}
// Now type-safe everywhere
const user = request.user; // AuthUser | undefined
const db = server.pg; // PostgresPlugin// ❌ BAD
function merge(a: any, b: any): any {
return { ...a, ...b };
}
// ✅ GOOD - Constrained generic
function merge<
T extends Record<string, unknown>,
U extends Record<string, unknown>
>(a: T, b: U): T & U {
return { ...a, ...b };
}// ❌ BAD - Double cast indicates misaligned types
interface SearchPackage {
id: string;
type: string; // Too loose
}
interface RegistryPackage {
id: string;
type: PackageType; // Specific enum
}
return data.packages as unknown as RegistryPackage[]; // Hiding incompatibility
// ✅ GOOD - Align types from the source
interface SearchPackage {
id: string;
type: PackageType; // Use same specific type
}
interface RegistryPackage {
id: string;
type: PackageType; // Now compatible
}
return data.packages; // No cast needed - types matchRule: If you need as unknown as Type, your interfaces are misaligned. Fix the root cause, don't hide it with double casts.
Always use .js extension for relative imports in ESM projects.
Node.js ESM requires explicit file extensions. TypeScript compiles .ts → .js, so imports must reference the output extension.
// ❌ BAD - Will fail at runtime in ESM
import { helper } from './utils';
import { CLIError } from '../utils/cli-error';
import type { Package } from './types/package';
// ✅ GOOD - Explicit .js extensions
import { helper } from './utils.js';
import { CLIError } from '../utils/cli-error.js';
import type { Package } from './types/package.js';Why this is a TypeScript/type safety issue:
ERR_MODULE_NOT_FOUNDTSConfig for ESM:
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
// OR
"module": "ESNext",
"moduleResolution": "bundler"
}
}Common Import Mistakes:
| Pattern | Issue | Fix |
|---|---|---|
import { x } from './file' | Missing extension | import { x } from './file.js' |
import { x } from './dir' | Missing index | import { x } from './dir/index.js' |
import pkg from 'pkg/subpath' | Package export | Check package.json exports field |
Linting for Import Extensions:
# Find imports missing .js extension
grep -rn "from '\.\.\?/[^']*[^j][^s]'" --include="*.ts" src/
# ESLint rule (if using eslint)
# "import/extensions": ["error", "always", { "ignorePackages": true }]| Mistake | Why It Fails | Fix |
|---|---|---|
Using any for third-party libs | Loses all type safety | Use module augmentation or @types/* package |
as any for complex types | Hides real type errors | Create proper interface or use unknown |
as unknown as Type double casts | Misaligned interfaces | Align types at source - same enums/unions |
| Skipping catch block types | Unsafe error access | Use unknown with type guards or toError helper |
| Generic functions without constraints | Allows invalid operations | Add extends constraint |
Ignoring ts-ignore accumulation | Tech debt compounds | Fix root cause, use @ts-expect-error with comment |
Missing .js import extensions | ESM runtime failures | Always use .js for relative imports |
Enable all strict options for maximum type safety:
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
}
}grep -r ": any\|as any" --include="*.ts" src/npm run build must succeedBefore type safety:
After type safety:
Remember: Type safety isn't about making TypeScript happy - it's about preventing runtime bugs. Every any you eliminate is a production bug you prevent.
© pr-pm, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .claude/skills/typescript-type-safety of pr-pm/prpm.
Open the folder on GitHubat commit 5f993e6
Typescript Type Safety next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Typescript Type Safety this skillpr-pm/prpm | 122 | — | ~2.1k | Automated safety check: Pass | MIT | |
| Typescript Advanced Typesrolling-scopes/rsschool-app | 10k | 24 repos | ~4.2k | Automated safety check: Pass | MPL-2.0 | |
| Wagmi Feature Developmentwevm/wagmi | 6.8k | — | ~3.8k | Automated safety check: Pass | MIT | |
| Convert Internal Package to TypeScriptTryGhost/Ghost | 55k | — | ~1.2k | Automated safety check: Pass | MIT | |
| Add NodeBridge Handlerneovateai/neovate-code | 1.6k | — | ~1k | Automated safety check: Pass | MIT | |
| AST Visitor Pattern for Unionsprisma/orm | 48k | — | ~830 | Automated safety check: Pass | Apache-2.0 |
rolling-scopes/rsschool-app
Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.
wevm/wagmi
Walks through adding a Wagmi feature across its layers: a Viem-based core action, TanStack Query options, and React and Vue bindings.
TryGhost/Ghost
Moves a legacy internal Ghost package from JavaScript and CommonJS to TypeScript and ESM in three focused commits that keep git file history intact.
neovateai/neovate-code
Walks through adding a message handler to NodeBridge in Neovate Code, from the implementation and its types to an optional test entry and a run with Bun.
prisma/orm
Replaces a plain TypeScript union plus switch statements with frozen subclasses and a visitor interface when several places dispatch on the same variants.
zap-studio/monorepo
Create a bumpy bump file describing which packages changed and how, for version bumping and changelog generation.
pr-pm/prpm
Reference for writing Claude Code agent files: location, frontmatter fields, validation limits, tool and model choices, and the required content format.
pr-pm/prpm
Covers how to build, configure and publish Claude Code hooks: event types, exit codes, JSON I/O, and PRPM packaging.
pr-pm/prpm
Shows how to write .claude/rules/ files correctly: paths frontmatter instead of globs, quoted glob patterns, global rules and conversion of Cursor rules.
pr-pm/prpm
Reference for writing portable Agent Skills packages, covering SKILL.md frontmatter limits, name rules, directory layout and where Codex CLI, GitHub Copilot and Amp look for skills.
pr-pm/prpm
A skill your agent uses when building custom Kiro AI agents or when user asks for agent configurations - provides JSON structure, tool configuration, prompt patterns, and security best practices for…
pr-pm/prpm
A skill your agent uses when creating OpenCode agents - provides markdown format with YAML frontmatter, mode/tools/permission configuration, and best practices for specialized AI assistants
Works with
Categories
A skill your agent uses when encountering TypeScript any types, type errors, or lax type checking - eliminates type holes and enforces strict type safety through proper interfaces, type guards, and…. Typescript Type Safety is an agent skill from pr-pm/prpm.
Typescript Type Safety fits situations like: encountering TypeScript any types; lax type checking - eliminates type holes and enforces strict type safety through proper interfaces; module augmentation.
Run `npx skills add pr-pm/prpm --skill typescript-type-safety -a claude-code`. Or copy the skill folder (.claude/skills/typescript-type-safety in pr-pm/prpm) into .claude/skills/typescript-type-safety in your project. Claude Code loads it when a task matches its description.
Run `npx skills add pr-pm/prpm --skill typescript-type-safety -a codex`. Or copy the skill folder (.claude/skills/typescript-type-safety in pr-pm/prpm) into .agents/skills/typescript-type-safety in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pr-pm/prpm --skill typescript-type-safety -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/typescript-type-safety, .gemini/skills/typescript-type-safety, .github/skills/typescript-type-safety and .opencode/skills/typescript-type-safety in your project.
Going by SKILL.md and its folder, Typescript Type Safety needs the command-line tools its instructions call (npm). Our summary lists: Node.js.
SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Typescript Type Safety is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.1k tokens (SKILL.md is roughly 8.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Typescript Type Safety: Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars), Wagmi Feature Development (wevm/wagmi, 6.8k stars), Convert Internal Package to TypeScript (TryGhost/Ghost, 55k stars) and Add NodeBridge Handler (neovateai/neovate-code, 1.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
pr-pm (a GitHub organization) maintains it in pr-pm/prpm, which has 122 GitHub stars. The repository holds 35 skills in this directory. The repository was last updated on October 6, 2026.
Source: pr-pm/prpm on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.