Agent skill
aoa-port-adapter-refactor
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/aoa-port-adapter-refactor
SKILL.md
aoa-port-adapter-refactor
Intent
Use this skill to separate domain or application logic from concrete infrastructure details by introducing or clarifying ports and adapters.
Trigger boundary
Use this skill when:
- business or domain logic is tightly coupled to a concrete dependency
- tests are hard to write because external concerns leak into the core logic
- the same dependency pattern is beginning to repeat across modules
- a module needs a clearer seam before further change
Do not use this skill when:
- the task is a tiny local fix with no architectural pressure
- there is no meaningful boundary to clarify yet
- the code would become more ceremonial than useful after extraction
- the main problem is deciding whether logic belongs in the core or at the edge; use
aoa-core-logic-boundaryfirst - the main problem is clarifying repository docs or source-of-truth ownership; use
aoa-source-of-truth-checkfirst
Inputs
- target module or slice
- concrete dependency that currently leaks into the core logic
- desired scope of refactor
- validation expectations
Outputs
- clearer boundary between logic and infrastructure
- proposed or implemented port shape
- proposed or implemented adapter shape
- verification summary
Procedure
- identify the concrete dependency that is making change or testing harder
- isolate the reusable logic from the infrastructure-specific behavior
- define a narrow port around what the core actually needs
- move infrastructure-specific behavior behind an adapter or equivalent seam
- keep the refactor bounded and avoid unrelated cleanup
- verify that the new boundary improves clarity and does not silently change behavior
Contracts
- the extracted boundary should reduce coupling, not add decorative abstraction
- the port should stay narrow and purpose-shaped
- the refactor should not widen into a hidden rewrite
- the final result should remain understandable to another human or agent
Risks and anti-patterns
- introducing empty abstractions with no real boundary value
- extracting a port that mirrors an overgrown concrete dependency instead of narrowing it
- using the refactor as a pretext for unrelated architectural churn
- making tests more indirect without improving clarity
Verification
- confirm the concrete dependency pressure was real
- confirm the new boundary is narrower and clearer than before
- confirm behavior did not drift silently
- confirm the refactor stayed inside the declared scope
Technique traceability
Manifest-backed techniques:
- AOA-T-PENDING-PORT-ADAPTER-REFACTOR from
8Dionysus/aoa-techniquesatTBDusing pathTBDand sections: Intent, When to use, Inputs, Outputs, Core procedure, Contracts, Risks, Validation
Adaptation points
Future project overlays may add:
- local architecture conventions
- preferred adapter locations
- local test commands
- repository-specific review rules
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?