smithery.ai

typescript-refactor

Safely refactor TypeScript code while maintaining type safety and test coverage. Includes verification steps.

First seen Mar 20, 2026

Installation

$ npx skills add https://smithery.ai

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,642 B
  • docs SUMMARY.md 136 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

TypeScript Refactor Skill

Safely refactor TypeScript code with full verification.

Pre-Refactor Checklist

  1. Run current tests to establish baseline:

``bash npm run test ``

  1. Run type check:

``bash npm run typecheck ``

  1. Note current state as baseline

Refactoring Patterns

Extract Function

// Before
function process(data: Data) {
  // complex validation logic
  if (!data.field1) throw new Error("field1 required");
  if (!data.field2) throw new Error("field2 required");
  // ... more processing
}

// After
function validateData(data: Data): void {
  if (!data.field1) throw new Error("field1 required");
  if (!data.field2) throw new Error("field2 required");
}

function process(data: Data) {
  validateData(data);
  // ... more processing
}

Extract Component (React)

// Before: Large component with repeated patterns
// After: Smaller, focused components with clear props

Rename Symbol

# Find all usages first
grep -r "oldName" --include="*.ts" --include="*.tsx" src/

Post-Refactor Verification

  1. Run type check:

``bash npm run typecheck ``

  1. Run tests:

``bash npm run test ``

  1. Run linter:

``bash npm run lint ``

  1. Build project:

``bash npm run build ``

Rules

  • Never change behavior during refactor
  • One refactor type at a time
  • Commit after each successful refactor
  • If tests fail, rollback immediately