Architecture practice for CANdb Studio - layered dependency rules, ports and adapters, quality-attribute scenarios, C4/Mermaid diagrams, ADR writing, fitness functions, evolution toward worker-thread/out-of-process designs. Use when designing features that cross layers or when writing/reviewing ADRs and architecture docs.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Software Architecture?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/afri-bit-software-architecture)
---
name: software-architecture
description: Architecture practice for CANdb Studio - layered dependency rules, ports and adapters, quality-attribute scenarios, C4/Mermaid diagrams, ADR writing, fitness functions, evolution toward worker-thread/out-of-process designs. Use when designing features that cross layers or when writing/reviewing ADRs and architecture docs.
---
# Software architecture practice
## Dependency rule
`presentation -> application -> core`, `infrastructure -> core` (implements ports). Core knows nothing outward. `shared/` is leaf utilities. Enforce with a fitness test: a unit test that scans `src/core` and `src/infrastructure/parsers` for `from 'vscode'` and for imports pointing outward.
## Ports and adapters
Define a port in `core` or `application` (`ICanBusAdapter`, `ILogSource`, `IDatabaseRepository`), implement in `infrastructure`, wire in `extension.ts`. Fakes in tests implement the same port. One **frame pipeline** for all sources.
## Quality-attribute scenarios (write these first)
`<Source> does <stimulus> under <condition>; the system <response> measured by <metric>.` Example: "A user opens a 1 GB BLF on a laptop; first frames appear < 2 s and extension-host memory stays < 300 MB."
Key attributes: correctness, determinism, performance on large data, responsiveness (never block the extension host), security, testability, evolvability.
## Concurrency
Extension host is single-threaded: CPU-heavy parsing or decode of large data goes to a worker thread or out-of-process helper with a typed message protocol, versioned and validated. Document ownership of mutable state.
## Diagrams
Use C4 levels in Mermaid in `docs/architecture/`: Context, Containers (extension host, webview, helper), Components (services), and sequence diagrams for flows (load -> change -> save; frame -> decode -> UI). Keep them next to the code they describe and update with the change.
## ADRs
Write when a decision is costly to reverse: formats, protocols, adapter strategy, threading, persistence, dependencies. Template `docs/adr/0000-template.md`. Include >= 2 options with honest cons, decision, consequences, and the issue link. Supersede, never rewrite history.
## Smells to push back on
Parallel global singletons beside `EventBus`; webview holding the source of truth; presentation code containing domain rules; adapters leaking vendor types; unbounded buffers; time read from `Date.now()` inside domain logic.