clean-architecture-skill
darellchua2/civiltekk-opencode-claude-skills/skills/clean-architecture-skill/SKILL.md
Apply clean architecture principles with vertical slicing, dependency rule, clear layer boundaries, and feature-first organization - language-agnostic
Skill6 starsChanged 15 days ago
What's in it
- What I do
- When to use me
- House Learnings
- Learning: doc-claimed-purity-vs-reality
- Learning: cross-container-hook-borrowing
---
name: clean-architecture-skill
description: Apply clean architecture principles with vertical slicing, dependency rule, clear layer boundaries, and feature-first organization - language-agnostic
license: Apache-2.0
compatibility: opencode
category: Code Quality
---
## What I do
Structure codebases by vertical feature slices + horizontal layers (domain ← application ← infrastructure ← presentation), enforce the dependency rule (source dependencies point inward only), define contracts at boundaries.
## When to use me
- Structuring a new codebase or module; deciding where a piece of code belongs
- Reviewing whether a boundary is real (enforced) or decorative
Canonical house layouts: frontend `features/<feature>/{_components,_containers,hooks}` + `domains/<feature>`; backend `modules/<module>/{domain,application,infrastructure,presentation}` (domain holds interfaces, infrastructure holds implementations).
## House Learnings
### Learning: `doc-claimed-purity-vs-reality`
A layer rule documented but violated by >10 call sites is a false contract — leaving doc and code in disagreement trains every developer to ignore both. Either enforce the boundary with tooling (`no-restricted-imports` per-directory overrides, `madge --circular`, dependency-cruiser in CI) or rewrite the doc to describe reality. Never let architecture docs and code drift — the drift becomes the de facto standard.
Detection: `rg "from '@prisma/client'|from 'pg'" src/domain/ -l | wc -l` · `npx madge --circular --extensions ts src/domain/`
### Learning: `cross-container-hook-borrowing`
A feature container must NEVER import from a sibling container via relative path (`../../_containers/ReportDetail/useReportDetail`) — invisible coupling that breaks silently on refactor. If two containers need one hook, extract to the feature's `hooks/` (intra-feature) or `domains/{feature}/hooks/` (cross-feature). Containers import ONLY from `@/`-aliased shared locations or their own feature's `hooks/`.
Detection: `rg "from\s+['\"](\.\./)+.*_containers" --type ts --type tsx`
> Removed 2026-09: layered/hexagonal/clean-architecture comparison essays, dependency-rule diagrams, vertical/horizontal boundary walkthroughs, cross-cutting-concern lists, frontend/backend directory deep-dives, steps/common-issues ceremony — textbook architecture knowledge; the two codified learnings are this config's real additions.
More agent context in darellchua2/civiltekk-opencode-claude-skills
120 other files this repository gives its agents, the first 60 shown.
AGENTS.md
Skill
- accessibility-a11y-skillskills/accessibility-a11y-skill/SKILL.md
- agent-introspection-debugging-skillskills/agent-introspection-debugging-skill/SKILL.md
- amplify-nextjs-deployment-skillskills/amplify-nextjs-deployment-skill/SKILL.md
- authentication-authorization-skillskills/authentication-authorization-skill/SKILL.md
- autodesk-aps-skillskills/autodesk-aps-skill/SKILL.md
- autoresearch-code-skillskills/autoresearch-code-skill/SKILL.md
- autoresearch-core-skillskills/autoresearch-core-skill/SKILL.md
- autoresearch-ml-skillskills/autoresearch-ml-skill/SKILL.md
- autoresearch-research-skillskills/autoresearch-research-skill/SKILL.md
- aws-iac-safety-skillskills/aws-iac-safety-skill/SKILL.md
- blast-radius-skillskills/blast-radius-skill/SKILL.md
- cad-bambu-labs-skillskills/cad-bambu-labs-skill/SKILL.md
- cad-dxf-skillskills/cad-dxf-skill/SKILL.md
- cad-gcode-skillskills/cad-gcode-skill/SKILL.md
- cad-generation-skillskills/cad-generation-skill/SKILL.md
- cad-implicit-skillskills/cad-implicit-skill/SKILL.md
- cad-redraw-skillskills/cad-redraw-skill/SKILL.md
- cad-sdf-skillskills/cad-sdf-skill/SKILL.md
- cad-sendcutsend-skillskills/cad-sendcutsend-skill/SKILL.md
- cad-srdf-skillskills/cad-srdf-skill/SKILL.md
- cad-step-parts-skillskills/cad-step-parts-skill/SKILL.md
- cad-urdf-skillskills/cad-urdf-skill/SKILL.md
- cad-viewer-skillskills/cad-viewer-skill/SKILL.md
- changelog-python-cliff-skillskills/changelog-python-cliff-skill/SKILL.md
- civil-3d-skillskills/civil-3d-skill/SKILL.md
- civiltekk-api-spec-skillskills/civiltekk-api-spec-skill/SKILL.md
- civiltekk-context-optimization-skillskills/civiltekk-context-optimization-skill/SKILL.md
- civiltekk-diagram-skillskills/civiltekk-diagram-skill/SKILL.md
- civiltekk-documentation-inline-skillskills/civiltekk-documentation-inline-skill/SKILL.md
- civiltekk-documentation-sync-skillskills/civiltekk-documentation-sync-skill/SKILL.md
- civiltekk-git-commits-skillskills/civiltekk-git-commits-skill/SKILL.md
- civiltekk-nextjs-skillskills/civiltekk-nextjs-skill/SKILL.md
- referencesskills/civiltekk-opencode-creation-skill/references/skill.md
- civiltekk-opencode-creation-skillskills/civiltekk-opencode-creation-skill/SKILL.md
- civiltekk-opentofu-skillskills/civiltekk-opentofu-skill/SKILL.md
- civiltekk-ponytail-audit-skillskills/civiltekk-ponytail-audit-skill/SKILL.md
- civiltekk-pr-workflow-skillskills/civiltekk-pr-workflow-skill/SKILL.md
- civiltekk-python-backend-skillskills/civiltekk-python-backend-skill/SKILL.md
- civiltekk-react-quality-skillskills/civiltekk-react-quality-skill/SKILL.md
- civiltekk-requirements-specs-skillskills/civiltekk-requirements-specs-skill/SKILL.md
- civiltekk-startup-docs-skillskills/civiltekk-startup-docs-skill/SKILL.md
- civiltekk-test-generation-skillskills/civiltekk-test-generation-skill/SKILL.md
- civiltekk-zai-media-skillskills/civiltekk-zai-media-skill/SKILL.md
- clean-code-skillskills/clean-code-skill/SKILL.md
- code-smells-skillskills/code-smells-skill/SKILL.md
- complexity-management-skillskills/complexity-management-skill/SKILL.md
- construction-bd-skillskills/construction-bd-skill/SKILL.md
- continuous-learning-skillskills/continuous-learning-skill/SKILL.md
- coverage-readme-workflow-skillskills/coverage-readme-workflow-skill/SKILL.md
- database-migration-skillskills/database-migration-skill/SKILL.md
- deprecated-code-cleanup-skillskills/deprecated-code-cleanup-skill/SKILL.md
- design-patterns-skillskills/design-patterns-skill/SKILL.md
- dev-uat-promotion-skillskills/dev-uat-promotion-skill/SKILL.md
- docker-containerization-skillskills/docker-containerization-skill/SKILL.md
- docling-mcp-skillskills/docling-mcp-skill/SKILL.md
- docx-creation-skillskills/docx-creation-skill/SKILL.md
- domain-modeling-skillskills/domain-modeling-skill/SKILL.md
- email-drafter-skillskills/email-drafter-skill/SKILL.md
- error-resolver-workflow-skillskills/error-resolver-workflow-skill/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

