Agent skill

Typescript Rules

by shinpr in shinpr/claude-code-workflows

React/TypeScript frontend development rules including type safety, component design, state management, and error handling.

MITAuto-check passedFrontend & Design

Install Typescript Rules

skills CLI
$ npx skills add shinpr/claude-code-workflows --skill typescript-rules -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install shinpr/claude-code-workflows typescript-rules --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/shinpr/claude-code-workflows.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/typescript-rules .claude/skills/typescript-rules && rm -rf skills-src

Use ~/.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/

Facts

Skill name
typescript-rules
GitHub stars
690
Token cost
~1.8k tokens
SKILL.md length
914 words
Files
1
Skills in repo
30
Repo updated
First seen
Licence
MIT

At a glance

React/TypeScript frontend development rules including type safety, component design, state management, and error handling.

  • Implementing React components
  • SKILL.md covers Comment Writing Rules, Type Safety, Coding Conventions and Error Handling, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • TypeScript code

What it does

Typescript Rules is an agent skill from shinpr/claude-code-workflows. React/TypeScript frontend development rules including type safety, component design, state management, and error handling. Use when implementing React components, TypeScript code, or frontend features.

Its SKILL.md is about 1.8k 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 Frontend & Design, covering Type safety, React components and Frontend development. It works with TypeScript and React. The repository describes itself as: Development workflows for Claude Code that keep broad exploration focused on the outcome you approved. The licence is MIT.

When your agent uses it

  • Implementing React components
  • TypeScript code
  • Frontend features

Example prompts

  • “/typescript-rules”

What it can do on your machine

Read from SKILL.md and the folder at commit a4ecd62. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Typescript Rules loads about 1.8k tokens when it runs. Until then it costs about 55 tokens; SKILL.md has 914 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~55
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from shinpr/claude-code-workflows at commit a4ecd62, republished under its MIT licence (© shinpr). 914 words, ~1,764 tokens.

Download SKILL.mdSave it as .claude/skills/typescript-rules/SKILL.md (or your agent's skills folder).
name
typescript-rules
description
React/TypeScript frontend development rules including type safety, component design, state management, and error handling. Use when implementing React components, TypeScript code, or frontend features.

TypeScript Development Rules (Frontend)

Comment Writing Rules

Code first: names and types carry meaning; a comment must add what code cannot, and one comment per decision is enough.

  • Explain why a component memoizes, guards, or re-renders, not what the JSX renders.
  • Record decisions and rationale; leave chronological history to version control.

Type Safety

Default Rule: Prefer unknown, generics, or union types over any. Retain any only when an existing external, generated, or legacy public signature requires it, or when replacing it prevents the project type check from expressing a safe generic relationship. Record the declaration path or type-check result that proves the constraint. When a local adapter can preserve compatibility and expose a safer type within the user request or current task/design artifact, implement the adapter; otherwise confine any to the smallest adapter or public-signature boundary, document the reason, and validate untrusted data before it enters typed application code.

Frontend Boundaries

  • React Props/State: use the declared application types.
  • External API responses: treat unvalidated payloads as unknown and validate at the boundary. A generated client may retain its declared type when it also enforces the contract at runtime.
  • localStorage / sessionStorage: handle string | null; treat parsed data as unknown until validated.
  • URL parameters: handle the router or platform's nullable string shape, then parse and validate before converting to a domain type.
  • Exported APIs and important boundaries: declare return types; allow inference for local implementations when the contract remains clear.

Type Complexity Review Signals

Use these as review prompts, not pass/fail thresholds. Existing project conventions and the component's responsibility take precedence.

  • Props count: review ownership or splitting above 10.
  • Optional props: review defaults or ownership when more than half are optional.
  • Nested prop structures: review flattening beyond 2 levels.
  • Type assertions: review the boundary when 3+ assertions are required.
  • External API types: represent the actual external shape and convert at the application boundary.

Coding Conventions

Component and File Decisions

  • Prefer function components and Hooks for new code. Preserve working class components unless the accepted work requires migration; a class remains valid for an Error Boundary implementation.
  • Reuse logic through the repository's established component, hook, or module pattern.
  • Follow the project's adopted component architecture and file layout. Co-locate files only when it is established or approved as a new structure.

Server/Client Boundary — only for RSC frameworks

  • Fetch and render on the server by default; isolate interactivity behind the smallest "use client" boundary that needs it.
  • Keep browser-only APIs and event handlers inside client components.
  • Skip these rules when the project has no server-component runtime.

State Ownership

  • Preserve the repository's existing local, shared, and server-state ownership boundaries.
  • Introduce Context, a shared-state layer, or a server-state dependency only when the accepted design requires ownership or lifecycle that the existing boundary cannot represent.
  • Keep one authoritative owner for each state value and use immutable updates required by React change detection.

Function and Props Boundaries

  • Prefer 0-2 parameters. For 3+ related values, use an object when it clarifies names or represents one domain input; preserve positional parameters when the repository convention or external API requires them.
  • Declare component dependencies through typed props, hooks, Context, or injected modules according to the repository's established state and dependency boundaries.

Environment Variables

  • Read client-side environment variables through the project's bundler accessor and public prefix.
  • Validate required values through the repository's typed config layer; add a default only for an optional value or an explicitly defined local-development mode.

Client Security

  • Keep credentials and secrets on the server; browser-delivered code and public environment variables are observable by clients.
  • Exclude local environment files from version control and keep error output free of sensitive values.

Asynchronous Processing

  • Follow the repository's promise style; use async/await when it clarifies sequencing and error propagation.
  • Handle event-handler and asynchronous failures at their owning boundary. Error Boundaries cover descendant rendering failures, not ordinary callbacks or asynchronous work.
  • Guard effect-driven requests against stale or post-unmount updates through the repository's cancellation or server-state mechanism.

Formatting

  • Follow the repository's formatter, naming, module-resolution, and package-boundary configuration.
  • Use an import alias only when the project configuration resolves it.
Show full SKILL.md (242 more words)Show less

Error Handling

Every caught error has one intentional outcome: propagate it, convert it to the repository's typed boundary result, or represent it as user-facing error state. Preserve context and log once at the boundary that owns diagnosis or recovery, with sensitive data redacted.

  • Error Boundary: place it where descendant render failures have a defined UI recovery outcome.
  • Custom Hook: preserve the application's existing error contract.
  • API Layer: convert transport failures to the repository's established domain or boundary representation.
  • Event handlers and async workflows: use the owning layer's exception, result, or UI-state contract.

Performance Optimization

  • When React Compiler is enabled, rely on it. Add manual React.memo, useMemo, or useCallback only for a measured bottleneck or a required stable identity at an external API/effect boundary.
  • Apply code splitting or import changes when a configured bundle budget regresses, or when the accepted task names bundle size as an outcome and a repository bundle report attributes the relevant increase to the changed import. Follow the repository's existing loading pattern and verify the same signal after the change.

Non-functional Requirements

  • Browser Compatibility: Implement against the support policy in the PRD, Design Doc, Browserslist, or build configuration. When none is defined, preserve the repository's current transpilation/polyfill baseline and surface any new browser-dependent API as an unresolved compatibility decision.
  • Performance: Verify against project-defined budgets and the metric representing the affected experience. When no budget exists, measure the changed path and report the observed result instead of inventing a threshold.

© shinpr, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/typescript-rules of shinpr/claude-code-workflows.

Open the folder on GitHubat commit a4ecd62

Compare with similar skills

Typescript Rules 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.

Typescript Rules compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Typescript Rules this skillshinpr/claude-code-workflows690—~1.8kAutomated safety check: PassMIT
Frontend Typescript Rulesshinpr/ai-coding-project-boilerplate232—~1.7kAutomated safety check: PassMIT
React Frontend Development Guidelinesdiet103/claude-code-infrastructure-showcase10k2 repos~2.9kAutomated safety check: PassMIT
React ExpertJeffallan/claude-skills12k—~1.4kAutomated safety check: PassMIT
React Flow Node TSmicrosoft/skills3.1k6 repos~502Automated safety check: PassMIT
React Devdavila7/claude-code-templates32k2 repos~2.6kAutomated safety check: PassMIT

Similar skills

  • Frontend Typescript Rules

    shinpr/ai-coding-project-boilerplate

    Applies React/TypeScript type safety, component design, and state management rules.

    232 GitHub stars~1.7k tokensUpdated 3 days ago
    Frontend & DesignAuto-check passed
  • React Frontend Development Guidelines

    diet103/claude-code-infrastructure-showcase

    Guidelines for React 18 and TypeScript apps covering Suspense data fetching, lazy loading, feature folders, MUI v7 styling, TanStack Router and performance.

    10k GitHub starsUsed in 2 repos~2.9k tokens
    Frontend & DesignAuto-check passed
  • React Expert

    Jeffallan/claude-skills

    Builds React 19 components in TypeScript with Server Components, useActionState forms, custom hooks and state libraries, checked with tsc and React Testing Library.

    12k GitHub stars~1.4k tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • React Flow Node TS

    microsoft/skills

    Official

    Create React Flow node components with TypeScript types, handles, and Zustand integration.

    3.1k GitHub starsUsed in 6 repos~502 tokens
    Frontend & DesignAuto-check passed
  • React Dev

    davila7/claude-code-templates

    This skill should be used when building React components with TypeScript, typing hooks, handling events, or when React TypeScript, React 19, Server Components are mentioned.

    32k GitHub starsUsed in 2 repos~2.6k tokens
    Frontend & DesignAuto-check passed
  • Moai Ref React Patterns

    modu-ai/moai-adk

    React/Next.js component design patterns, state management strategies, and project structure reference for frontend development.

    1.2k GitHub stars~1.8k tokensUpdated today
    Frontend & DesignAuto-check passed

More from shinpr/claude-code-workflows

All 30 skills in this repo
  • Integration E2E Testing

    shinpr/claude-code-workflows

    Integration and E2E test design principles, ROI calculation, test skeleton specification, and review criteria.

    690 GitHub stars~3.5k tokensUpdated 6 days ago
    Auto-check passed
  • AI Development Guide

    shinpr/claude-code-workflows

    Applies language-agnostic and backend technical decision criteria, anti-pattern detection, debugging, and quality gates.

    690 GitHub stars~3.9k tokensUpdated 6 days ago
    Auto-check passed
  • Frontend AI Guide

    shinpr/claude-code-workflows

    Applies React/TypeScript-specific technical decision criteria, anti-pattern detection, debugging, and frontend quality gates.

    690 GitHub stars~3k tokensUpdated 6 days ago
    Auto-check passed
  • Implementation Approach

    shinpr/claude-code-workflows

    Implementation strategy selection framework. An agent skill from shinpr/claude-code-workflows.

    690 GitHub stars~2.6k tokensUpdated 6 days ago
    Auto-check passed
  • Recipe Quality Profile

    shinpr/claude-code-workflows

    Proposes repository-specific quality policy for implementation and review and, after confirmation, creates or updates docs/project-context/quality.yaml.

    690 GitHub stars~1.1k tokensUpdated 6 days ago
    Auto-check passed
  • Subagents Orchestration Guide

    shinpr/claude-code-workflows

    Guides subagent coordination through implementation workflows.

    690 GitHub stars~9.3k tokensUpdated 6 days ago
    Auto-check passed

Works with

Questions about Typescript Rules

What does Typescript Rules do?

React/TypeScript frontend development rules including type safety, component design, state management, and error handling. Typescript Rules is an agent skill from shinpr/claude-code-workflows. React/TypeScript frontend development rules including type safety, component design, state management, and error handling.

When should I use Typescript Rules?

Typescript Rules fits situations like: implementing React components; typeScript code; frontend features.

How do I install Typescript Rules in Claude Code?

Run `npx skills add shinpr/claude-code-workflows --skill typescript-rules -a claude-code`. Or copy the skill folder (skills/typescript-rules in shinpr/claude-code-workflows) into .claude/skills/typescript-rules in your project. Claude Code loads it when a task matches its description.

How do I install Typescript Rules in Codex?

Run `npx skills add shinpr/claude-code-workflows --skill typescript-rules -a codex`. Or copy the skill folder (skills/typescript-rules in shinpr/claude-code-workflows) into .agents/skills/typescript-rules in your project. Codex loads it when a task matches its description.

Can I use Typescript Rules in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add shinpr/claude-code-workflows --skill typescript-rules -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-rules, .gemini/skills/typescript-rules, .github/skills/typescript-rules and .opencode/skills/typescript-rules in your project.

What does Typescript Rules need to run?

SKILL.md names no scripts, command-line tools or credentials: Typescript Rules is instructions for the agent only.

Does Typescript Rules access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Typescript Rules safe to install?

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.

What licence does Typescript Rules use?

Typescript Rules is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Typescript Rules use?

About 1.8k tokens (SKILL.md is roughly 7.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Typescript Rules?

Skills that share tags, products or a category with Typescript Rules: Frontend Typescript Rules (shinpr/ai-coding-project-boilerplate, 232 stars), React Frontend Development Guidelines (diet103/claude-code-infrastructure-showcase, 10k stars), React Expert (Jeffallan/claude-skills, 12k stars) and React Flow Node TS (microsoft/skills, 3.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Typescript Rules?

shinpr (a GitHub user) maintains it in shinpr/claude-code-workflows, which has 690 GitHub stars. The repository holds 30 skills in this directory. The repository was last updated on October 1, 2026.

Source: shinpr/claude-code-workflows on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.