From arch-guard
This skill should be used when the user asks "check architecture", "layer violations", "arch-check", "reference rule violations", "cross-layer reference check", "architecture scan", or wants to detect layer boundary violations by analyzing source references against arch-guard.json rules.
How this skill is triggered — by the user, by Claude, or both
Slash command
/arch-guard:arch-checkThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyzes source references (imports, project references) against `arch-guard.json` rules to detect layer boundary violations.
Analyzes source references (imports, project references) against arch-guard.json rules to detect layer boundary violations.
Read arch-guard.json from the project root before starting. This is the single source of truth for all rules.
Read arch-guard.json. If not found, suggest running /setup first and stop.
Extract from config:
layers[] — layer definitions with patterns, allowed/forbidden callsreferences.forbidden[] — explicit forbidden reference rulesreferences.cross_layer[] — allowed cross-layer referencesreferences.intra_layer[] — allowed intra-layer referencesforbidden_patterns[] — code patterns to detectFind all projects/modules under config.project.source_root.
For .NET:
find {source_root} -name "*.csproj" -type f
For each project:
config.layers[].pattern to identify its layerExtract <ProjectReference> entries from each .csproj:
grep -r '<ProjectReference' {source_root} --include='*.csproj'
For each reference, apply rules from arch-guard.json:
Match against config.references.forbidden[]. If a reference matches a forbidden rule, flag as CRITICAL.
Cross-layer references must appear in config.references.cross_layer[]. If not listed, flag as WARNING.
If config.contracts.enabled, cross-layer references should only target the other layer's Contracts project. Direct references to Application, Domain, or Infrastructure across layers are violations.
Scan source files for import statements:
For .NET:
grep -rn '^using {project_prefix}\.' {source_root} --include='*.cs'
Map each import's namespace to a project and apply the same rules as Step 3.
Example:
src/MyApp.Gateway.Routing/ contains using MyApp.Execution.Workflow; → CRITICAL if Gateway→Execution is forbiddensrc/MyApp.Execution.Workflow/ contains using MyApp.Registry.Contracts; → OK if listed in cross_layerCheck each pattern in config.forbidden_patterns[]:
For each pattern with a detect block:
grep -rn '{detect.using_pattern}' {source_root} --include='*.cs'
If the match appears in projects matching detect.in_projects but is not expected, flag as CRITICAL.
If config.scoring is defined, calculate a compliance score:
For each scoring area:
max(0, weight - (violations * penalty_per_violation))Map total to grade using config.scoring.grades.
## Arch-Check Report
### CRITICAL Violations (immediate fix required)
1. X {Source} → {Target} ({reason})
File: {path}:{line}
Rule: {config reference}
### WARNING (review needed)
1. WARNING {Source} → {Target}
File: {path}:{line}
Rule: Unlisted cross-layer reference
### INFO
1. Total projects: {N}
2. Total references: {N}
3. Cross-layer references: {N} (allowed {N}, violation {N})
### Forbidden Patterns
- {pattern_name}: {count} occurrences
### Score: {score}/100 — Grade: {grade}
### Summary
- CRITICAL: {N}
- WARNING: {N}
- Violation rate: {violations}/{total_refs} ({percent}%)
| Severity | Condition | Action |
|---|---|---|
| CRITICAL | Matches references.forbidden[], forbidden patterns | Fix immediately |
| WARNING | Unlisted cross-layer reference, suspicious pattern | Team review |
| INFO | Statistics, valid references | Informational |
At the end of the report, recommend the next arch-guard skill based on results. Always use slash command format:
| Result | Recommendation |
|---|---|
| CRITICAL violations exist | Fix violations then → /arch-check (re-verify) |
| WARNING only | /contract-first {project} — verify design compliance |
| 0 violations | /adr to document compliance status, or continue development |
npx claudepluginhub jaebit/claudemate --plugin arch-guardProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.