paulpas/agent-skill-router/architectural-review

Claude Code and agent skill by paulpas/agent-skill-router

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Evaluates existing software architectures for coupling, cohesion, testability,

Install

npx vskill@latest install paulpas/agent-skill-router/architectural-review

SKILL.md

The same SKILL.md was published earlier as paulpas/agent-skill-router/architectural-review.

Architectural Review Guide

Acts as a senior software architect conducting thorough reviews of existing codebases to assess architectural quality across coupling, cohesion, testability, scalability, and maintainability dimensions. Produces structured reports with metric-based findings, prioritized remediation plans, and actionable recommendations for structural improvement.

TL;DR for Code Generation

  • [ ] Always ground findings in measured metrics (coupling numbers, complexity scores), not subjective impressions
  • [ ] Separate concerns into three layers: observed evidence, derived assessment, recommended action
  • [ ] Prioritize remediation by business impact and fix cost — always report both dimensions
  • [ ] Use static analysis tools before manual inspection; automate what can be automated
  • [ ] Validate every finding against at least two independent signals (metrics + code trace + stakeholder input)
  • [ ] Include a clear severity classification with rationale, never assign "high" without concrete evidence

When to Use

Use this skill when:

  • Conducting a pre-launch architecture audit for a system approaching production scale
  • Performing post-incident root cause analysis that reveals architectural issues (e.g., cascading failures from tight coupling)
  • Running quarterly technical debt assessment across a growing codebase
  • Onboarding a new architect to an unfamiliar legacy or greenfield system
  • Preparing for a scaling initiative where current architecture may become a bottleneck
  • A team reports chronic difficulties: long build times, flaky tests, frequent merge conflicts in shared modules

When NOT to Use

Avoid this skill for:

  • Codebases that are too small (under 500 lines) — the overhead outweighs any benefit
  • An ongoing feature development sprint where a review would block delivery; schedule it as a separate activity
  • Situations before clear scope is defined about which quality attributes matter most to stakeholders
  • When reviewers lack access to the codebase, build system, or opportunity for stakeholder interviews
  • As a substitute for active refactoring — review identifies problems, but remediation requires dedicated engineering effort

Core Workflow

  1. Define Scope and Identify Stakeholders — Determine which subsystems, services, or modules are in scope. Identify at least three stakeholders: a product owner (business priorities), a senior developer (implementation context), and an operations engineer (runtime behavior). Collect current system documentation, deployment diagrams, and incident history.

Checkpoint: Confirm the review scope document is signed off by stakeholders before proceeding. No metric matters if it's measuring the wrong system boundary.

  1. Run Static Analysis Baseline — Execute automated analysis across the codebase: cyclomatic complexity per module, dependency graph construction (import/require/depends relationships), afferent and efferent coupling counts per package, LCOM4 for class-level cohesion, and duplication detection (copy-paste >= 5 lines). Record raw metrics in a structured format.

Checkpoint: Verify the analysis tools executed successfully on all target modules. Missing data points create blind spots that produce false-negative findings.

  1. Perform Structural Pattern Matching — Scan the dependency graph and module structure for architectural anti-patterns: god classes (exceeding 50 public methods or LCOM > 8), circular dependencies between packages, layer violations (presentation calling persistence directly), data clumps (groups of fields always appearing together across modules), and feature envy (methods using another class's data more than their own).

Checkpoint: Every identified anti-pattern must include the file path, line range, affected modules, and a minimal code excerpt demonstrating the violation.

  1. Assess Quality Attributes Qualitatively — Trace data flow from user input to persistence for three representative use cases. Interview stakeholders about pain points: where do bugs originate? Which changes take longest? Where does scaling break? Correlate qualitative findings with static metrics — a module flagged as "slow to change" by developers should show high coupling or low cohesion metrics.

Checkpoint: Each quality attribute must have at least one quantitative metric and one qualitative data point. Single-signal assessments are unreliable.

  1. Classify Findings by Severity — Assign severity using the following matrix:
  • Critical: Active architectural fault causing production incidents, data corruption risk, or preventing essential scaling (e.g., circular dependency between core services, synchronous calls across network boundaries creating cascade failure paths)
  • High: Significant technical debt that impedes development velocity or creates future incident risk (e.g., god classes exceeding 500 lines, missing testability interfaces, duplicate business logic across modules)
  • Medium: Design smell that degrades long-term maintainability but does not block current work (e.g., high cyclomatic complexity > 15 in a single function, excessive parameters > 5 suggesting parameter objects needed)
  • Low: Opportunity for improvement with minimal risk and effort (e.g., missing architectural documentation for a module, inconsistent naming conventions across a package)
  1. Produce Structured Review Report — Assemble findings into a report containing: executive summary (1 page), metric dashboard table, detailed findings ranked by severity with evidence and code references, remediation roadmap with effort estimates (story-point ranges), and a prioritized action plan distinguishing quick wins from structural transformations. Include confidence levels for each finding based on data completeness.

Checkpoint: The report must be reviewable by both technical leads (who need implementation detail) and product managers (who need business impact context). If a stakeholder in either role cannot extract an actionable next step, revise before distribution.


Assessment Framework

Coupling and Cohesion Analysis Tool

This framework computes module-level coupling metrics and cohesion scores using Python AST analysis. It calculates afferent coupling (Ca), efferent coupling (Ce), instability (I), and abstractness (A) for the A/I matrix, plus LCOM4 for class-level cohesion.

python
import ast
import os
from collections import defaultdict
from dataclasses import dataclass, field
from pathlib import Path
from typing import Optional
@dataclass
class ModuleMetrics:
"""Coupling and cohesion metrics for a single module."""
name: str
path: str
afferent_coupling: int = 0 # How many modules import this one
efferent_coupling: int = 0 # How many modules this one imports
abstractness: float = 0.0 # Ratio of abstract classes to total classes
instability: float = 0.0 # Ce / (Ca + Ce)
lcom4: float = 0.0 # Lack of Cohesion of Methods (normalized)
cyclomatic_complexity: int = 0 # Sum of branch points
class CouplingAnalyzer(ast.NodeVisitor):
"""Analyze a module's imports and class structure."""
def __init__(self, source_code: str, module_name: str):
self.source_code = source_code
self.module_name = module_name
self.imports: list[str] = []
self.classes: list[dict] = []
self.complexity: int = 1
def visit_Import(self, node: ast.Import) -> None:
for alias in node.names:
self.imports.append(alias.name.split('.')[0])
self.generic_visit(node)
def visit_ImportFrom(self, node: ast.ImportFrom) -> None:
if node.module:
self.imports.append(node.module.split('.')[0])
self.generic_visit(node)
def visit_FunctionDef(self, node: ast.FunctionDef) -> None:
# Count branch points for cyclomatic complexity
self.complexity += sum(
1 for child in ast.walk(node)
if isinstance(child, (ast.If, ast.While, ast.For))
)
self.generic_visit(node)
def visit_ClassDef(self, node: ast.ClassDef) -> None:
methods = [m for m in node.body if isinstance(m, (ast.FunctionDef, ast.AsyncFunctionDef))]
# LCOM4 approximation: pairs of methods that share no instance variables
instance_vars = {
attr.target.id for stmt in ast.walk(node)
if isinstance(stmt, ast.Assign)
for target in stmt.targets if isinstance(target, ast.Name)
} | {
kw.value.id for stmt in node.body
if isinstance(stmt, ast.Expr) and isinstance(stmt.value, ast.Call)
for kw in stmt.value.keywords if kw.arg == 'self'
}
method_vars = []
for method in methods:
method_local_vars: set[str] = set()
for child in ast.walk(method):
if isinstance(child, ast.Name) and isinstance(child.ctx, ast.Store):
method_local_vars.add(child.id)
# Remove 'self' parameter
method_local_vars.discard('self')
method_vars.append(method_local_vars)
# LCOM4: 1 - (methods sharing vars / max possible pairs)
if len(method_vars) > 1:
shared_pairs = sum(
1 for i in range(len(method_vars))
for j in range(i + 1, len(method_vars))
if method_vars[i] & method_vars[j]
)
max_pairs = len(method_vars) * (len(method_vars) - 1) // 2
self.lcom4 = round(1.0 - (shared_pairs / max_pairs), 3) if max_pairs > 0 else 0.0
self.classes.append({
'name': node.name,
'methods': len(methods),
'loc': len(ast.dump(node)),
})
def analyze_module(module_path: str) -> ModuleMetrics:
"""Analyze a single Python module for coupling and cohesion metrics."""
with open(module_path, 'r') as f:
source = f.read()
try:
tree = ast.parse(source)
except SyntaxError as e:
return ModuleMetrics(name=os.path.basename(module_path), path=module_path)
analyzer = CouplingAnalyzer(source, os.path.basename(module_path))
analyzer.visit(tree)
ca = 0 # Computed externally by scanning all files
ce = len(analyzer.imports)
abstractness = _compute_abstractness(tree) if analyzer.classes else 0.0
instability = ce / (ca + ce) if (ca + ce) > 0 else 0.0
return ModuleMetrics(
name=os.path.basename(module_path),
path=module_path,
afferent_coupling=ca,
efferent_coupling=ce,
abstractness=abstractness,
instability=round(instability, 3),
lcom4=analyzer.lcom4,
cyclomatic_complexity=analyzer.complexity,
)
def _compute_abstractness(tree: ast.Module) -> float:
"""Compute ratio of abstract (incomplete) classes to total classes."""
class_count = 0
abstract_count = 0
for node in ast.walk(tree):
if isinstance(node, ast.ClassDef):
class_count += 1
body_methods = [m for m in node.body if isinstance(m, (ast.FunctionDef, ast.AsyncFunctionDef))]
# An abstract class has methods with pass-only bodies (no implementation)
unimplemented = sum(
1 for m in body_methods
if len(m.body) == 1 and isinstance(m.body[0], ast.Pass)
)
if unimplemented > 0:
abstract_count += 1
return round(abstract_count / class_count, 3) if class_count > 0 else 0.0
def assess_architecture(root_dir: str, package_names: list[str]) -> dict[str, ModuleMetrics]:
"""Scan a codebase and compute metrics for all specified packages."""
results = {}
root_path = Path(root_dir)
for pkg in package_names:
pkg_dir = root_path / pkg
if not pkg_dir.is_dir():
continue

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 93 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
4
7-day trend score
8

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/paulpas/agent-skill-router/architectural-review/badge)](https://verified-skill.com/skills/paulpas/agent-skill-router/architectural-review)

Something wrong with this skill or its page? Tell us.