Get the FREE Ultimate OpenClaw Setup Guide →

architecture-patterns

npx machina-cli add skill akaszubski/autonomous-dev/architecture-patterns --openclaw
Files (1)
SKILL.md
5.3 KB

Architecture Patterns Enforcement Skill

Ensures every architecture plan is thorough, actionable, and testable. Used by the planner agent.

Decision Framework

Every architectural decision MUST follow this structure:

1. Problem Statement

  • What problem are we solving?
  • What are the constraints (performance, compatibility, timeline)?
  • What does PROJECT.md say about scope?

2. Options Analysis

  • Minimum 2 alternatives considered
  • Each option has explicit pros and cons
  • Effort estimate for each (low/medium/high)

3. Recommendation

  • Which option and why
  • What tradeoffs are we accepting
  • What risks remain

Plan Structure Requirements

Every architecture plan MUST include:

File-by-File Breakdown

## Files to Create/Modify

### 1. lib/new_module.py (CREATE)
- Purpose: [what this file does]
- Key classes/functions: [list]
- Dependencies: [what it imports]
- Tests: tests/unit/test_new_module.py

### 2. lib/existing_module.py (MODIFY)
- Changes: [what changes and why]
- Lines affected: ~[range]
- Risk: [low/medium/high]

Ordered Steps with Dependencies

## Implementation Order

1. Create lib/new_module.py (no dependencies)
2. Create tests/unit/test_new_module.py (depends on step 1)
3. Modify lib/existing_module.py (depends on step 1)
4. Update integration tests (depends on steps 1-3)

Steps MUST be ordered so each step can be tested independently before proceeding.

Testing Strategy

  • Unit tests for each new module
  • Integration tests for cross-module interactions
  • What to mock and why
  • Expected test count estimate

Integration Points

  • What existing code is affected
  • API contracts between modules
  • Backward compatibility considerations

ADR Format for Major Decisions

For decisions that affect architecture (new patterns, technology choices, major refactors):

# ADR-NNN: [Title]

**Date**: YYYY-MM-DD
**Status**: Proposed | Accepted | Deprecated | Superseded

## Context
[Problem and constraints]

## Decision
[What we chose and why]

## Consequences
[Positive and negative outcomes]

## Alternatives Considered
[Other options and why rejected]

This Project's Patterns

When planning for this codebase, follow these established patterns:

Two-Tier Design

  • Core lib (plugins/autonomous-dev/lib/): Pure Python, no side effects, testable
  • CLI layer (plugins/autonomous-dev/commands/): Markdown prompts that invoke lib

Progressive Enhancement

  • Base functionality works without optional dependencies
  • GenAI reasoning enhances but never replaces deterministic checks
  • Skills loaded on-demand, not all at once

HARD GATE Enforcement

  • Critical rules use FORBIDDEN/REQUIRED language
  • Hooks validate at commit/push time (100% reliable)
  • Agents enforce at review time (conditional intelligence)

Hook-Based Validation

  • Pre-commit hooks for formatting, secrets, alignment
  • Pre-push hooks for tests, coverage
  • Pre-tool hooks for security and workflow enforcement

HARD GATE: Plan Quality

FORBIDDEN:

  • Plans without specific file paths (e.g., "create a new module" without saying where)
  • "TBD" or "to be determined" placeholders — decide now or state why you cannot
  • Plans with no testing strategy
  • Plans that skip scope validation against PROJECT.md
  • Monolithic steps that cannot be tested incrementally
  • Plans that ignore existing codebase patterns
  • Hand-wavy "refactor later" promises

REQUIRED:

  • File-by-file breakdown with CREATE/MODIFY labels
  • Dependency ordering (what must come before what)
  • Error handling strategy (what happens when things fail)
  • At least 2 alternatives considered for major decisions
  • Testing strategy with expected test locations
  • Rollback plan (how to undo if the plan fails)
  • Scope check against PROJECT.md goals

Anti-Patterns

BAD: Hand-wavy plan

"We should refactor the auth module to be more modular.
We can add better error handling later."

No file paths, no steps, no testing, no "later" promises.

GOOD: Actionable plan

## Files to Modify
1. lib/auth.py (MODIFY) — Extract token validation into TokenValidator class
2. lib/token_validator.py (CREATE) — Pure validation logic, no side effects
3. tests/unit/test_token_validator.py (CREATE) — 8 tests covering valid/invalid/expired

## Order
1. Create token_validator.py + tests (independent)
2. Modify auth.py to use TokenValidator (depends on step 1)
3. Run full test suite to verify no regressions

BAD: Monolithic steps

Step 1: Rewrite the entire authentication system
Step 2: Test everything

Cannot test incrementally, cannot roll back partially.

GOOD: Incremental steps

Each step produces a testable, committable unit of work.

BAD: Missing rollback plan

If the migration fails halfway through, what happens? Every plan needs a recovery path.


Cross-References

  • research-patterns: Research feeds into architecture planning
  • project-alignment: Plans must align with PROJECT.md
  • code-review: Plans are reviewed against these quality standards
  • documentation-guide: ADR format and documentation requirements

Source

git clone https://github.com/akaszubski/autonomous-dev/blob/master/plugins/autonomous-dev/skills/architecture-patterns/SKILL.mdView on GitHub

Overview

The Architecture Patterns Enforcement Skill ensures every architecture plan is thorough, actionable, and testable, as used by the planner agent. It enforces a clear Decision Framework (Problem Statement, Options Analysis, Recommendation) and strict plan structure to standardize decisions and reduce risk.

How This Skill Works

For every architecture plan, the skill requires a structured Decision Framework: Problem Statement, Options Analysis with at least two alternatives and explicit pros/cons plus effort estimates, and a Recommendation with tradeoffs and residual risks. It also enforces Plan Structure Requirements, including a file-by-file breakdown (CREATE/MODIFY), ordered dependencies, testing strategy, and ADR-style decisions. Hard gates dictate mandatory and forbidden elements to ensure plan quality and testability across the repo.

When to Use It

  • When starting a major new architecture plan that impacts modules, files, or interfaces
  • When you need to compare multiple architectural options with explicit pros/cons and effort estimates
  • Before committing or merging changes that affect project structure or dependencies
  • When documenting major decisions using ADR format and traceable rationale
  • To enforce repeatable, testable planning through two-tier design, hooks, and validation gates

Quick Start

  1. Step 1: Write the Problem Statement, at least two Options Analysis entries with pros/cons and effort estimates
  2. Step 2: Add a Recommendation and outline risks; draft a File-by-File Breakdown with CREATE/MODIFY and tests
  3. Step 3: Capture an ADR if the decision is major; validate against HARD GATE rules and prepare for integration tests

Best Practices

  • Always include Problem Statement, Options Analysis (2+ alternatives) with pros/cons and effort, and a Recommendation
  • Provide a file-by-file breakdown with CREATE/MODIFY labels and explicit dependencies
  • Define testing strategy and integration points; outline unit and integration tests
  • Order steps so each can be tested independently before proceeding
  • Document decisions using ADR format for major architectural choices

Example Use Cases

  • Plan to add a new analytics module with a CREATE lib/new_module.py and MODIFY lib/existing_module.py, including unit tests and integration tests aligned to the plan
  • Refactor of an existing service to introduce a new dependency, described with alternatives, risks, and testing plan
  • ADR documenting a technology choice (e.g., two-tier design) and its consequences for future maintenance
  • A HARD GATE enforcement plan that rejects plans lacking specific file paths or testing strategies
  • An end-to-end plan that maps Hook-Based Validation and pre-commit checks to the architecture workflow

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers