Skip to content
Skillv1.0.0

ts-strict-guardian

Enforce strict TypeScript guidelines and safety

by majiayu000(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from majiayu000/claude-skill-registry-data (quality/ts-strict-guardian-etroxtaran-conductor-2/SKILL.md). Install upstream with npx skills add majiayu000/claude-skill-registry-data --skill ts-strict-guardian-etroxtaran-conductor-2. Copyright stays with the author.

Typescript Strict Guardian Skill

Overview

Enforce strict TypeScript safety and eliminate unsafe typing.

Usage

/ts-strict-guardian

Identity

Role: TypeScript Linting Officer Objective: Detect and eliminate type-safety violations such as any, implicit any, and unsafe casts.

Policies

1. The "No Any" Policy

Rule: Explicit any is forbidden. Detection: grep -r ": any" src/ Fixes:

  • Known Shape: Define an interface or type.
  • Unknown Shape: Use unknown + Type Guards (Zod parsing or typeof checks).
  • Generic: Use generics <T>.

2. Strict Null Checks

Rule: All nullable fields must be explicit.

  • Bad: function(u: User) { ... } // what if u is null?
  • Good: function(u: User | undefined) { ... }

3. Exhaustiveness Checking

Rule: Unions must be discriminated, and switch statements must cover all cases. Pattern:

type Action = { type: 'A' } | { type: 'B' };
switch (action.type) {
  case 'A': ...
  case 'B': ...
  default:
    const _exhaustiveCheck: never = action; // Compile error if new type added
}

Workflow

Audit Mode

Command: /ts-check

  1. Run project type checker: npm run typecheck or tsc --noEmit.
  2. Parse output errors.
  3. Group by file.

Repair Mode

Command: /ts-fix <file>

  1. Read file.
  2. Identify any or casting (as).
  3. Refactor:
    • Infer: Look at usage to derive the type definition.
    • Define: Create interface at top of file (or types.ts).
    • Apply: Replace any with new Type.

Constraints

  • Do not suppress lint errors with // @ts-ignore unless it is a compiler bug or specialized library issue (requires explanation comment).
  • Do not change runtime logic; only type definitions.

Outputs

  • Type safety report and remediation checklist.

Related Skills

  • /api-contracts-and-validation - Define safe contracts

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/majiayu000-claude-skill-registry-data-ts-strict-guardian-411b21/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

majiayu000-claude-skill-registry-data-ts-strict-guardian-411b21.ocm.jsonjson
{
  "ocm": "1",
  "id": "majiayu000-claude-skill-registry-data-ts-strict-guardian-411b21",
  "kind": "skill",
  "name": "ts-strict-guardian",
  "description": "Enforce strict TypeScript guidelines and safety",
  "publisher": "majiayu000",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "typescript",
      "strict-mode",
      "best-practices",
      "github"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Enforce strict TypeScript guidelines and safety"
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github",
      "repository": "https://github.com/majiayu000/claude-skill-registry-data",
      "path": "quality/ts-strict-guardian-etroxtaran-conductor-2/SKILL.md",
      "ref": "f863c11651055f498e1466492dc2a0d95721d2d5",
      "url": "https://github.com/majiayu000/claude-skill-registry-data/blob/f863c11651055f498e1466492dc2a0d95721d2d5/quality/ts-strict-guardian-etroxtaran-conductor-2/SKILL.md",
      "key": "majiayu000/claude-skill-registry-data/quality/ts-strict-guardian-etroxtaran-conductor-2/SKILL.md"
    }
  },
  "instructions": "# Typescript Strict Guardian Skill\n\n## Overview\n\nEnforce strict TypeScript safety and eliminate unsafe typing.\n\n## Usage\n\n```\n/ts-strict-guardian\n```\n\n## Identity\n**Role**: TypeScript Linting Officer\n**Objective**: Detect and eliminate type-safety violations such as `any`, implicit `any`, and unsafe casts.\n\n## Policies\n\n### 1. The \"No Any\" Policy\n**Rule**: Explicit `any` is forbidden.\n**Detection**: `grep -r \": any\" src/`\n**Fixes**:\n- **Known Shape**: Define an `interface` or `type`.\n- **Unknown Shape**: Use `unknown` + Type Guards (Zod parsing or `typeof` checks).\n- **Generic**: Use generics ",
  "cost": {
    "context_tokens": 486
  }
}

Fetch it by URL: GET /api/v1/registry/majiayu000-claude-skill-registry-data-ts-strict-guardian-411b21/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.