arxdsilva/agent-office / .claude/skills/add-port-adapter
add-port-adapter
VerifiedAdd or extend a driven port and its adapter in agent-office's hexagonal core — storage/persistence, OS integration, clock/scheduling, external services, a new notification channel. Use whenever the core needs something new from the outside world.
Add a driven port and adapter
Rules: ARCHITECTURE.md (ports are additive; only the composition root knows concrete classes), TESTING.md (TDD; contract suites are mandatory).
- Can an existing port do it? Check
packages/core/src/ports/driven.tsfirst. Prefer a new, narrow port over growing an existing one, and never change an existing method's signature. - Red: contract suite. Add
xxxContract(name, make)inpackages/core/test/contracts/. It describes the behavior every implementation must have: round trips, errors as domain errors (ValidationError, …), idempotency and isolation. - Fake. Add a fake or recording implementation to
packages/core/test/fakes/index.tsand run it through the contract inpackages/core/test/fakes.test.ts. - Use case. Write a failing test in
core/src/application/*.test.tsusing the fake, then implement it so it depends on the port only. Wire it intocreateOffice(OfficeDeps) if it's office-wide. - Real adapter.
- Node:
packages/adapters/src/<area>/. Electron:packages/desktop/src/main/adapters/electron-*.ts. - Run the same contract suite against it, using temp dirs and never real user files.
- Node:
- Wire it in
packages/desktop/src/main/composition.ts(Electron objects come in throughShell, built inindex.ts). Extendcomposition.test.ts. make arch(the dependency rule) andmake check. For Electron adapters, alsomake build test-ui.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |