К основному содержанию
скилл CX Codex

arch-check — скилл для Claude Code: проверка архитектуры кода

Сверяет кодовую базу с заявленной архитектурой: направление зависимостей, нарушения слоёв, утечки между модулями и циклы. Пригодится перед релизом или после крупной фичи.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add codewithmukesh/dotnet-claude-kit --skill arch-check -a claude-code
Открыть на GitHub

Что делает arch-check

Скилл разбирает граф проектов и зависимости, а не читает файлы подряд. Сначала он выясняет заявленную архитектуру: из CLAUDE.md, ADR в docs/decisions/ или у вас. Молча догадываться не станет — неверная база даёт неверный отчёт.

Поддержаны четыре базы: Vertical Slice, Clean Architecture, DDD + Clean и Modular Monolith. Для каждой свой набор правил. Дальше идут проверки: get_project_graph() сверяет ссылки между проектами с разрешёнными стрелками, detect_circular_dependencies() ищет циклы, get_dependency_graph() и find_references() щупают утечки на уровне пространств имён, get_endpoint_map() смотрит, где объявлены эндпоинты. Отдельно вызывается detect_antipatterns() как подкрепление.

На выходе отчёт с серьёзностью, доказательством в виде file:line и конкретной починкой. Одна неверная ссылка вида Domain → Infrastructure уже идёт как CRITICAL: из-за неё становятся возможны все остальные нарушения. Для критичных находок скилл сразу предлагает исправить. Выбор архитектуры — не его задача, для этого есть architecture-advisor.

Какие задачи решает

  • поймать ссылку Domain → Infrastructure до релиза
  • найти циклы между проектами и показать всю цепочку
  • проверить, не тянет ли сущность Domain типы EF Core
  • убедиться, что эндпоинты объявлены только в слое хоста
  • проверить утечки внутренних типов модуля наружу

Примеры запросов агенту

  • /arch-check
  • проверь архитектуру проекта, база — Clean Architecture из CLAUDE.md
  • есть ли нарушения направления зависимостей и циклы в решении?

Как установить arch-check

1Через Skills CLI (Vercel)

npx skills add codewithmukesh/dotnet-claude-kit --skill arch-check -a claude-code

2Вручную: положить файлы

~/.claude/skills/arch-check/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/arch-check/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора46

serilog Скилл помогает настроить структурированное логирование Serilog в приложении .NET 10: уровни, приёмники, свойства событий и журналы HTTP-запросов. CX Codex +1 2 900установок vertical-slice Скилл помогает проектировать и писать .NET-приложения по принципам Vertical Slice Architecture вместо слоистой структуры. Пригодится при переносе логики в папки фич и настройке хэндлеров. CX Codex +1 2 900установок modern-csharp Подсказывает агенту синтаксис C# 14: первичные конструкторы, коллекционные выражения, ключевое слово field, блоки расширений. Пригодится, когда пишете новый код на C# или чистите старый. CX Codex +1 2 900установок outdated Собирает отчёт о здоровье зависимостей .NET: устаревшие NuGet-пакеты, уязвимые версии и ловушки с коммерческими лицензиями. CX Codex +1 2 800установок migrate Скилл ведёт разработчика через миграции схемы EF Core, смену версии .NET и обновление NuGet. На каждом шаге он готовит план отката и запускает тесты. CX Codex +1 2 800установок plan Составляет план реализации для .NET-задач с учётом архитектуры проекта. Нужен перед изменениями, которые затрагивают несколько слоёв или модулей. CX Codex +1 2 800установок scaffold Создаёт полный набор файлов для новой фичи в .NET 10: endpoint, handler, валидатор, DTO, конфигурацию EF и интеграционные тесты. CX Codex +1 2 800установок build-fix Запускает автономный цикл починки сборки и тестов в проектах на .NET. Скилл разбирает ошибки компилятора, исправляет код и останавливается при регрессиях. CX Codex +1 2 800установок

Похожие

clean-architecture pproenca Скилл с 42 правилами из книги Роберта Мартина: подсказывает агенту, куда направлять зависимости и где проводить границы слоёв. CX Codex +1 2 000установок architecture-review decebals Скилл для макроразбора Java-проекта: структура пакетов, границы модулей, направление зависимостей и слои. Пригодится, когда кодовая база разрослась и непонятно, где что лежит. CX Codex +1 338установок csharp-refactoring dotnet Скилл проводит рефакторинг C#/.NET так, чтобы поведение кода не менялось: сначала классифицирует запрос, потом правит по биндингам и проверяет сборкой с тестами. CX Codex +1 1 800установок feature-arch pproenca Разбирает React-проект по фичам и выдаёт blueprint целевой архитектуры с деревом каталогов, публичными API и планом миграции. CX Codex +1 412установок architecture-patterns secondsky Скилл для проектирования бэкенда: раскладывает код по слоям Clean Architecture, портам и адаптерам, подсказывает тактические приёмы DDD. CX Codex +1 493установок find-untested-sources dotnet Находит файлы исходного кода без тестов через статический анализ AST без сборки проекта. Пригодится агенту перед генерацией тестов, чтобы составить точный список пробелов. CX Codex +1 3 100установок

Рядом в теме «Бэкенд и API»

Всё по теме «Бэкенд и API» →

Вопросы о arch-check

Как установить arch-check в Claude?

Выполните npx skills add codewithmukesh/dotnet-claude-kit --skill arch-check -a claude-code. Скилл окажется в ~/.claude/skills/arch-check/SKILL.md.

Что делает arch-check?

Сверяет код с заявленной архитектурой и выдаёт отчёт о нарушениях: направление зависимостей, утечки между модулями, циклы, эндпоинты не в своём слое. Каждая находка идёт с доказательством file:line и предложенной починкой.

Чем arch-check отличается от architecture-advisor?

arch-check проверяет уже существующую кодовую базу на соответствие выбранной архитектуре. architecture-advisor нужен раньше — когда архитектуру только выбирают.

Исходный текст

SKILL.md · MIT
---
name: arch-check
description: >
  Architecture conformance check: verifies an existing codebase against its
  declared architecture (VSA, Clean Architecture, DDD, Modular Monolith) —
  dependency direction, layer violations, module boundary leaks, and cycles —
  using token-cheap Roslyn MCP analysis. Invoke when: "check architecture",
  "architecture violations", "layer violations", "dependency direction",
  "module boundaries", "arch check", "is my architecture clean", "enforce
  architecture", "conformance check". For CHOOSING an architecture, use
  architecture-advisor instead.
---

# /arch-check

## What

Verifies that the code still matches the architecture it claims to have.
Architectures rot through small, individually-reasonable changes — a Domain
project that gains an EF Core reference, a module that reaches into a sibling's
internals, an endpoint defined outside the host. This workflow catches the rot
using project-graph and dependency analysis, not file-by-file reading.

Output: a violation report with severity, file:line evidence, and the concrete
fix — or a clean conformance pass.

## When

- "check my architecture", "are there layer violations", "dependency direction"
- Before a release or after a large feature lands
- After onboarding to an unfamiliar codebase that claims an architecture
- Recurring on teams where multiple people merge to shared modules
- NOT for choosing an architecture — that is `architecture-advisor`

## How

**Step 1: Establish the declared architecture**

In order of authority: the project's CLAUDE.md, an ADR in `docs/decisions/`,
or ask the user. Never infer silently — a wrong baseline produces a wrong
report. The four supported baselines and their rules:

| Architecture | Rules checked |
|---|---|
| Vertical Slice | Features don't reference sibling features; shared code only via explicitly shared folders/projects |
| Clean Architecture | Domain → nothing; Application → Domain only; Infrastructure → Application; Api → Application (never Api → Infrastructure types, wiring only) |
| DDD + Clean | Clean rules + aggregates referenced only via roots; domain events for cross-aggregate effects |
| Modular Monolith | No project references between modules except `*.Contracts`; cross-module calls via integration events or contracts |

**Step 2: Project-level dependency direction (cheapest, catches most)**

```
get_project_graph()
```

Map every project reference against the baseline's allowed arrows. A single
wrong reference here (Domain → Infrastructure) is a CRITICAL finding — it
makes every downstream violation possible.

**Step 3: Cycles**

```
detect_circular_dependencies()
```

Cycles are violations in every baseline. Report the full chain.

**Step 4: Namespace-level leaks (spot checks)**

Project references can be clean while code still leaks. Probe the risky edges:

```
get_dependency_graph(symbolName: <a Domain entity>, depth: 2)
   -- Domain types pulling in EF Core, HttpClient, or Infrastructure namespaces?
find_references(symbolName: <a module-internal type>)
   -- referenced from outside its module?
detect_antipatterns()
   -- known structural smells as supporting evidence
```

Pick probes by baseline: Clean → sample 3-5 Domain entities and Application
handlers; Modular Monolith → sample each module's internal types; VSA → sample
types inside two or three feature folders.

**Step 5: Presentation boundary**

```
get_endpoint_map()
```

Endpoints must live only in the host/Api layer (Clean) or inside their owning
module (Modular Monolith, VSA feature folders). An endpoint defined in an
Application or shared project is a boundary violation. Unmarked auth on any
endpoint is reported as a side-finding (route to `/security-scan` for depth).

**Step 6: Report**

| Severity | Meaning |
|---|---|
| CRITICAL | Wrong-direction project reference, module-to-module reference, cycle |
| HIGH | Namespace leak (Domain using Infrastructure/EF types), endpoint outside its layer |
| MEDIUM | Shared-kernel logic creep, aggregate bypassed via direct member access |
| INFO | Unmarked endpoint auth, antipattern hits worth a look |

Each finding: evidence (file:line), why it violates the baseline, and the fix
(move the code, invert with an interface, introduce a contracts project, raise
an integration event). Offer to fix CRITICAL items immediately.

### MCP Tools Used

- `get_project_graph` — reference-direction audit (the backbone)
- `detect_circular_dependencies` — cycle detection
- `get_dependency_graph` / `find_references` — namespace-level leak probes
- `get_endpoint_map` — presentation boundary + auth posture
- `detect_antipatterns` — supporting structural evidence

## Example

```
User: /arch-check

Claude: Baseline from CLAUDE.md: Clean Architecture (4 projects).

  Project graph (get_project_graph)...
  CRITICAL  Domain → Infrastructure reference (Domain.csproj:14)
            Breaks the dependency rule; makes Domain untestable in isolation.
            Fix: invert — define IEmailSender in Application, implement in
            Infrastructure.
  Cycles (detect_circular_dependencies)... none.
  Leak probes on 4 Domain entities...
  HIGH      Order.cs:8 uses Microsoft.EntityFrameworkCore (Domain must stay
            persistence-ignorant). Fix: move the [Index] config to
            OrderConfiguration in Infrastructure.
  Endpoint map... 23 endpoints, all in Api. 2 unmarked auth (side-finding —
  run /security-scan).

  Verdict: NOT conformant — 1 critical, 1 high. Fix the reference first;
  want me to do it now?
```

## Related

- `architecture-advisor` — choosing a baseline (before this skill is useful)
- `clean-architecture`, `vertical-slice`, `ddd`, `modular-monolith` template — the rules being enforced
- `/security-scan` — depth on the auth side-findings
- `/health-check` — broader report card; arch-check is its architecture dimension in depth

© codewithmukesh · MIT · codewithmukesh/dotnet-claude-kit

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой