Expert Arch Enforcer logo

Expert Arch Enforcer

Community
wonderslife
expert-arch-enforcer

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. Core responsibility: Ensure architectural coherence and prevent architectural drift. Trigger scenarios: - User requests "check architecture constraints", "check dependency direction", "check module boundaries" - Called by pdd-entropy-reduction coordinator - Automatically triggered after code commits 支持中文触发:架构约束检查、依赖检查、模块边界检查、架构强制、架构漂移、PDD架构约束。

Overview

Publisherwonderslife
Repositorypdd-skills
Skill nameexpert-arch-enforcer
Stars
41
Forks
11
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by wonderslife on GitHub. Read the source before you install it.

Installation

Install the Expert Arch Enforcer AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/wonderslife/pdd-skills/tree/main/expert-arch-enforcer
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wonderslife/pdd-skills.git /tmp/pdd-skills
mkdir -p .claude/skills
cp -r /tmp/pdd-skills/expert-arch-enforcer .claude/skills/expert-arch-enforcer
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Expert Arch Enforcer in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Expert Arch Enforcer on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Expert Arch Enforcer is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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
LayerResponsibilityAllowed Dependencies
TypesType definitions, data modelsNone
ConfigConfiguration management, constant definitionsTypes
RepoData access, external service callsTypes, Config
ServiceBusiness logic, domain servicesTypes, Config, Repo
RuntimeRuntime, application entryTypes, Config, Repo, Service
UIUser interface, presentation layerAll 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 direction

2. 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 Schema

3. 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 splitting

4. 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 getData

Execution 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

javascript
// 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

java
// 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

markdown
# 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 layer

Configuration Options

yaml
# 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: true

Usage 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 report

Example 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 report

Collaboration 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

Frequently asked questions

What does the Expert Arch Enforcer AI skill do?

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. Core responsibility: Ensure architectural coherence and prevent architectural drift. Trigger scenarios: - User requests "check architecture constraints", "check dependency direction", "check module boundaries" - Called by pdd-entropy-reduction coordinator - Automatically triggered after code commits 支持中文触发:架构约束检查、依赖检查、模块边界检查、架构强制、架构漂移、PDD架构约束。

Why use Expert Arch Enforcer on TypingMind?

Because you install it once and use it with any model. Expert Arch Enforcer is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Expert Arch Enforcer in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wonderslife/pdd-skills/tree/main/expert-arch-enforcer. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Expert Arch Enforcer?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Expert Arch Enforcer?

As many as you like. As long as a model supports skills, you can use Expert Arch Enforcer with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Expert Arch Enforcer AI skill free?

Yes. It is published on GitHub by wonderslife under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇