typescript-rules

typescript-rules is a skill for Claude Code, Codex from dlupiak/claude-session-dashboard. It costs 8 tokens per session (426 once invoked), scanned A, original, MIT.

A set of coding conventions for TypeScript projects, covering types, imports, file names, project boundaries, and error handling.

In plain words
What is it for?
Use it when adding features, organizing files, defining types, handling errors, and writing tests in TypeScript.
Why use it?
It reduces inconsistent code and makes large TypeScript codebases easier to navigate and maintain. TypeScript is JavaScript with optional type checking.

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/dlupiak/claude-session-dashboard/typescript-rules
Any agent
npx skills add dlupiak/claude-session-dashboard --skill typescript-rules
Clone the repo
git clone --depth 1 https://github.com/dlupiak/claude-session-dashboard

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/dlupiak/claude-session-dashboard/typescript-rules.svg)](https://agentmods.dev/skills/dlupiak/claude-session-dashboard/typescript-rules)
Your own site
<a href="https://agentmods.dev/skills/dlupiak/claude-session-dashboard/typescript-rules"><img src="https://agentmods.dev/badge/skills/dlupiak/claude-session-dashboard/typescript-rules.svg" alt="Measured on agentmods" height="20"></a>
Per session 8 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 426 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.00008 $0.00426
Opus 5 $0.00004 $0.00213
Sonnet 5 $0.00002 $0.00085
Haiku 4.5 $0.00001 $0.00043

Measured 3d ago against content hash 645e42d3ed5e, 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 3d 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/typescript-rules/SKILL.md · 47 lines

What it actually says

TypeScript Rules

Types

  • Never use any — use unknown with type guards or explicit types
  • Prefer interface for object shapes, type for unions/intersections
  • Export types alongside their functions, not from barrel files
  • Use satisfies for type-safe object literals: const x = { ... } satisfies Config

Imports

  • Use @/ path alias for imports from apps/web/src/
  • Group imports: external libs → @/lib/ → relative slice imports
  • Use type imports for type-only: import type { Foo } from './types'

Architecture Boundaries

Vertical slice structure (src/features/<slice>/)

  • Each slice owns its own server functions, queries, components, and types
  • No cross-slice imports — shared code goes in src/lib/
  • src/lib/ modules must NOT import from src/features/

File naming

  • Server function files: *.server.ts
  • Query/hooks files: *.queries.ts
  • Component files: PascalCase (e.g., SessionCard.tsx)
  • Test files: *.test.ts(x) co-located with source

Error Handling

  • Throw typed errors, not strings: throw new Error('message')
  • Use discriminated unions for result types: { ok: true; data: T } | { ok: false; error: string }
  • Catch unknown, narrow with instanceof

Functions

  • Prefer named function declarations over arrow functions for top-level exports
  • Use explicit return types on exported functions
  • Keep functions small — max ~50 lines

Zod

  • Validate all external input (API responses, form data, URL params) with Zod
  • Co-locate schemas with server functions, not in separate schema files
  • Use z.infer<typeof schema> for derived types
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. 3d ago First seen · 47 lines · 8 tokens per session scan A 645e42d3ed5e

Subscribe to this mod's changes

typescript-rules is a skill published in the GitHub repository dlupiak/claude-session-dashboard (66 stars, last pushed yesterday), licensed MIT. It adds 8 tokens to every session and 426 once invoked, about $0.0000 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-09-01.