Agent skill

Frontend Typescript Rules

by shinpr in shinpr/ai-coding-project-boilerplate

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

MITAuto-check passedFrontend & Design

Install Frontend Typescript Rules

skills CLI
$ npx skills add shinpr/ai-coding-project-boilerplate --skill frontend-typescript-rules -a claude-code

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

GitHub CLI
$ gh skill install shinpr/ai-coding-project-boilerplate frontend-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/ai-coding-project-boilerplate.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills-en/frontend-typescript-rules .claude/skills/frontend-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
frontend-typescript-rules
GitHub stars
232
Token cost
~1.7k tokens
SKILL.md length
752 words
Files
1
Skills in repo
42
Repo updated
First seen
Licence
MIT

At a glance

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

  • Implementing React components
  • SKILL.md covers Prerequisite Detection, Anti-patterns and Thresholds, Type Safety at Boundaries and Component and State Design, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Tasks that involve Type safety

What it does

Frontend Typescript Rules is an agent skill from shinpr/ai-coding-project-boilerplate. Applies React/TypeScript type safety, component design, and state management rules. Use when implementing React components.

Its SKILL.md is about 1.7k 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, State management and React components. It works with TypeScript and React. The repository describes itself as: Agentic coding TypeScript boilerplate for Claude Code: sub-agent workflows with built-in quality checks and context engineering. The licence is MIT.

When your agent uses it

  • Implementing React components
  • Tasks that involve Type safety
  • Tasks that involve State management

Example prompts

  • “Use the frontend-typescript-rules skill to apply React/TypeScript type safety, component design, and state management rules”
  • “/frontend-typescript-rules”

What it can do on your machine

Read from SKILL.md and the folder at commit 56913a2. 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 (its code samples are typescript).

    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

Frontend Typescript Rules loads about 1.7k tokens when it runs. Until then it costs about 37 tokens; SKILL.md has 752 words of instructions outside code blocks.

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

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/ai-coding-project-boilerplate at commit 56913a2, republished under its MIT licence (© shinpr). 752 words, ~1,687 tokens.

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

TypeScript Development Rules (Frontend)

Frontend-specific React/TypeScript rules for implementation: thresholds, boundary type safety, component/state design, error handling, and project conventions.

Prerequisite Detection

Inspect TypeScript, bundler/framework, lint/format, path-alias, React compiler, and representative component configuration before applying a project convention. Treat a convention as observed when configuration or an established repository pattern supports it; label a conclusion from limited examples as inferred. When conflicting patterns affect public behavior, compatibility, or component boundaries, stop and name the required source or decision.

Anti-patterns and Thresholds

Signals that trigger a design change:

  • Prop drilling through 3+ levels → lift to Context or state management
  • Component over 300 lines → split
  • Props count over 10 → split the component (3-7 is the working range)
  • Optional props over 50% → introduce defaults or Context
  • Props nesting deeper than 2 levels → flatten

Type Safety at Boundaries

Receive untrusted or unavailable types as unknown and narrow them with a type guard. Use as only when a runtime/framework invariant proves the asserted type and record that invariant in a nearby comment. Existing generated or third-party declarations that contain any are boundary inputs to wrap, not justification for spreading any into application contracts.

Inside the app, React Props/State are type-guaranteed — no unknown needed. At every external boundary, receive as unknown and narrow with a type guard before use: API responses, localStorage/sessionStorage, URL parameters, parsed JSON. Controlled-component form input stays type-safe through React synthetic events.

typescript
const raw: unknown = await (await fetch(url)).json()
if (!isUser(raw)) throw new ValidationError('invalid user')
const user = raw // narrowed to User

Component and State Design

  • Function components only. Class components are allowed solely for Error Boundaries (no hook equivalent exists)
  • Type Props explicitly with a named type and destructure: function UserCard({ user, onSelect }: UserCardProps). Type props directly on the function so the props contract stays explicit
  • Props-driven: pass dependencies as props when one explicit parent owns them. Use Context or established global state when multiple non-adjacent descendants share the value and prop forwarding would add intermediate components with no ownership role
  • Custom hooks are the unit of logic reuse and dependency injection (inject collaborators through the hook for testability)
  • Function parameters: 0-2 positional; for 3+ take a single options object
  • State shape: type state explicitly; for multi-field state with discrete transitions, use useReducer with a discriminated-union action type rather than many useState calls
  • Server/Client boundary (RSC frameworks only — e.g. Next.js App Router): default to server components for data fetching/rendering and isolate interactivity behind a "use client" boundary at the smallest scope that needs it; keep browser-only APIs (window, localStorage, event handlers) inside client components, since calling them in a server component breaks the render. N/A for client-only SPAs (e.g. Vite) — skip when the project has no server-component runtime
Show full SKILL.md (326 more words)Show less

Error Handling

  • Give every error one explicit outcome: convert it to a typed expected failure, handle it at the owning UI boundary, or propagate it with its diagnostic context. Log at the layer that owns observability so the same failure is not logged repeatedly
  • Fail fast: on an invalid state, throw rather than returning a silent fallback
  • Represent expected failures as values with a Result type; reserve throw for unexpected/unrecoverable cases
  • Use purpose-specific error classes extending a base AppError carrying a code (e.g. ValidationError, ApiError, NotFoundError)
  • Layer responsibilities: the API layer converts transport errors into domain errors; hooks propagate AppError upward; an Error Boundary catches render-time errors and shows fallback UI
  • Effect race/cleanup: guard useEffect data fetches against out-of-order responses and post-unmount state updates — abort or ignore stale results (AbortController or a mounted flag), or use a server-state library (React Query/SWR) that cancels and dedupes. try-catch alone does not cover this
  • Log only diagnostic fields approved for the current trust boundary; redact credentials, tokens, payment data, and other sensitive values before logging
typescript
type Result<T, E> = { ok: true; value: T } | { ok: false; error: E }

class AppError extends Error {
  constructor(message: string, readonly code: string, readonly statusCode = 500) {
    super(message); this.name = this.constructor.name
  }
}

Error Boundary — the one place a class component is required:

typescript
class ErrorBoundary extends React.Component<{ children: React.ReactNode; fallback: React.ReactNode }, { hasError: boolean }> {
  state = { hasError: false }
  static getDerivedStateFromError() { return { hasError: true } }
  render() { return this.state.hasError ? this.props.fallback : this.props.children }
}

Project Conventions

  • Environment variables: read client-side env through the configured bundler's exposed accessor. Match the observed bundler: Vite import.meta.env.VITE_*, Next.js public process.env.NEXT_PUBLIC_*, CRA process.env.REACT_APP_*. Frontend bundles contain public configuration; secret values remain behind a server-side boundary
  • Bundle & performance: monitor bundle size with the build script against the project's budget; code-split with React.lazy + Suspense; structure state to minimize re-renders. Memoization: when React Compiler is enabled, rely on it; reach for manual React.memo/useMemo/useCallback only as a profiler- or identity-justified escape hatch (a measured bottleneck, or stable reference identity for third-party APIs / effect dependencies)
  • Naming: components/types PascalCase; variables/functions camelCase; hooks use-prefixed; constants SCREAMING_SNAKE_CASE
  • Imports: follow the alias and import-order rules observed in tsconfig, lint configuration, and representative files. Use src/ absolute paths only when the configured alias supports them
  • Formatting: follow the repository's configured formatter; when Biome is present, semicolons and style come from its project configuration

© 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 .claude/skills-en/frontend-typescript-rules of shinpr/ai-coding-project-boilerplate.

Open the folder on GitHubat commit 56913a2

Compare with similar skills

Frontend 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.

Frontend Typescript Rules compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Frontend Typescript Rules this skillshinpr/ai-coding-project-boilerplate232—~1.7kAutomated safety check: PassMIT
Typescript Rulesshinpr/claude-code-workflows691—~1.8kAutomated 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
Typescript Patternssoftspark/ai-toolkit179—~1.6kAutomated safety check: PassApache-2.0
React Code Reviewgiuseppe-trisciuoglio/developer-kit355—~2.6kAutomated safety check: NotesMIT

Similar skills

  • Typescript Rules

    shinpr/claude-code-workflows

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

    691 GitHub stars~1.8k tokensUpdated 6 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
  • Typescript Patterns

    softspark/ai-toolkit

    TypeScript types: generics, discriminated unions, Zod, satisfies, branded types.

    179 GitHub stars~1.6k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • React Code Review

    giuseppe-trisciuoglio/developer-kit

    Provides comprehensive code review capability for React applications, validates component architecture, hooks usage, React 19 patterns, state management, performance optimization, accessibility…

    355 GitHub stars~2.6k tokensUpdated 28 days ago
    Frontend & DesignAuto-check: notes
  • Use when implementing or refactoring React/TypeScript components and the task requires decisions about component ownership, feature boundaries, state, data…

    158k GitHub stars~626 tokensUpdated today
    Frontend & DesignAuto-check passed

More from shinpr/ai-coding-project-boilerplate

All 42 skills in this repo
  • Integration E2E Testing

    shinpr/ai-coding-project-boilerplate

    Selects and designs the smallest integration/E2E test set that proves accepted behavior at an observable boundary.

    232 GitHub stars~2.8k tokensUpdated 4 days ago
    Auto-check passed
  • Skill Optimization

    shinpr/ai-coding-project-boilerplate

    Evaluates and optimizes skill file quality using 9 content patterns and 10 editing principles.

    232 GitHub stars~3.5k tokensUpdated 4 days ago
    Auto-check passed
  • Frontend Technical Spec

    shinpr/ai-coding-project-boilerplate

    Defines React environment, component architecture, state/data flow, build verification, and frontend non-functional criteria from repository evidence.

    232 GitHub stars~1.9k tokensUpdated 4 days ago
    Auto-check: notes
  • Implementation Approach

    shinpr/ai-coding-project-boilerplate

    Selects implementation strategy (vertical slice, horizontal, or hybrid) with risk assessment.

    232 GitHub stars~3.2k tokensUpdated 4 days ago
    Auto-check passed
  • Subagents Orchestration Guide

    shinpr/ai-coding-project-boilerplate

    Coordinates subagents through scale-based planning, approval, implementation, verification, and escalation flows.

    232 GitHub stars~8k tokensUpdated 4 days ago
    Auto-check passed
  • Typescript Rules

    shinpr/ai-coding-project-boilerplate

    Applies type safety and error handling rules. An agent skill from shinpr/ai-coding-project-boilerplate.

    232 GitHub stars~1.5k tokensUpdated 4 days ago
    Auto-check passed

Works with

Questions about Frontend Typescript Rules

What does Frontend Typescript Rules do?

Applies React/TypeScript type safety, component design, and state management rules. Frontend Typescript Rules is an agent skill from shinpr/ai-coding-project-boilerplate. Applies React/TypeScript type safety, component design, and state management rules.

When should I use Frontend Typescript Rules?

Frontend Typescript Rules fits situations like: implementing React components; tasks that involve Type safety; tasks that involve State management.

How do I install Frontend Typescript Rules in Claude Code?

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

How do I install Frontend Typescript Rules in Codex?

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

Can I use Frontend 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/ai-coding-project-boilerplate --skill frontend-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/frontend-typescript-rules, .gemini/skills/frontend-typescript-rules, .github/skills/frontend-typescript-rules and .opencode/skills/frontend-typescript-rules in your project.

What does Frontend Typescript Rules need to run?

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

Does Frontend 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 Frontend 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 Frontend Typescript Rules use?

Frontend 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 Frontend Typescript Rules use?

About 1.7k tokens (SKILL.md is roughly 6.7k 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 Frontend Typescript Rules?

Skills that share tags, products or a category with Frontend Typescript Rules: Typescript Rules (shinpr/claude-code-workflows, 691 stars), React Flow Node TS (microsoft/skills, 3.1k stars), React Dev (davila7/claude-code-templates, 32k stars) and Typescript Patterns (softspark/ai-toolkit, 179 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Frontend Typescript Rules?

shinpr (a GitHub user) maintains it in shinpr/ai-coding-project-boilerplate, which has 232 GitHub stars. The repository holds 42 skills in this directory. The repository was last updated on October 4, 2026.

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