infra-import-refactor

Refactors TypeScript infrastructure imports into DI-managed port interfaces and adapters.

1|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/jrmatherly/shipit --skill infra-import-refactor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: infra-import-refactor
Source: https://github.com/jrmatherly/shipit/tree/main/.claude/skills/infra-import-refactor
Command: npx skills add https://github.com/jrmatherly/shipit --skill infra-import-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactor direct infra imports into port interfaces to enable clean dependency injection and improve maintainability.

Core Features & Use Cases

  • Create and wire port interfaces to replace direct infrastructure imports.
  • Update consumers to depend on ports and configure DI containers accordingly.
  • Guide end-to-end refactoring across application and presentation layers in TypeScript projects.

Quick Start

Provide the path to your TypeScript project and command the assistant to begin refactoring infrastructure imports.

Frequently Asked Questions about infra-import-refactor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor direct infrastructure imports in TypeScript to use dependency injection?

Refactor infrastructure imports by replacing them with port interfaces and wiring adapters in the DI container. This updates consumers and tests to depend on ports, enforcing clean architecture boundaries.

What is a port interface in clean architecture for TypeScript projects?

A port interface is an abstraction that replaces direct infrastructure imports in application layers. It allows dependency injection to provide adapter implementations, decoupling core logic from infrastructure code.

How do I wire up a dependency injection container when refactoring to clean architecture?

Wiring a DI container involves registering new adapter implementations for infrastructure code and updating consumers to resolve these dependencies through port interfaces instead of direct imports.

Can I use this refactoring approach for application and presentation layers violating clean architecture?

Yes, the refactoring applies to TypeScript projects where application or presentation layers violate clean architecture by directly importing infrastructure code, replacing them with port interfaces.

What is the best way to update tests when refactoring infrastructure imports to ports?

Update tests to depend on port interfaces rather than direct infrastructure implementations. Configure the dependency injection container to provide test doubles or mock adapters for the new interfaces.

Why does my TypeScript project violate clean architecture when importing infrastructure code?

Importing infrastructure code directly into application or presentation layers violates clean architecture by creating tight coupling. Refactoring to port interfaces and dependency injection restores proper layer separation.