ワンクリックで
check-architecture
Audit the codebase for hexagonal architecture violations (forbidden imports, dependency direction, port conformance)
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Audit the codebase for hexagonal architecture violations (forbidden imports, dependency direction, port conformance)
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Update CLAUDE.md and README.md to reflect code changes
Explain Theatrum's hexagonal (ports & adapters) architecture with concrete examples from the codebase
Expert reference on streaming protocols (HLS, DASH, RTMP, adaptive bitrate) grounded in Theatrum's implementation
Boot the app, stream via RTMP, watch via HLS/DASH, and validate the full pipeline
Write Go unit and e2e tests following Theatrum's exact conventions
Manage and extend the CI/CD pipeline (GitHub Actions, Docker, build scripts)
| name | check-architecture |
| description | Audit the codebase for hexagonal architecture violations (forbidden imports, dependency direction, port conformance) |
| allowed-tools | Read, Grep, Glob, Bash |
You are an architecture auditor for Theatrum. Your job is to scan the codebase and report any violations of the hexagonal (ports & adapters) architecture rules. Use $ARGUMENTS to focus on a specific area (e.g., /check-architecture domain or /check-architecture src/adapters/driver/rtmp/).
Files in src/domain/ must ONLY import:
Theatrum/constantsTheatrum/domain/* (own sub-packages)github.com/prometheus/client_golang)Forbidden imports from domain:
Theatrum/adapters/* — any adapter import is a violationKnown exception (document but still flag):
src/domain/jobs/encodeJob.go imports Theatrum/adapters/driven/metrics — this is a known pragmatic violation for instrumentationFiles in src/adapters/driven/ must NOT import:
Theatrum/adapters/driver/*Driven adapters may import:
Theatrum/domain/modelsTheatrum/domain/repositories (to implement ports)Theatrum/constantsFiles in one driver adapter (e.g., src/adapters/driver/http/) must NOT import another driver adapter (e.g., src/adapters/driver/rtmp/).
Exception: Imports within the same driver adapter are fine (e.g., rtmp/handlers/ importing rtmp/management/).
src/domain/repositories/ — interfaces that driven adapters implementsrc/adapters/driver/ports/ — interfaces that driver adapters implementCheck that no port interfaces are defined in adapter implementation files.
Verify that each driven adapter actually implements its port interface:
fileAccess → StoragePort (ReadFile, WriteFile, DeleteFile, ListFiles, GetFileSize, SearchFiles)ffmpegEncoder → EncoderPort (EncodeVideo)yamlConfigFile → ConfigurationPort (Load)Verify driver adapters implement their ports:
httpServer → HttpPort (StartHttpServer, Shutdown, BuildRouter)rtmpServer → RtmpPort (StartRtmpServer, ShutdownRtmpServer, GetActiveStreams)Only src/cmd/main.go should instantiate adapters and wire dependencies. No adapter should directly instantiate another adapter (use DI instead).
Files in src/domain/models/ must not import adapter packages. They should only use:
Theatrum/constantsRun these checks in order:
Search for adapter imports in domain code:
cd src && grep -rn '"Theatrum/adapters' domain/
Every match is a violation (except the known jobs/encodeJob.go → metrics exception).
cd src && grep -rn '"Theatrum/adapters/driver' adapters/driven/
Every match is a violation.
# HTTP importing RTMP
cd src && grep -rn '"Theatrum/adapters/driver/rtmp' adapters/driver/http/
# RTMP importing HTTP
cd src && grep -rn '"Theatrum/adapters/driver/http' adapters/driver/rtmp/
Every match is a violation.
cd src && grep -rn '"Theatrum/adapters' domain/models/
Every match is a violation.
Verify port interfaces exist where expected:
# Driven ports
ls src/domain/repositories/*Port.go
# Driver ports
ls src/adapters/driver/ports/*.go
Search for stray interface definitions in adapter code:
cd src && grep -rn 'type.*Port interface' adapters/driven/ adapters/driver/http/ adapters/driver/rtmp/
Interfaces defined outside the expected locations may indicate architectural drift.
For each port, verify the adapter implements all methods. Read the port interface and the adapter, then compare method signatures.
# Look for New* calls to adapter constructors outside main.go
cd src && grep -rn 'NewFileAccess\|NewFfmpegEncoder\|NewYamlConfigFile\|NewHttpServer\|NewRtmpServer' --include='*.go' | grep -v 'cmd/main.go' | grep -v '_test.go'
Matches outside main.go and test files indicate DI bypass.
ffmpegargs is a shared package at src/shared/ffmpegargs/. Check that it's only imported by the expected consumers:
cd src && grep -rn '"Theatrum/shared/ffmpegargs"'
Expected importers: adapters/driven/ffmpegEncoder/repositories/ and adapters/driver/rtmp/management/.
After running all checks, produce a report:
## Architecture Audit Report
### CRITICAL Violations
- [file:line] Description of violation and which rule it breaks
### MODERATE Violations
- [file:line] Description
### KNOWN Exceptions (Documented)
- [file:line] Why this exists and how to fix it strictly
### Clean Areas
- List packages that passed all checks
### Recommendations
- Specific actionable steps to fix violations
| Severity | Description | Action |
|---|---|---|
| CRITICAL | Domain importing adapters, driven importing driver | Must fix — breaks hexagonal guarantees |
| MODERATE | Cross-driver imports, cross-adapter utility sharing | Should fix — creates coupling between independent modules |
| LOW | Port interface in unexpected location, missing method | Cosmetic — still functions correctly |
| KNOWN | Documented pragmatic violation (metrics in jobs) | Track — fix if doing a strict refactor |