Agent skill

Typescript Rules

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

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

MITAuto-check passedDevelopment

Install Typescript Rules

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

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

GitHub CLI
$ gh skill install shinpr/ai-coding-project-boilerplate 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/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
232
Token cost
~1.5k tokens
SKILL.md length
578 words
Files
1
Skills in repo
42
Repo updated
First seen
Licence
MIT

At a glance

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

  • Implementing TypeScript
  • SKILL.md covers Prerequisite Detection, Type Safety in Backend…, Coding Conventions and Error Handling, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Reviewing types

What it does

Typescript Rules is an agent skill from shinpr/ai-coding-project-boilerplate. Applies type safety and error handling rules. Enforces no-any policy and type guards. Use when implementing TypeScript or reviewing types.

Its SKILL.md is about 1.5k 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 Development, covering Type safety and Error handling. It works with TypeScript. 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 TypeScript
  • Reviewing types

Example prompts

  • “Use the typescript-rules skill to apply type safety and error handling rules. An agent skill from shinpr/ai-coding-project-boilerplate”
  • “/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

Typescript Rules loads about 1.5k tokens when it runs. Until then it costs about 39 tokens; SKILL.md has 578 words of instructions outside code blocks.

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

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). 578 words, ~1,539 tokens.

Download SKILL.mdSave it as .claude/skills/typescript-rules/SKILL.md (or your agent's skills folder).
name
typescript-rules
description
Applies type safety and error handling rules. Enforces no-any policy and type guards. Use when implementing TypeScript or reviewing types.

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
    typescript
    // 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
    typescript
    // Object parameter
    function createUser({ name, email, role }: CreateUserParams) {}

Dependency Injection

  • Inject external dependencies as parameters: Ensure testability and modularity
    typescript
    // Receive dependency as parameter
    function createService(repository: Repository) { return {...} }

Asynchronous Processing

  • Promise Handling: Follow the established repository style; use async/await when it makes sequencing and error propagation explicit
  • Error Handling: Add try-catch when the current layer can convert, enrich, recover, or record the failure. Otherwise allow the promise rejection to propagate to the owning boundary
  • Type Definition: Explicitly define return value types (e.g., Promise<Result>)

Format Rules

  • Follow the repository's configured formatter, including its semicolon policy
  • Types in PascalCase, variables/functions in camelCase
  • Use absolute imports only through aliases declared in tsconfig or the configured build tool; otherwise use relative imports

Clean Code Principles

  • Remove unused code within the current change
  • Delete debug console.log()
  • Keep executable source free of commented-out code; version control retains removed implementations
  • Comments explain "why" (not "what")
Show full SKILL.md (225 more words)Show less

Error Handling

Error Outcome Rule: Every failure has one owning outcome: return a typed expected error, recover according to a named requirement, or propagate it with diagnostic context. Log at the observability-owning boundary so one failure is not logged repeatedly.

Fail-Fast Principle: Fail quickly on errors to prevent continued processing in invalid states

typescript
// Invalid: fallback hides a failure required by the caller
catch (error) {
  return defaultValue // Hides error
}

// Explicit propagation with added context
catch (error) {
  throw new Error('Processing failed', { cause: error })
}

Result Type Pattern: Express errors with types for explicit handling

typescript
type Result<T, E> = { ok: true; value: T } | { ok: false; error: E }

// Example: Express error possibility with types
function parseUser(data: unknown): Result<User, ValidationError> {
  if (!isValid(data)) return { ok: false, error: new ValidationError() }
  return { ok: true, value: data as User }
}

Custom Error Classes

typescript
export class AppError extends Error {
  constructor(message: string, public readonly code: string, public readonly statusCode = 500) {
    super(message)
    this.name = this.constructor.name
  }
}
// Purpose-specific: ValidationError(400), BusinessRuleError(400), DatabaseError(500), ExternalServiceError(502)

Layer-Specific Error Handling (Backend)

  • API Layer: Convert to HTTP response, log output excluding sensitive information
  • Service Layer: Detect business rule violations, propagate AppError as-is
  • Repository Layer: Convert technical errors to domain errors

Structured Logging and Sensitive Information Protection Log only fields approved for the current trust boundary. Redact credentials, tokens, secrets, payment data, and personal data before logging.

Asynchronous Error Handling

  • Configure runtime-level unhandledRejection/uncaughtException handling at the application entry point when the runtime exposes those events; libraries leave process-level policy to their host
  • Catch an asynchronous failure at the layer that can add a typed outcome, recovery, or diagnostic context
  • Propagate failures after enrichment unless a named requirement owns recovery at that layer

Performance Optimization

  • Streaming Processing: Use streaming or bounded batches when measured input size can exceed the available-memory budget or when requirements demand incremental output; record the triggering measurement or constraint
  • Resource Lifetime: Release timers, subscriptions, handles, and retained references at the lifecycle boundary that owns them

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

Open the folder on GitHubat commit 56913a2

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/ai-coding-project-boilerplate232—~1.5kAutomated safety check: PassMIT
Strict Programming Practicescode-yeongyu/oh-my-openagent70k—~9.5kAutomated safety check: PassCustom licence
Typescript Best PracticesTaoidle/plan-cascade133—~534Automated safety check: PassMIT
Olore Neverthrow Latestolorehq/olore103—~650Automated safety check: PassMIT
Typescript Rulesshinpr/claude-code-workflows690—~1.8kAutomated safety check: PassMIT
Olore Orpc Latestolorehq/olore103—~488Automated safety check: PassMIT

Similar skills

  • Strict Programming Practices

    code-yeongyu/oh-my-openagent

    Applies strict, type-first coding rules for Python, Rust, TypeScript and Go, loading the matching language reference before the agent writes or edits any code.

    70k GitHub stars~9.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Typescript Best Practices

    Taoidle/plan-cascade

    TypeScript/Node.js best practices. An agent skill from Taoidle/plan-cascade.

    133 GitHub stars~534 tokensUpdated 6 mo ago
    DevelopmentAuto-check passed
  • Local neverthrow documentation reference (latest). An agent skill from olorehq/olore.

    103 GitHub stars~650 tokensUpdated today
    DevelopmentAuto-check passed
  • Typescript Rules

    shinpr/claude-code-workflows

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

    690 GitHub stars~1.8k tokensUpdated 6 days ago
    Frontend & DesignAuto-check passed
  • Olore Orpc Latest

    olorehq/olore

    Local orpc documentation reference (latest). An agent skill from olorehq/olore.

    103 GitHub stars~488 tokensUpdated today
    Backend & APIsAuto-check passed
  • Mastra

    majiayu000/claude-skill-registry

    You are an expert in Mastra, the TypeScript framework for building AI agents, RAG pipelines, and workflows.

    666 GitHub starsUsed in 1 repo~1.5k tokens
    AI & LLM EngineeringAuto-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 3 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 3 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 3 days ago
    Auto-check: notes
  • 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
    Auto-check passed
  • Implementation Approach

    shinpr/ai-coding-project-boilerplate

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

    232 GitHub stars~3.2k tokensUpdated 3 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 3 days ago
    Auto-check passed

Works with

Categories

Questions about Typescript Rules

What does Typescript Rules do?

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

When should I use Typescript Rules?

Typescript Rules fits situations like: implementing TypeScript; reviewing types.

How do I install Typescript Rules in Claude Code?

Run `npx skills add shinpr/ai-coding-project-boilerplate --skill typescript-rules -a claude-code`. Or copy the skill folder (.claude/skills-en/typescript-rules in shinpr/ai-coding-project-boilerplate) 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/ai-coding-project-boilerplate --skill typescript-rules -a codex`. Or copy the skill folder (.claude/skills-en/typescript-rules in shinpr/ai-coding-project-boilerplate) 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/ai-coding-project-boilerplate --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.5k tokens (SKILL.md is roughly 6.2k 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: Strict Programming Practices (code-yeongyu/oh-my-openagent, 70k stars), Typescript Best Practices (Taoidle/plan-cascade, 133 stars), Olore Neverthrow Latest (olorehq/olore, 103 stars) and Typescript Rules (shinpr/claude-code-workflows, 690 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/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.