typescript-rules

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

A set of TypeScript rules for keeping data type-safe and handling errors at clear boundaries. It includes a no-`any` policy and requires checks that confirm the shape of external data.

In plain words
What is it for?
Use it when implementing or reviewing TypeScript, especially around APIs, forms, legacy systems, serialization, and error handling.
Why use it?
It reduces runtime failures caused by trusting unverified API responses, form input, or legacy integrations. It also keeps invalid data from spreading through the application.

Skill for Claude CodeCodex

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.

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

Made for: Claude Code, Codex.

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 typescript-rules

README.md
[![agentmods](https://agentmods.dev/badge/skills/shinpr/ai-coding-project-boilerplate/typescript-rules.svg)](https://agentmods.dev/skills/shinpr/ai-coding-project-boilerplate/typescript-rules)
Your own site
<a href="https://agentmods.dev/skills/shinpr/ai-coding-project-boilerplate/typescript-rules"><img src="https://agentmods.dev/badge/skills/shinpr/ai-coding-project-boilerplate/typescript-rules.svg" alt="Measured on agentmods" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,252 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00031 $0.01252
Opus 5 $0.00015 $0.00626
Sonnet 5 $0.00006 $0.00250
Haiku 4.5 $0.00003 $0.00125

Measured 5d ago against content hash 14ed63860295, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

typescript-rules scanned grade A with 0 findings 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 5d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills-en/typescript-rules/SKILL.md · 125 lines

How it starts

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

TypeScript Development Rules

Prerequisite Detection

Inspect tsconfig, runtime/framework configuration, lint/format configuration, path aliases, package scripts, and representative modules before applying project conventions. Treat a rule as project-specific only when configuration or an established pattern supports it. Label limited-pattern conclusions as inferred. When competing conventions change a public contract, runtime behavior, or error boundary, stop and name the source or user decision required.

Type Safety in Backend Implementation

Type Safety in Data Flow Input Layer (unknown) -> Type Guard -> Business Layer (Type Guaranteed) -> Output Layer (Serialization)

Backend-Specific Type Scenarios:

  • API Communication: Receive responses as unknown and validate them with type guards
  • Form Input: External input as unknown, type determined after validation
  • Legacy Integration: Receive the legacy boundary as unknown; isolate any evidence-backed assertion in the adapter that owns the boundary
  • Test Code: Define mock input/output types with the configured test harness; use Partial<T> for intentionally partial fixtures and typed vi.fn<[Args], Return>() only when Vitest is configured

Coding Conventions

Class Usage Criteria

  • Recommended: Implementation with Functions and Interfaces
    • Rationale: Improves testability and flexibility of function composition
  • Classes Allowed:
    • Framework requirements (NestJS Controller/Service, TypeORM Entity, etc.)
    • Custom error class definitions
    • When state and business logic are tightly coupled (e.g., ShoppingCart, Session, StateMachine)
  • Decision Criterion: If "Does this data have behavior?" is Yes, consider using a class
    // Functions and interfaces
    interface UserService { create(data: UserData): User }
    const userService: UserService = { create: (data) => {...} }
    

Function Design

  • 0-2 parameters maximum: Use object for 3+ parameters
    // Object parameter
    function createUser({ name, email, role }: CreateUserParams) {}
    

Read the full file on GitHub · 125 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. 5d ago First seen · 125 lines · 31 tokens per session scan A 14ed63860295

Subscribe to this mod's changes

typescript-rules is a skill published in the GitHub repository shinpr/ai-coding-project-boilerplate (227 stars, last pushed 7d ago), licensed MIT. It adds 31 tokens to every session and 1,252 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.