rule-api-adapters

Community

Enforce robust API adapters.

Authorbtabaska
Version1.0.0
Installs0

System Documentation

What problem does it solve?

It defines and enforces a cohesive set of API adapter design rules to ensure consistent, secure, and maintainable integration code across the repository.

Core Features & Use Cases

  • Config Pattern: Always implement adapter configuration as a class inheriting from PydanticBaseEnvConfig with a standardized environment prefix.
  • Retry Logic: Use tenacity for retries with a uniform decorator, ensuring proper handling of transient errors.
  • Factory Pattern: Instantiate adapters via factory functions/classes when multiple implementations exist.
  • Mock Clients: Provide dedicated mock adapters alongside real ones for deterministic testing.
  • Client Class Structure: Encapsulate external API calls in a dedicated client class with a config object.
  • Session Management: Pass database/session objects through method parameters; avoid storing them on adapters.
  • Error Mapping: Map external errors to internal exceptions and log before re-raising.
  • Adapter Boundaries: Route external calls through adapters; keep service layer free of direct external dependencies.
  • Logging: Initialize module-level loggers and avoid exposing credentials; log outcomes for external calls.
  • Context Enrichment: Use architecture guidance from smaller MCP rules for adapter design decisions.

Quick Start

Review and apply the api adapters rules to ensure code complies with standard patterns across adapters.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: rule-api-adapters
Download link: https://github.com/btabaska/simpler-grants-documentation-automation/archive/main.zip#rule-api-adapters

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.