pluggable-architecture

Implements ports-and-adapters architecture with Spring conditional wiring for swappable technology integrations.

Updated Jun 25, 2026
One-click install
npx skills add https://github.com/oriddd/ai-toolkit --skill pluggable-architecture-oriddd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pluggable-architecture
Source: https://github.com/oriddd/ai-toolkit/tree/main/copilot/public/skills/pluggable-architecture
Command: npx skills add https://github.com/oriddd/ai-toolkit --skill pluggable-architecture-oriddd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Business code often becomes tightly coupled to specific vendor SDKs (Redis, Kafka, Datadog, Oracle), making technology swaps expensive and risky. This Skill enforces a hexagonal architecture where every external integration sits behind a project-owned port interface, so providers can be replaced or combined purely through configuration. ## Core Features & Use Cases - Three-Layer Structure: Generates a vendor-free port under spi/, vendor-specific adapters under adapter/<vendor>/, and conditional wiring under config/ for every capability. - Config-Driven Selection: Uses @ConditionalOnProperty, @ConditionalOnClass, and @ConditionalOnMissingBean so swapping a cache or metrics backend requires only a one-line property change. - Multi-Provider Composition: Supports broadcast, failover, priority, and weighted modes via a composite adapter with per-provider failure isolation. - Mechanical Enforcement: Provides ArchUnit rules that fail the build if vendor types leak into spi/ or domain code depends on adapters. - Use Case: When adding a cache to a Spring Boot service, apply this Skill to create a CachePort interface, Redis and NoOp adapters, and a platform.cache.provider property — then switch providers later without touching business logic. ## Quick Start Apply the pluggable-architecture skill to refactor this service so its Redis cache access goes through a vendor-free port interface with configuration-driven adapter selection.

Frequently Asked Questions about pluggable-architecture

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

FAQPage Schema
How do I implement ports and adapters in Spring Boot?

Define a vendor-free interface in an spi package, implement it in adapter classes under adapter/<vendor>/, and wire them in a config class using @ConditionalOnProperty and @ConditionalOnClass. Domain code depends only on the port interface.

How to swap cache providers like Redis without changing business code?

Put the cache behind a CachePort interface and select the adapter with a property such as platform.cache.provider=redis. Changing the property value activates a different adapter bean, with a NoOp fallback via @ConditionalOnMissingBean.

Can Spring Boot send metrics to multiple backends at once?

Yes, use a composite adapter that implements the same MetricsPort and fans out to multiple delegates in broadcast, failover, priority, or weighted mode. Wrap each delegate call so one provider's failure does not affect the others.

How do I enforce hexagonal architecture rules automatically?

Write ArchUnit tests that fail the build when classes outside adapter and config packages depend on adapters, when spi packages import vendor types, or when adapter classes do not implement a port interface.

When should I not use a ports-and-adapters approach?

The pattern adds three packages per capability, so it may be excessive for throwaway prototypes with a single fixed dependency. It is designed for code that integrates external technologies where swap or multi-provider needs are plausible.