api-layer

Enforce a tri-provider API layer with HTTP, Firebase, and Mock factories.

Updated Feb 27, 2026
One-click install
npx skills add https://github.com/alejandro-technology/react-native-template --skill api-layer-alejandro-technology
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-layer
Source: https://github.com/alejandro-technology/react-native-template/tree/main/.claude/skills/enforcement/api-layer
Command: npx skills add https://github.com/alejandro-technology/react-native-template --skill api-layer-alejandro-technology

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill enforces a standard architectural pattern for service layers that seamlessly switch between HTTP, Firebase, and Mock providers, ensuring consistency and safer error handling.

Core Features & Use Cases

  • Four-infrastructure factory pattern per entity: {entity}.service.ts, {entity}.http.service.ts, {entity}.firebase.service.ts, {entity}.mock.service.ts.
  • Provider switching driven by a single CONFIG.SERVICE_PROVIDER switch, enabling seamless environment changes.
  • All service methods return Promise<T | Error> and utilize centralized error helpers (manageAxiosError, manageFirebaseError) without throwing.
  • Encourages maintainable, testable service layers across REST, realtime, and mock data sources.

Quick Start

Create a new service by adding the four infrastructure files and wiring a factory to the chosen provider.

Frequently Asked Questions about api-layer

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

FAQPage Schema
How do I switch between HTTP, Firebase, and Mock data providers in a TypeScript service layer?▼

Switching between HTTP, Firebase, and Mock providers in a TypeScript service layer is done by changing a single CONFIG.SERVICE_PROVIDER switch, which routes requests to the selected provider infrastructure without altering service method signatures.

What is a tri-provider API architecture for REST, realtime, and mock data sources?▼

A tri-provider API architecture unifies REST, realtime, and mock data sources under a single factory pattern, enforcing a consistent service layer with predictable error contracts and a single source of truth for provider selection across environments.

How do I standardize error handling across Firebase and HTTP service methods?▼

Standardize error handling across Firebase and HTTP service methods by returning Promise<T | Error> from all service methods and routing exceptions through centralized error helpers like manageAxiosError and manageFirebaseError without throwing.

Does this service factory pattern require specific file structures for each entity?▼

Yes, this service factory pattern requires four infrastructure files per entity: {entity}.service.ts, {entity}.http.service.ts, {entity}.firebase.service.ts, and {entity}.mock.service.ts to maintain a predictable and testable service layer.

Can I use a mock service provider for testing without changing application logic?▼

You can use a mock service provider for testing without changing application logic by setting the CONFIG.SERVICE_PROVIDER switch to mock, which seamlessly redirects the service factory to return mock data.