Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

hexagonal-architecture

БесплатноБез исполняемых скриптовНе проверен

Decide WHERE new code goes and WHO may know about whom, before writing it — vigiles is hexagonal (domain, app, adapters, root), and the recurring failure is…

zernieот zernie★ 17 звёзд на GitHub

Об этом скилле

Hexagonal architecture in vigiles

One rule decides everything below: dependencies point inward. The inner layer defines what it needs (a port: an interface or a type); outer code implements it; one composition root picks the implementations and hands them in. An inner file never imports, names or lists an outer thing — not by import, not by string, not by type name.

The map (what eslint.config.mjs enforces today)

layer where may import knows about
domain src/core/ domain, pure libraries nothing outside itself
app src/*.ts (scan, score, report, runners) domain, other app files ports, never a concrete adapter
adapter src/adapters/<harness>/, src/host/ domain only its own harness (host: the machine) only
rule src/rules/<id>.ts domain only its own id and nothing else
ruleset src/rules/{index,groups}.ts rules, domain every rule and group — the set the root reads
io src/{adapters/*,host}/*.io.ts + I/O modules the outside world
root src/cli{,-main}.ts, src/entries/*.ts anything everything — the only places that wire
tests src/**/*.test.ts anything —

Held by boundaries/dependencies (layers() in packages/eslint-config/index.mjs, with the rules/ruleset file categories for the rule layer), local/no-harness-names (no file spells a harness other than its own adapter's), local/no-rule-ids (no file spells a rule id but the rule's own module, its test and the set), local/no-group-names (no generic file names a rule group) and local/no-kit-names (rule-proof's generic files spell no linter kit).

src/host/ is the adapter for the MACHINE — files and processes no harness owns (rule-proof runs another repository's linter). It is not a harness: HARNESS_NAMES and the adapter contract read src/adapters only. A package entry that needs an adapter (vigiles/rule-proof) is served from src/entries/<name>.ts, a composition root — an app barrel may not import an adapter, and the old barrels that do (claude-code.ts, eval.ts) are grandfathered, not a model.

Harnesses are the worked example of doing it right: core declares the five ports (HarnessDialect, PluginLayout, HarnessRuntime, HookProtocol, ModelMock), each src/adapters/<harness>/ implements them, and only the root (and the testing barrels that default to one) chooses which adapter runs. Adding a harness = one new directory + one registration at the root; core does not change. Copy this shape for anything else that comes in many kinds — lint rules, report renderers, linter catalogs.

The mistakes this skill exists for

All four happened in one PR (#387) and were caught by the owner, not by a check:

  1. An inner file lists the outer things. EXPERIMENTAL_RULES = ["skill-resource-resolves"] in src/core/. A list of implementations is knowledge about the outside. It belongs to the outer layer (or is DERIVED from the implementations' own declarations).
  2. The "registry" lives in core and imports implementations. Moving a list into one file inside core does not fix (1); it only concentrates it. The set of implementations is assembled OUTSIDE core and passed IN — as a parameter or through a port.
  3. A type, field or function is named after one implementation or category. ExperimentalFinding, AuditReport.experimental, ScanReport.experimental["<rule id>"]. Being in a group is a fact about a rule TODAY, not what a finding IS. Generic code gets a generic type (Finding, ungraded), and the category is a FIELD read at run time.
  4. A per-implementation default restated in generic code. "<rule id>": severitySchema.default(false) in the config schema. The rule declares its own default; the schema is BUILT from the declarations (buildConfigSchema(rules)), not written next to them.

Again in PR #415 (2026-11-02), with this skill LOADED before the code was written: rule-proof supported two linters and its steps file branched on reading.linter === "eslint" 30 times, one 600-line domain file held both linters plus the Node install, and the io adapter wired the public object. Lint caught only the I/O placement; the owner's "show me the architecture" caught the rest. The fix was the harness shape again — a ProofKit port, one kit module per linter, kits/index.ts as the only list, src/entries/rule-proof.ts as the root — plus the `n

Полный SKILL.md на GitHub

Установить hexagonal-architecture в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл hexagonal-architecture?

Decide WHERE new code goes and WHO may know about whom, before writing it — vigiles is hexagonal (domain, app, adapters, root), and the recurring failure is generic code that names a specific implementation (a rule id, a harness, a group) or an inner layer that imports an outer one. Use before adding a module, a registry or list of things, a type or field named after one thing, a config key derived from a set, or a function that needs "all the rules / all the harnesses"; and whenever a reviewer says "wrong dependency direction", "core knows about X", or "hexagonal". NOT a general architecture essay — it is this repo's map plus the questions that catch the mistake.

Как установить скилл hexagonal-architecture?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл hexagonal-architecture запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить hexagonal-architecture с