Automated summary
This skill lays out a set of strict TypeScript rules (const objects as single source of truth, flat interfaces, no any, type guards) to apply when writing or refactoring .ts/.tsx code.
Strengths
- Short, directly actionable rules illustrated with contrasted ✅/❌ examples
- Covers the day-to-day typing pain points: any, unknown, generics, type guards and type-only imports
- Enforces consistent conventions (const maps, flat interfaces) that ease refactoring and improve autocomplete
- Recaps standard utility types (Pick, Omit, Partial, ReturnType) with inline usage notes
Limitations
- Opinionated style: alternatives such as direct unions or nested objects are forbidden without any nuanced justification
- Does not cover compiler configuration (tsconfig, strictness flags) or lint tooling
- No coverage of advanced patterns like conditional types, mapped types or runtime validation
Use it when writing or refactoring types, interfaces and function signatures in TypeScript and you want a strict, uniform style.
Avoid it on a codebase whose guidelines explicitly allow direct unions or nested objects, or when the task is configuring TypeScript rather than authoring types.
Security analysis
SafeThe skill provides TypeScript style guidance and does not instruct destructive, exfiltrating, or obfuscated actions; the broad allowed-tools list is not paired with any risky execution instructions.
No concerns found
How this analysis is madeExamples
Refactor this function so it no longer uses any: `function parseUser(input: any): any { return input; }`. Use unknown and a type guard instead.Convert `type Status = "active" | "inactive" | "pending"` into a const object with an extracted type, and update the places where it's used.This interface has an inline nested address object — split it into a dedicated interface and reference it, keeping Admin extending User.name: typescript description: > TypeScript strict patterns and best practices. Trigger: When implementing or refactoring TypeScript in .ts/.tsx (types, interfaces, generics, const maps, type guards, removing any, tightening unknown). license: Apache-2.0 metadata: author: prowler-cloud version: "1.0" scope: [root, ui] auto_invoke: "Writing TypeScript types/interfaces" allowed-tools: Read, Edit, Write, Glob, Grep, Bash, WebFetch, WebSearch, Task
Const Types Pattern (REQUIRED)
// ✅ ALWAYS: Create const object first, then extract type
const STATUS = {
ACTIVE: "active",
INACTIVE: "inactive",
PENDING: "pending",
} as const;
type Status = (typeof STATUS)[keyof typeof STATUS];
// ❌ NEVER: Direct union types
type Status = "active" | "inactive" | "pending";
Why? Single source of truth, runtime values, autocomplete, easier refactoring.
Flat Interfaces (REQUIRED)
// ✅ ALWAYS: One level depth, nested objects → dedicated interface
interface UserAddress {
street: string;
city: string;
}
interface User {
id: string;
name: string;
address: UserAddress; // Reference, not inline
}
interface Admin extends User {
permissions: string[];
}
// ❌ NEVER: Inline nested objects
interface User {
address: { street: string; city: string }; // NO!
}
Never Use any
// ✅ Use unknown for truly unknown types
function parse(input: unknown): User {
if (isUser(input)) return input;
throw new Error("Invalid input");
}
// ✅ Use generics for flexible types
function first<T>(arr: T[]): T | undefined {
return arr[0];
}
// ❌ NEVER
function parse(input: any): any { }
Utility Types
Pick<User, "id" | "name"> // Select fields
Omit<User, "id"> // Exclude fields
Partial<User> // All optional
Required<User> // All required
Readonly<User> // All readonly
Record<string, User> // Object type
Extract<Union, "a" | "b"> // Extract from union
Exclude<Union, "a"> // Exclude from union
NonNullable<T | null> // Remove null/undefined
ReturnType<typeof fn> // Function return type
Parameters<typeof fn> // Function params tuple
Type Guards
function isUser(value: unknown): value is User {
return (
typeof value === "object" &&
value !== null &&
"id" in value &&
"name" in value
);
}
Import Types
import type { User } from "./types";
import { createUser, type Config } from "./utils";
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/typescript-strict-patterns-and-best-practices-mmbizjgl/download' --output '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl/SKILL.md.part' && mv '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl/SKILL.md.part' '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Tools declared by the author (check availability in your agent): Read, Edit, Write, Glob, Grep, Bash, WebFetch, WebSearch, Task
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl/SKILL.md' && test -s '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/typescript' && cp -R '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl' '.claude/skills/typescript'Cursor
test -f '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl/SKILL.md' && test -s '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/typescript' && cp -R '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl' '.cursor/skills/typescript'Codex
test -f '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl/SKILL.md' && test -s '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/typescript' && cp -R '.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl' '.agents/skills/typescript'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl'openskills read 'typescript-strict-patterns-and-best-practices-mmbizjgl'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/typescript-strict-patterns-and-best-practices-mmbizjgl/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.