MCPInstall

gravitas-typescript

GRAVITAS extension for TypeScript projects. Adds TypeScript-specific recon, strict mode patterns, Vitest/Jest integration, and common TS failure modes. Load in addition to the base GRAVITAS skill.

Installs
265
Last 24h
+11
Trending rank
#8221
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/udaysharmadev/gravitas --skill gravitas-typescript
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads gravitas-typescript automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

GRAVITAS — TypeScript Extension

Extends the base GRAVITAS skill with TypeScript-specific patterns. Load skills/gravitas/SKILL.md first, then this file.


TypeScript Recon Additions

Add to standard recon checklist:

□ tsconfig.json — strict mode? noUncheckedIndexedAccess? exactOptionalPropertyTypes?
□ package.json — TypeScript version, test runner (vitest vs jest)
□ eslint config — @typescript-eslint rules in effect
□ type declarations — are there .d.ts files that affect this module?
□ path aliases — does tsconfig have paths? (affects imports)

Read tsconfig strictly

cat tsconfig.json | jq '.compilerOptions | {strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, target, lib}'

TypeScript Verification Chain

# Full chain — always in this order
tsc --noEmit                           # catches type errors first
eslint . --max-warnings 0              # @typescript-eslint rules
vitest run --reporter=verbose          # or: jest --verbose

# With coverage
vitest run --coverage --reporter=verbose

# Type coverage (optional, requires type-coverage)
npx type-coverage --strict

TypeScript-Specific Anti-Patterns

Never use any

BAD:  function process(data: any) { ... }
GOOD: function process(data: ProcessInput) { ... }

Never use as to silence type errors

BAD:  const user = data as User;  // silences real type error
GOOD: if (isUser(data)) { const user = data; ... }

Handle undefined explicitly

BAD:  const name = user.name;          // may be undefined
GOOD: const name = user.name ?? 'Anonymous';

Strict null checks

BAD:  return users.find(u => u.id === id).name;  // crash if not found
GOOD: return users.find(u => u.id === id)?.name;

Common TypeScript Failure Modes

FailureRoot CauseFix
Object is possibly undefinedOptional property accessed without guardAdd ?. or null check
Type 'string' is not assignable to 'number'Wrong type passedCheck function signature, fix caller
Property does not exist on typeInterface mismatchUpdate interface or use correct property
Cannot find modulePath alias not in tsconfigAdd to paths in tsconfig
Argument of type X is not assignable to YGeneric type mismatchCheck generic constraints
Implicit any in strict modeMissing type annotationAdd explicit type

TypeScript Patterns

Parameterized types over any

function first<T>(arr: T[]): T | undefined {
  return arr[0];
}

Discriminated unions for type safety

type Result<T> =
  | { ok: true; data: T }
  | { ok: false; error: string };

Type guards instead of casts

function isUser(obj: unknown): obj is User {
  return typeof obj === 'object' && obj !== null && 'id' in obj;
}

Test Patterns (Vitest)

Test file location

Follow project convention — check existing tests:

find src/ -name "*.test.ts" | head -5  # see the pattern

Standard test structure

import { describe, it, expect, vi, beforeEach } from 'vitest';

describe('[module]', () => {
  beforeEach(() => { vi.clearAllMocks(); });

  it('[behavior] when [condition]', () => {
    // Arrange
    const input = ...;
    // Act
    const result = fn(input);
    // Assert
    expect(result).toEqual(expected);
  });
});

Mocking

vi.mock('../db', () => ({
  query: vi.fn().mockResolvedValue({ rows: [] })
}));

Quick Reference

# Find all TypeScript errors
tsc --noEmit 2>&1 | grep "error TS"

# Find implicit any
tsc --noEmit --strict 2>&1

# Count test files
find src/ -name "*.test.ts" | wc -l

# Run single test file
vitest run src/auth/session.test.ts

# Watch mode (dev)
vitest --watch

FAQ

What does the gravitas-typescript skill do?

GRAVITAS extension for TypeScript projects. Adds TypeScript-specific recon, strict mode patterns, Vitest/Jest integration, and common TS failure modes. Load in addition to the base GRAVITAS skill.

How do I install gravitas-typescript?

Run npx skills add https://github.com/udaysharmadev/gravitas --skill gravitas-typescript in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/gravitas-typescript/ (personal) or .claude/skills/gravitas-typescript/ (project).

Which AI agents can use gravitas-typescript?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is gravitas-typescript safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains gravitas-typescript?

It is published by udaysharmadev in udaysharmadev/gravitas. It has 265 recorded installs.

More from udaysharmadev/gravitas

View all →

gravitas

udaysharmadev/gravitas

Use for software implementation, debugging, refactoring, review, migration, and other repository-changing engineering work where correctness must be verified. Enforces scoped reconnaissance, adaptive planning, evidence-backed verification, requirement tracking, failure recovery, and budget-aware delegation. Model-agnostic reliability runtime for coding agents -- measured, not claimed.

gravitas-highstakes

udaysharmadev/gravitas

Mandatory checkpoint skill for irreversible/high-stakes changes (schema migrations, file deletion, auth/security changes, production config, force-pushes). Use when a task risks hard-to-reverse damage.

Backend & APIs267 installs

gravitas-python

udaysharmadev/gravitas

GRAVITAS extension for Python projects. Adds Python-specific recon, type checking with mypy/pyright, ruff/flake8 lint, pytest patterns, and common Python failure modes. Load in addition to the base GRAVITAS skill.

Testing & QA257 installs

Popular code quality & workflow skills

View category →

grill-me

mattpocock/skills

A relentless interview to sharpen a plan or design.

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

handoff

mattpocock/skills

Compact the current conversation into a handoff document for another agent to pick up.

domain-modeling

mattpocock/skills

Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

codebase-design

mattpocock/skills

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

diagnosing-bugs

mattpocock/skills

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.