Gateway Builder

Create gateway classes that integrate external services via Protocol interfaces.

1|Updated Jul 10, 2025
One-click install
npx skills add https://github.com/jzallen/fred_simulations --skill gateway-builder
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Gateway Builder
Source: https://github.com/jzallen/fred_simulations/tree/main/.claude/skills/gateway-builder
Command: npx skills add https://github.com/jzallen/fred_simulations --skill gateway-builder

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams design robust gateway components that encapsulate external service interactions, enabling clean architecture and testability by decoupling business logic from infrastructure specifics.

Core Features & Use Cases

  • Interface-First Design: Define a Protocol-based gateway interface in gateways/interfaces.py before implementing concrete gateways.
  • Domain Model Focus: Gateway methods accept a nd return business/domain models, never external API types.
  • External Service Abstraction: Hide all external details behind the gateway interface; configure via constructor or constants; supports dependency injection for testing.
  • Testability: Gateways are easily mockable via the Protocol interfaces for unit tests.

Quick Start

  1. Create a Protocol interface at gateways/interfaces.py. 2) Implement a concrete gateway class that adheres to the interface. 3) Wire the gateway into use cases via dependency injection. 4) Run unit tests to verify behavior.

Frequently Asked Questions about Gateway Builder

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

FAQPage Schema
How do I design gateway classes for external service integration?

Design gateways using Protocol interfaces that define contracts for external service calls. Create a `gateways/interfaces.py` file with Protocol definitions, then implement concrete gateway classes that accept and return domain models while hiding external API types behind the interface abstraction.

Why use dependency injection with gateway patterns?

Dependency injection enables clean architecture by decoupling business logic from infrastructure specifics. It makes gateways mockable for unit testing and allows you to swap implementations—such as switching between real AWS calls and test doubles—without changing application code.

Can I use gateway patterns with third-party APIs and clean architecture?

Yes. Gateway patterns are specifically designed for third-party API integration within clean architecture. Define a Protocol interface, implement a concrete gateway that translates between domain models and external API contracts, then inject it into use cases to shield business logic from API details.

What's the best way to handle errors and retries in external service gateways?

Implement error handling and retry logic within gateway classes so external service failures don't propagate directly to business logic. Configure retry policies and error mappings in the gateway constructor, allowing use cases to work with domain-level exceptions that abstract infrastructure concerns.

How do I ensure my gateways are testable?

Define gateways as Protocol interfaces and inject mock implementations in tests. Since gateways accept and return domain models rather than external API types, you can easily create test doubles that simulate service behavior without calling real external systems.

Do I need to configure gateways for different environments?

Yes. Pass configuration such as API endpoints, credentials, and timeout settings to the gateway constructor or use constants. This allows the same gateway implementation to work across development, testing, and production environments through dependency injection.