expert-arch-enforcer
Skill41 starsChanged 8 months agoMITView on GitHub
Architecture constraint enforcement skill that monitors code for violations of preset invariants and architectural boundaries. Automatically triggered when users need architecture checks, dependency checks, or module boundary checks.
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- wonderslife/pdd-skills-v3edited, first seen Oct 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- wonderslife/pdd-skills-v3★ 1532% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository24 other files it gives its agents.
- expert-activitiSkill
- expert-auto-refactorSkill
- expert-code-qualitySkill
- expert-entropy-auditorSkill
- expert-mysqlSkill
- expert-ruoyiSkill
- official-doc-writerSkill
- pdd-baSkill
- pdd-code-reviewerSkill
- pdd-doc-changeSkill
- pdd-doc-gardenerSkill
- pdd-entropy-reductionSkill
- pdd-extract-featuresSkill
- pdd-generate-specSkill
- pdd-implement-featureSkill
- pdd-mainSkill
- pdd-pr-batchSkill
- pdd-pr-createSkill
- pdd-pr-mergeSkill
- pdd-pr-reviewSkill
- pdd-verify-featureSkill
- software-architectSkill
- software-engineerSkill
- system-architectSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 48
All external data must be validated
- Distinctive: line 66
Check for dependency direction violations
- Distinctive: line 79
Check for Schema validation
- Distinctive: line 107
Check file names, function names, variable names
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Architecture Constraint Enforcement (expert-arch-enforcer)
Core Philosophy
"In an agent-first world, architectural coherence easily drifts over time. Constraints are the guarantee of speed, not constraints." —— Harness Engineering
The architecture constraint enforcement skill is responsible for monitoring whether code violates preset invariants and architectural boundaries, ensuring code structure maintains consistency.
Architecture Constraint Model
Six-Layer Dependency Model
Types → Config → Repo → Service → Runtime → UI
Rule: Only forward dependencies allowed, no backward dependencies| Layer | Responsibility | Allowed Dependencies |
| Types | Type definitions, data models | None |
| Config | Configuration management, constant definitions | Types |
| Repo | Data access, external service calls | Types, Config |
| Service | Business logic, domain services | Types, Config, Repo |
| Runtime | Runtime, application entry | Types, Config, Repo, Service |
| UI | User interface, presentation layer | All layers |
Boundary Constraints
Data Boundaries:
- All external data must be validated
- API entry parameters must have Schema validation
- Guessing data structures is not allowed
Module Boundaries:
- Modules communicate through interfaces
- Direct cross-layer access is prohibited
- Shared state must be explicitly declared
Detection Items
1. Module Dependency Direction Violation
Detection Method:
- Parse import/require statements
- Build dependency graph
- Check for dependency direction violations
Example:
File: src/types/User.ts
import: import { UserService } from '../service/UserService'
→ Detection result: Types layer depends on Service layer, violates dependency direction2. Boundary Data Validation Missing
Detection Method:
- Scan API entry functions
- Check for Schema validation
- Mark entries lacking validation
Example:
API entry: POST /api/users
Parameter validation: None
→ Detection result: Missing parameter validation Schema3. File Size Exceeded
Detection Method:
- Count file lines
- Compare against configured maximum lines
- Mark exceeded files
Example:
File: src/service/UserService.ts
Lines: 450 lines
Limit: 300 lines
→ Detection result: File too large, suggest splitting4. Naming Convention Violation
Detection Method:
- Check file names, function names, variable names
- Compare against naming conventions
- Mark violating names
Example:
Function name: get_data
Convention: camelCase
→ Detection result: Non-compliant naming, should be getDataExecution Flow
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Parse │ ──→ │ Build │ ──→ │ Detect │ ──→ │ Report │
│ │ │ │ │ │ │ │
│ • Code files│ │ • Dependency│ │ • Dependency│ │ • Issue list│
│ • import │ │ graph │ │ violation │ │ • Fix │
│ • Function │ │ • Call │ │ • Boundary │ │ suggestions│
│ signatures│ │ relations │ │ violation │ │ • PR creation│
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘Tool Integration
Custom Linter
// custom-linter.js
module.exports = {
rules: {
'layer-dependency': {
meta: {
docs: { description: 'Enforce six-layer dependency direction' }
},
create(context) {
const layers = ['types', 'config', 'repo', 'service', 'runtime', 'ui'];
return {
ImportDeclaration(node) {
const source = node.source.value;
const currentLayer = getCurrentLayer(context.getFilename());
const targetLayer = getLayerFromPath(source);
if (layers.indexOf(targetLayer) < layers.indexOf(currentLayer)) {
context.report({
node,
message: `Dependency direction violation: ${currentLayer} cannot depend on ${targetLayer}`
});
}
}
};
}
}
}
};ArchUnit Test
// ArchitectureTest.java
@AnalyzeClasses(packages = "com.example")
public class ArchitectureTest {
@ArchTest
static final ArchRule layer_dependency_rule = layeredArchitecture()
.layer("Types").definedBy("..types..")
.layer("Config").definedBy("..config..")
.layer("Repo").definedBy("..repo..")
.layer("Service").definedBy("..service..")
.layer("Runtime").definedBy("..runtime..")
.layer("UI").definedBy("..ui..")
.whereLayer("Types").mayNotBeAccessedByAnyLayer()
.whereLayer("Config").mayOnlyBeAccessedByLayers("Repo", "Service", "Runtime", "UI")
.whereLayer("Repo").mayOnlyBeAccessedByLayers("Service", "Runtime", "UI");
}Output Format
Architecture Constraint Report
# Architecture Constraint Report - YYYY-MM-DD
## Architecture Health Score: XX/100
## Dependency Graph
[Dependency relationship visualization]
## Issues Found
### Critical (Must Fix)
| File | Issue | Violation Type |
|------|------|---------|
| src/types/User.ts | Depends on Service layer | Dependency direction violation |
### Warning (Suggested Fix)
| File | Issue | Violation Type |
|------|------|---------|
| src/api/users.ts | Missing parameter validation | Boundary validation missing |
### Info (Optional Fix)
| File | Issue | Violation Type |
|------|------|---------|
| src/service/UserService.ts | File 450 lines | Size exceeded |
## Fix Recommendations
### Critical Fixes
1. Remove dependency on UserService in User.ts
2. Extract shared logic to Types layerConfiguration Options
# arch-enforcer-config.yaml
arch_enforcer:
# Layer definitions
layers:
- name: types
paths: ["src/types/", "src/models/"]
- name: config
paths: ["src/config/", "src/constants/"]
- name: repo
paths: ["src/repo/", "src/data/"]
- name: service
paths: ["src/service/", "src/domain/"]
- name: runtime
paths: ["src/runtime/", "src/app/"]
- name: ui
paths: ["src/ui/", "src/components/"]
# Constraint rules
constraints:
max_file_lines: 300
max_function_lines: 50
require_schema_validation: true
# Execution configuration
execution:
run_linter: true
run_arch_test: true
create_pr: trueUsage Examples
Example 1: Comprehensive Architecture Check
User: Check architecture constraints
AI:
1. Parse code files
2. Build dependency graph
3. Run Linter and ArchUnit
4. Generate reportExample 2: Dependency Direction Check
User: Check module dependency direction
AI:
1. Parse import statements
2. Build dependency graph
3. Check for violations of six-layer model
4. Generate violation reportCollaboration with Other Skills
- pdd-entropy-reduction: Called as a sub-skill by the coordinator
- expert-auto-refactor: Receives architecture violations, executes refactoring
- pdd-code-reviewer: Integrates architecture checks into code review
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

