Agent Skillsludo-technologies/pyscn › architecture-review

architecture-review

GitHub

使用pyscn分析Python模块架构,检测类耦合、内聚性、依赖循环及模块社区。用于评估代码结构质量,识别需共同审查的文件簇,辅助重构与架构优化决策。

.claude-plugin/pyscn-mcp/skills/architecture-review/SKILL.md ludo-technologies/pyscn

Trigger Scenarios

询问模块架构或结构 检查类耦合度CBO 查找循环依赖 检查类内聚性LCOM 确定应一起审查的文件

Install

npx skills add ludo-technologies/pyscn --skill architecture-review -g -y
More Options

Non-standard path

npx skills add https://github.com/ludo-technologies/pyscn/tree/main/.claude-plugin/pyscn-mcp/skills/architecture-review -g -y

Use without installing

npx skills use ludo-technologies/pyscn@architecture-review

指定 Agent (Claude Code)

npx skills add ludo-technologies/pyscn --skill architecture-review -a claude-code -g -y

安装 repo 全部 skill

npx skills add ludo-technologies/pyscn --all -g -y

预览 repo 内 skill

npx skills add ludo-technologies/pyscn --list

SKILL.md

Frontmatter
{
    "name": "architecture-review",
    "description": "Analyze Python module architecture using pyscn - class coupling (CBO), cohesion (LCOM), dependency cycles, and module communities. Use when user asks about architecture, module structure, coupling, circular dependencies, or which files to review or change together."
}

Python Architecture Review with pyscn

Run the pyscn CLI to understand module structure and coupling. No install needed: uvx pyscn@latest <command>.

Commands

User Request Command
"Check class coupling" uvx pyscn@latest analyze --select cbo <path>
"Find circular dependencies" uvx pyscn@latest analyze --select deps <path>
"Check class cohesion" uvx pyscn@latest analyze --select lcom <path>
"Which files should I review together?" uvx pyscn@latest analyze --select communities --json <path>
"Map the module architecture" uvx pyscn@latest analyze --select communities --json <path>

Useful flags: --min-cbo <n> (minimum CBO to report), --json (detailed report file). Report files are NOT written to stdout; they go to .pyscn/reports/ and the path is printed on completion.

Module Communities (context map for agents)

Module community detection is opt-in: run with --select communities --json and read the report file.

The JSON report includes community_analysis.community_context_map, a compact, deterministic map telling you which modules to inspect together:

  • bundles[]: clusters of modules that change together. Each has modules, packages, risk_level, the cluster's bridge_modules, an optional suggested_review_scope (path prefix to focus a review on), and a one-line summary. Large bundles cap the module list with a ... +N more marker (module_count always holds the true total).
  • bridge_modules[]: modules that couple two or more communities (module, the communities it connects, and a reason). Widen the review scope to include these when touching a bundle they connect.

Use the map to scope reviews and refactors: load all modules in a bundle together, and pull in connected bridge modules before changing cluster boundaries.

Interpreting Coupling Results

  • High CBO classes depend on many others; changes ripple widely. Suggest interface extraction or dependency inversion.
  • High LCOM4 classes bundle unrelated responsibilities; suggest splitting along the disconnected method groups.
  • Dependency cycles are the highest-priority architectural issue; name the modules in each cycle and the weakest edge to break.

Always tie findings back to concrete modules and suggest a specific structural change.

MCP Alternative

If the pyscn-mcp MCP server is connected, you can use its tools instead of the CLI: check_coupling for CBO metrics, or analyze_code with analyses: ["deps"], ["lcom"], or ["communities"] (communities require output_mode: "full"; the full response includes the same community_context_map). Results are returned inline with no report files.

Version History

  • 88b9237 Current 2026-08-20 15:36

Same Skill Collection

.claude-plugin/pyscn-mcp/skills/cli-analysis/SKILL.md
.claude-plugin/pyscn-mcp/skills/health-check/SKILL.md
.claude-plugin/pyscn-mcp/skills/refactoring/SKILL.md

Metadata

Files
0
Version
88b9237
Hash
5ce5f826
Indexed
2026-08-20 15:36

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 08:47
浙ICP备14020137号-1 $방문자$