frontend-typescript-rules

frontend-typescript-rules is a skill for Claude Code from shinpr/ai-coding-project-boilerplate. It costs 29 tokens per session (1,417 once invoked), scanned A, original, MIT.

A set of React and TypeScript rules for safe types, component structure, state management, boundaries, and error handling. TypeScript adds checks to JavaScript code before it runs.

In plain words
What is it for?
Use it when implementing React components, choosing state-management patterns, typing untrusted data, handling errors, or deciding when to split a component.
Why use it?
It provides concrete limits and repository checks that help prevent oversized components, excessive prop passing, unsafe assertions, and unclear data ownership.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it when implementing React components, choosing state-management patterns, typing untrusted data, handling errors, or deciding when to split a component.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/shinpr/ai-coding-project-boilerplate/frontend-typescript-rules
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add shinpr/ai-coding-project-boilerplate --skill frontend-typescript-rules
Clone the repo
git clone --depth 1 https://github.com/shinpr/ai-coding-project-boilerplate

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for frontend-typescript-rules

README.md
[![agentmods](https://agentmods.dev/badge/skills/shinpr/ai-coding-project-boilerplate/frontend-typescript-rules/github.svg)](https://agentmods.dev/skills/shinpr/ai-coding-project-boilerplate/frontend-typescript-rules)
Your own site
<a href="https://agentmods.dev/skills/shinpr/ai-coding-project-boilerplate/frontend-typescript-rules"><img src="https://agentmods.dev/badge/skills/shinpr/ai-coding-project-boilerplate/frontend-typescript-rules/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for frontend-typescript-rules

Your own site · 80×15
<a href="https://agentmods.dev/skills/shinpr/ai-coding-project-boilerplate/frontend-typescript-rules"><img src="https://agentmods.dev/badge/skills/shinpr/ai-coding-project-boilerplate/frontend-typescript-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,417 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00029 $0.01417
Opus 5.5 $0.00012 $0.00567
Sonnet 5.5 $0.00006 $0.00283
Haiku 4.5 $0.00003 $0.00142

Measured 1mo ago against content hash 8992691f84cd, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

frontend-typescript-rules scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const raw: unknown = await (await fetch(url)).json()
.claude/skills-en/frontend-typescript-rules/SKILL.md · 76 lines

How it starts

The opening of the file, as written. The whole thing — 76 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.

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

Read the full file on GitHub · 76 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · -1 lines 8992691f84cd
  2. 1mo ago Changed 46fb2c08c2c3
  3. 1mo ago First seen · 77 lines · 29 tokens per session scan A a772baaa70f4

Subscribe to this mod's changes

frontend-typescript-rules is a skill published in the GitHub repository shinpr/ai-coding-project-boilerplate (234 stars, last pushed yesterday), licensed MIT. It adds 29 tokens to every session and 1,417 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.