Frontend Typescript Patterns

Use when the user asks about TypeScript in frontend code: generic components, discriminated unions for UI state, type guards and narrowing, type-safe API clients, satisfies, typing props and events. Produces type-safe component and API patterns. Not for TypeScript language basics or compiler setup (use typescript).

45 stars 6 forksSoftware Development

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add j4flmao/agent-skills --skill frontend-typescript-patterns
Manual install
git clone --depth 1 https://github.com/j4flmao/agent-skills.git /tmp/agent-skills
mkdir -p ~/.claude/skills
cp -r /tmp/agent-skills/skills/frontend/universal/typescript-patterns ~/.claude/skills/frontend-typescript-patterns

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# TypeScript Patterns for Frontend

## Purpose
Write type-safe frontend code with generic components, typed API clients, discriminated unions for state, and reliable type guards.

## Agent Protocol

### Trigger
Exact user phrases: "TypeScript patterns", "generic components", "type-safe API", "discriminated unions", "type guards", "type narrowing", "TS patterns", "type-safe React".

### Input Context
Before activating, verify:
- The frontend framework in use (React, Vue, Angular, etc.).
- Whether the focus is on components, API clients, or state types.

### Output Artifact
No file output. Produces TypeScript pattern implementations as text.

### Response Format
```
Pattern: {name}
File: {file path suggestion}
Code:
{code block with TS implementation}
```

No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick.

### Completion Criteria
- [ ] Generic components use proper constraint bounds (`extends`) — never `any`.
- [ ] API client returns typed responses with discriminated success/error union.
- [ ] UI state modeled as discriminated union — no boolean flags for mutually exclusive states.
- [ ] Type guards narrow correctly at runtime.
- [ ] No unsafe casts (`as`) without a type guard or zod schema backing them.

### Max Response Length
4096 tokens.

## TypeScript Architecture / Decision Trees

### Pattern Selection Decision Tree
Read the full skill on GitHub

Details

Skill name
frontend-typescript-patterns
Path
skills/frontend/universal/typescript-patterns/SKILL.md
License
MIT
Repo updated
17 November 2026

FAQ

What does the Frontend Typescript Patterns skill do?

Use when the user asks about TypeScript in frontend code: generic components, discriminated unions for UI state, type guards and narrowing, type-safe API clients, satisfies, typing props and events. Produces type-safe component and API patterns. Not for TypeScript language basics or compiler setup (use typescript).

How do I install the Frontend Typescript Patterns skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add j4flmao/agent-skills --skill frontend-typescript-patterns. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Frontend Typescript Patterns popular?

It lives in j4flmao/agent-skills, which has 45 GitHub stars and 6 forks.

Related skills

Agent Observability

45

j4flmao/agent-skills

Use when the user asks about agent observability, tracing agent reasoning, debugging an agent loop, OpenTelemetry GenAI spans for LLM calls, LLM cost tracking per agent, agent audit logs or hallucination/eval monitoring in production. Produces instrumentation config, trace schema, dashboards, alerts and cost attribution. Not for generic service tracing without LLMs (use devops-opentelemetry).

DevOps & Cloud

AI Agent Architectures

45

j4flmao/agent-skills

Use when the user asks to build an AI agent, design an agent that calls tools and keeps memory, write an agent system prompt or pick an agent framework (Claude Agent SDK, OpenAI Agents SDK, LangGraph). Produces an architecture brief covering loop, tools, memory, guardrails and evals, routing depth to child skills. Not for workflow patterns (use ai-agentic-workflows).

AI, LLMs & Agents

AI Agent Core Loop

45

j4flmao/agent-skills

Use when the user asks about the agent loop, ReAct vs plan-and-solve, re-planning, Reflexion, an agent stuck in a loop, max iterations or termination conditions. Produces a loop spec or patch with state, success predicate, caps and no-progress detection. Not for overall agent design (use ai-agent-architectures) or tool schemas (use tool-calling-principles).

AI, LLMs & Agents

Game Engine Patterns

45

j4flmao/agent-skills

Use when the user asks about the game loop, fixed timestep, game programming patterns, object pooling, spatial partitioning, command pattern or state machines in games. Produces canonical engine and gameplay pattern implementations. Not for ECS storage internals (use ecs-pattern) or engine-specific APIs (use unity, unreal or godot).

Software Development

Frontend Remix Architecture

45

j4flmao/agent-skills

Use when the user asks about Remix v2 or React Router v7 framework mode, Remix loaders and actions, nested routes with Outlet, sessions, Remix Vite setup, deployment adapters or upgrading Remix to React Router v7. Produces route structure, loader/action code and runtime config. Not for validation, optimistic UI or caching (use frontend-remix-patterns).

Software Development

Godot

45

j4flmao/agent-skills

Use when the user asks about Godot 4, GDScript projects, scenes and nodes, Godot C#, GDExtension, Jolt physics in Godot, Godot export templates or Godot performance. Produces Godot 4 project structure, gameplay code and export settings. Not for low-level server APIs and deep optimisation (use godot-gdscript) or Unity (use unity).

Software Development

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.