بنقرة واحدة
hexagonal-architecture
Ports-and-adapters architecture patterns for testable, framework-independent domain logic.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Ports-and-adapters architecture patterns for testable, framework-independent domain logic.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Optimize token usage and context window discipline. Reduce costs and improve response quality through smart context management.
Unified context lifecycle for FlowDeck sessions — ingest, filter, prune, protect, summarize, and persist with telemetry.
Predict affected files, modules, APIs, tests, and DB paths before changes. Returns an impact map for human review.
Map architecture, conventions, and file structure into `.codebase/`. Use when onboarding or before deep feature work.
Plan differently when the agent has low certainty — ask for clarification or narrow scope instead of pretending full understanding.
Protect critical context from pruning during compaction. Preserve active plans, safety files, pending operations, and user intent anchors.
| name | hexagonal-architecture |
| description | Ports-and-adapters architecture patterns for testable, framework-independent domain logic. |
| origin | FlowDeck |
When building applications that must remain flexible to changing external systems (databases, APIs, UI frameworks) and need to support multiple entry points (ports) for the same business logic.
// Domain Core - Pure business logic, no infrastructure dependencies
class Transfer {
constructor(
public readonly fromAccountId: string,
public readonly toAccountId: string,
public readonly amount: number
) {}
execute(accounts: Map<string, Account>): TransferResult {
const from = accounts.get(this.fromAccountId)
const to = accounts.get(this.toAccountId)
if (!from || !to) {
return TransferResult.failed('Account not found')
}
if (!from.canDebit(this.amount)) {
return TransferResult.failed('Insufficient funds')
}
from.debit(this.amount)
to.credit(this.amount)
return TransferResult.success()
}
}
// Inbound Port (Primary Port) - Interface for driving operations
interface TransferUseCase {
execute(transfer: Transfer): TransferResult
}
// Outbound Port (Secondary Port) - Interface for driven operations
interface AccountRepository {
findById(id: string): Promise<Account | null>
save(account: Account): Promise<void>
}
interface EventBus {
publish(event: DomainEvent): Promise<void>
}
// Primary Adapter - REST API
class TransferController implements TransferUseCase {
constructor(private readonly accounts: AccountRepository) {}
async execute(transfer: Transfer): Promise<TransferResult> {
const allAccounts = await this.accounts.findById(transfer.fromAccountId)
// ... handle via injected port
}
}
// Secondary Adapter - PostgreSQL implementation
class PostgresAccountRepository implements AccountRepository {
constructor(private readonly db: Database) {}
// ... implementation
}