Skip to content

Commit 5e02c67

Browse files
committed
feat: add assert_architecture command to verify code conformity with architecture standards
1 parent 52cc952 commit 5e02c67

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
name: assert_architecture
3+
description: Verify code conforms to architecture diagrams, ADRs, and project structure.
4+
argument-hint: [Optional scope to verify (module, service, or layer name)]
5+
model: sonnet
6+
---
7+
8+
# Assert Architecture Prompt
9+
10+
## Goal
11+
12+
Verify that the codebase (or a specific scope) conforms to the documented architecture: C4 diagrams, ADRs, and project tree structure.
13+
14+
## Context
15+
16+
### Architecture diagrams (micro)
17+
18+
```shell
19+
! ls -1tr {{DOCS}}/memory/internal/
20+
```
21+
22+
### Architecture decisions
23+
24+
```shell
25+
! ls -1tr {{DOCS}}/internal/decisions/
26+
```
27+
28+
### Scope
29+
30+
```text
31+
$ARGUMENTS
32+
```
33+
34+
## Rules
35+
36+
- Read ALL architecture sources before checking code
37+
- Report violations with file path, line, and which constraint is violated
38+
- Distinguish macro violations (service boundaries, tree structure) from micro violations (layer imports, patterns)
39+
- Do not fix violations — only report them
40+
- If no scope is provided, check the entire project
41+
- Use `!` backtick pattern to inspect project structure and imports
42+
43+
## Steps
44+
45+
1. Load architecture context:
46+
- Remember architecture diagrams from `{{DOCS}}/memory/architecture.md`
47+
- Read micro diagrams from `{{DOCS}}/memory/internal/` (if scope targets a specific module)
48+
- Read ADRs from `{{DOCS}}/internal/decisions/`
49+
- Extract the expected project tree structure from diagrams
50+
51+
2. Verify macro architecture (service boundaries):
52+
- Read the expected tree structure from `{{DOCS}}/memory/architecture.md`
53+
- Compare actual code structure against the documented tree
54+
- Check for files outside expected boundaries
55+
- Check for direct imports between independent services
56+
57+
3. Verify micro architecture (internal layers):
58+
- For each module in scope, check import directions match layer constraints
59+
- Verify domain layer has zero external imports
60+
- Verify application layer only depends on domain (via ports)
61+
- Check for circular dependencies between modules
62+
- Verify patterns: use cases have ports, adapters implement interfaces
63+
64+
4. Generate violation report:
65+
- List each violation with: severity (critical/warning), file path, constraint violated, suggested fix
66+
- Group by macro vs micro
67+
- If zero violations, confirm conformity
68+
69+
5. Summarize: total violations, critical count, and recommended next actions.

templates/docs/CATALOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ No files found.
136136

137137
| File | Description | Argument Hint |
138138
|------|---|---|
139+
| [assert_architecture.md](../../commands/04_code/assert_architecture.md) | `Verify code conforms to architecture diagrams, ADRs, and project structure.` | `[Optional scope to verify (module, service, or layer name)]` |
139140
| [assert_frontend.md](../../commands/04_code/assert_frontend.md) | `Assert a frontend feature works as intended.` | `The frontend behavior you need to assert and validate.` |
140141
| [assert.md](../../commands/04_code/assert.md) | `Assert that a feature must work as intended.` | - |
141142
| [implement_from_design.md](../../commands/04_code/implement_from_design.md) | `Implement a frontend component from a Figma design with pixel-perfect accuracy.` | `The Figma file URL and frame/component to implement.` |

0 commit comments

Comments
 (0)