ExtractAdapter

Create TypeScript adapter layers for external dependencies without modifying existing code.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/fnoritomi/tabulador-dados-abertos --skill extractadapter
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ExtractAdapter
Source: https://github.com/fnoritomi/tabulador-dados-abertos/tree/main/.agent/skills/extract-adapter
Command: npx skills add https://github.com/fnoritomi/tabulador-dados-abertos --skill extractadapter

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Create a boundary/adapter layer to isolate external dependencies (browser APIs, third-party libraries, and system APIs) without modifying existing code that consumes them.

Core Features & Use Cases

  • Interface-first design to define a minimal cross-platform boundary.
  • Production adapters that wrap real APIs (e.g., browser.ts) and export a single platform object.
  • Test doubles and mocks to simplify unit testing and CI.
  • Facilitates dependency injection and easier code maintenance across modules.

Quick Start

Create a TypeScript project structure and add src/platform/browser.ts implementing the Platform interface; implement production adapter logic, export a singleton, and optionally add a mock factory for tests. Then wire into your codebase by replacing direct API calls with the adapter.

Frequently Asked Questions about ExtractAdapter

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

FAQPage Schema
How do I isolate browser APIs like fetch and localStorage for unit testing in TypeScript?

You can isolate browser globals by defining a TypeScript interface and creating a production adapter layer that wraps APIs like fetch and localStorage, enabling dependency injection of test doubles without modifying existing code.

What is an adapter layer for external dependencies?

An adapter layer is a boundary interface that abstracts external dependencies like third-party singletons and system APIs, providing a minimal surface area to facilitate dependency injection and code maintenance.

How do I set up dependency injection for browser globals in a TypeScript project?

Set up dependency injection by defining a TypeScript interface, implementing production adapters in a platform file, exporting a singleton, and replacing direct API calls with the adapter to wire it into your codebase.

Can I mock third-party singletons without changing the existing code that uses them?

Yes, you can mock third-party singletons without modifying consuming code by establishing a boundary interface and injecting test doubles, leaving the production adapters to manage real API interactions.

Does building an adapter layer require modifying the code that consumes the external APIs?

Building an adapter layer isolates external dependencies without modifying existing code logic, requiring only the replacement of direct API calls with adapter calls to redirect the dependency flow.