بنقرة واحدة
hexagonal-architecture
Design and implement features using Ports and Adapters (Hexagonal Architecture)
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Design and implement features using Ports and Adapters (Hexagonal Architecture)
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Write journal entries and respond to GitHub issues
Build features and fix bugs strictly according to BDD.md scenarios
Analyse the codebase and BDD coverage to find gaps, bugs, and improvement opportunities
Disciplined diagnosis loop for hard bugs and performance regressions. Reproduce → minimise → hypothesise → instrument → fix → regression-test. Use when user says "diagnose this" / "debug this", reports a bug, says something is broken/throwing/failing, or describes a performance regression.
| name | hexagonal-architecture |
| description | Design and implement features using Ports and Adapters (Hexagonal Architecture) |
| tools | ["write_file","edit_file","read_file"] |
Every feature you implement must be structured so the domain logic is isolated from infrastructure. Use three layers:
Protocol or ABC living in src/ports/<name>.py# src/ports/file_reader.py
from typing import Protocol
class FileReader(Protocol):
def read(self, path: str) -> str: ...
src/adapters/<technology>/<name>.pyos, subprocess, requests, etc.)# src/adapters/filesystem/os_file_reader.py
class OsFileReader:
def read(self, path: str) -> str:
with open(path) as f:
return f.read()
src/ or scripts/ as appropriate# src/scenario_loader.py
from src.ports.file_reader import FileReader
from src.adapters.filesystem.os_file_reader import OsFileReader
def load_scenario(path: str, reader: FileReader = OsFileReader()) -> str:
return reader.read(path)
FileReader, CommandRunner, IssueTracker)If the unit is pure data transformation with no I/O (parsing, formatting, calculating), skip the port layer entirely — it would be over-engineering. Note this explicitly in PLAN.md.
src/
ports/
file_reader.py # Protocol: read(path) -> str
command_runner.py # Protocol: run(cmd) -> (stdout, returncode)
adapters/
filesystem/
os_file_reader.py # OsFileReader implements FileReader
subprocess/
shell_runner.py # ShellRunner implements CommandRunner
def test_load_scenario_reads_correct_path():
# BDD: Load scenario from file
captured = {}
def fake_reader(path):
captured["path"] = path
return "Scenario: test"
result = load_scenario("BDD.md", reader=fake_reader)
assert captured["path"] == "BDD.md"
assert "Scenario: test" in result
No unittest.mock, no patching — just pass a function or object that satisfies the Protocol.