Refactoring Inline Types

🌐Community
by djankies · vlatest · Repository

Automatically refactors complex inline types into named interfaces/types for improved code readability and maintainability.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add refactoring-inline-types npx -- -y @trustedskills/refactoring-inline-types
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "refactoring-inline-types": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/refactoring-inline-types"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

This skill refactors inline types into named type definitions within TypeScript code. It helps improve code readability and maintainability by extracting complex type structures from their usage locations, giving them descriptive names. The skill aims to reduce redundancy and make type checking more robust across a codebase. This process is particularly useful when dealing with deeply nested or repeated type patterns.

When to use it

  • Complex Type Definitions: When you have long, complicated types directly embedded within function signatures or variable declarations.
  • Code Duplication: When the same complex type structure is used in multiple places throughout your codebase.
  • Improved Readability: To make code easier to understand and reason about by giving meaningful names to type definitions.
  • Refactoring Legacy Code: As part of a larger effort to modernize or improve the quality of an existing TypeScript project.

Key capabilities

  • Extracts inline types into named type declarations.
  • Supports various TypeScript type constructs (e.g., interfaces, type aliases).
  • Automates the refactoring process based on provided code snippets.

Example prompts

  • "Refactor the following TypeScript code to extract inline types:" [paste code snippet]
  • "Improve readability of this function by defining a named type for its parameter:" [paste code snippet]
  • "Can you identify and refactor any repeated complex types in this file?" [paste file content]

Tips & gotchas

  • This skill requires valid TypeScript code as input. Errors in the provided code may lead to unexpected results or failures.
  • The skill's effectiveness depends on the complexity and structure of the inline types; very simple types might not benefit from refactoring.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
djankies
Installs
2

🌐 Community

Passed automated security scans.