test_heng

python-arch-optimizer

Developmentv1.0.2
By test_hengUpdated 2026-05-113 versions · latest released 2026-03-15@clawhub_jjflydudu/python-arch-optimizer
Code ReviewScripting#测试

According to AlphaMoat, as of 2026-09, python-arch-optimizer has 1,455 downloads and 1 stars — ranked #4,792 of 5,078 AI skills overall, and #563 of 577 in Development.

Installs
266
Downloads
1.5K
Stars
1
Overall Rank
#4,792
Top 95% overall · Top 98% in Development
PlatformInstallsDownloadsStarsComments
ClawHub ↗23957--
SkillHub ↗2661.5K1—

Platforms count differently. AlphaMoat’s totals use the higher figure across platforms, not the sum.

What this skill does

Analyzes directories, dependencies, imports and test organization to suggest structural and tooling changes. The documentation requires preview and user confirmation before migration and describes backup and rollback support.

Profile published 2026-10-26

What you can do with it

  • Plan directory and dependency changes in a Python project

When to use it

  • When an existing project needs structural cleanup

Example prompts

Generated from the skill’s documentation as examples; not results of actual runs.

Review this Python project and propose a refactoring plan

Requirements

Compiled from what the skill’s documentation declares; not verified by installing or running it.

Required command-line tools
python

Monthly Trend

Installs266
191232272Current methodLegacy method2026-03 · Installs 197 (Legacy method)2026-05 · Installs 266 (Legacy method)2026-06 · Installs 266 (Legacy method)2026-07 · Installs 266 (Legacy method)2026-08 · Installs 266 (Legacy method)2026-09 · Installs 26626-0326-09
Downloads1.5K
3129261.5KCurrent methodLegacy method2026-03 · Downloads 397 (Legacy method)2026-05 · Downloads 743 (Legacy method)2026-06 · Downloads 866 (Legacy method)2026-07 · Downloads 1.1K (Legacy method)2026-08 · Downloads 1.2K (Legacy method)2026-09 · Downloads 1.5K26-0326-09
Stars1
-11Current methodLegacy method2026-03 · Stars - (Legacy method)2026-05 · Stars 1 (Legacy method)2026-06 · Stars 1 (Legacy method)2026-07 · Stars 1 (Legacy method)2026-08 · Stars 1 (Legacy method)2026-09 · Stars 126-0326-09

From 2026-09 the figures use the current method (full catalog). Earlier months use the legacy method (only skills with installs, same-name skills merged). The two are not directly comparable, so the chart does not connect them or compute growth across them.

MonthDownloadsMoMStarsInstalls
2026-091.5K—1266
2026-08Legacy method1.2K+10.9%1266
2026-07Legacy method1.1K+22.7%1266
2026-06Legacy method866+16.6%1266
2026-05Legacy method743—1266
2026-03Legacy method397—-197

SKILL.md (original)

The author’s original file, shown as plain text without edits or review by AlphaMoat. Links are not clickable; check commands before running them. Fetched 2026-10-23.

Show original (2.7 KB · ClawHub v1.0.2)
---
name: python-arch-optimizer
description: Python 项目架构优化技能。用于分析和重构 Python 项目结构,使其符合最佳实践。使用场景:(1) 评估现有项目架构,(2) 重构目录结构,(3) 优化依赖管理,(4) 改进代码组织,(5) 建立测试架构,(6) 配置 CI/CD
---

# Python 架构优化器

本技能帮助优化 Python 项目的整体架构,使其更符合现代 Python 工程最佳实践。

## 核心能力

### 1. 目录结构优化
- 按功能/模块划分项目
- 分离配置、业务逻辑、测试
- 符合 PEP 8 和 Python 社区惯例

### 2. 依赖管理
- `requirements.txt` / `pyproject.toml` / `poetry` 配置
- 依赖分类(生产/开发/可选)
- 版本锁定策略

### 3. 代码组织
- 包/模块设计
- 导入结构优化
- 关注点分离

### 4. 测试架构
- pytest 配置
- 测试目录结构
- 覆盖率配置

### 5. 工程化配置
- pre-commit 钩子
- linting 配置(ruff/black/mypy)
- CI/CD 模板

## 工作流程

### 步骤 1: 分析现有架构
```bash
# 使用分析脚本
python scripts/analyze_project.py <project-path>
```

读取项目结构,识别问题:
- 循环依赖
- 过深的嵌套
- 缺失的 `__init__.py`
- 测试覆盖率低
- 配置硬编码

### 步骤 2: 生成优化建议
参考 `references/best-practices.md` 生成具体建议。

### 步骤 3: 执行重构(需用户确认)

**⚠️ 安全警告:** 重构操作会移动/创建文件,可能影响现有项目。

**必须获得用户明确确认后**才能执行迁移脚本:
```bash
# 用户确认后执行(支持:yes / y / 确认 / 是)
python scripts/migrate_project.py <project-path>
```

**回滚策略:**
- 迁移前自动备份到 `<project-path>.backup.<timestamp>/`
- 提供 `--dry-run` 预览变更
- 失败时自动恢复备份

### 步骤 4: 验证
运行测试和 lint 检查确保重构后功能正常。

## 参考文档

- **最佳实践**: `references/best-practices.md` - Python 项目架构详细指南

## 脚本工具

- `scripts/analyze_project.py` - 项目结构分析
- `scripts/generate_structure.py` - 生成推荐结构
- `scripts/migrate_project.py` - 执行迁移(支持 --dry-run 预览、自动备份、回滚)

### 迁移脚本安全机制

```bash
# 1. 预览模式(不会修改任何文件)
python scripts/migrate_project.py ./my-project --dry-run

# 2. 保存计划供审查
python scripts/migrate_project.py ./my-project --plan migration-plan.json

# 3. 用户确认后执行(自动备份)
python scripts/migrate_project.py ./my-project

# 4. 失败时自动回滚到备份
```

## 触发条件

当用户提到:
- "优化 Python 项目结构"
- "重构 Python 代码架构"
- "Python 项目目录怎么组织"
- "改进 Python 工程化"
- "Python 最佳实践"
Other files archived by AlphaMoat (fetched selectively, may be incomplete)
  • references/best-practices.md · 4.5 KB
  • skill-card.md · 2.0 KB

Popular in Development

GithubDevelopment

Interact with GitHub using the gh CLI. Use gh issue, gh pr, gh run, and gh api for issues, PRs, CI runs, and advanced queries.

↓ 386.6K★ 708Peter Steinberger
Multi Search EngineDevelopment

Multi search engine integration with 16 engines (7 CN + 9 Global). Supports advanced search operators, time filters, site search, privacy engines, and Wolfra...

↓ 162.1K★ 763g_pyAng
McporterDevelopment

Use the mcporter CLI to list, configure, auth, and call MCP servers/tools directly (HTTP or stdio), including ad-hoc servers, config edits, and CLI/type generation.

↓ 80.3K★ 204Peter Steinberger
Mermaid DiagramDevelopment

Generate valid Mermaid diagrams like flowcharts, sequence diagrams, mind maps, ER diagrams, or user journeys from text or product descriptions.

↓ 73.4K★ 59pupujanet-eng
YouTubeDevelopment

YouTube Data API integration with managed OAuth. Search videos, manage playlists, access channel data, and interact with comments. Use this skill when users want to interact with YouTube. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Calls run through the maton CLI with OAuth login, or over raw HTTP with a Maton API key where the CLI cannot be installed. Every call is authenticated as the user's connection and reaches only what that connection's authorization allows, which the provider enforces on every request; the endpoints documented here are the ones this skill uses, and any other endpoint of this app needs the user to ask for it by name. Default to read and list calls, and confirm every write or new connection with the user. This file also documents the three constructs that turn a YouTube connection into automation, in the order they are used: the connection (the first step), a hosted function that runs a YouTube action through the Maton SDK, and a trigger that calls that function on a schedule or on an event. Those sections are the platform's own reference text, shared with the api-gateway skill, with YouTube examples; they add no YouTube capability - YouTube is not an event source, a trigger cannot read YouTube data, and the files under references/<source>/triggers.md are the platform's event catalogues for the sources Maton offers (time, Calendly, GitHub, Gmail, HubSpot, Linear, Notion, Slack, Stripe).

↓ 61.6K★ 145byungkyu
GitHubDevelopment

GitHub API integration with managed OAuth. Access repositories, issues, pull requests, commits, branches, and users. Use this skill when users want to interact with GitHub repositories, manage issues and PRs, search code, or automate workflows. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Calls run through the maton CLI with OAuth login, or over raw HTTP with a Maton API key where the CLI cannot be installed. Every call is authenticated as the user's connection and reaches only what that connection's authorization allows, which the provider enforces on every request; the endpoints documented here are the ones this skill uses, and any other endpoint of this app needs the user to ask for it by name. Default to read and list calls, and confirm every write or new connection with the user. This file also documents the three constructs that turn a GitHub connection into automation, in the order they are used: the connection (the first step), a hosted function that runs a GitHub action through the Maton SDK, and a trigger that calls that function on a schedule or on an event. Those sections are the platform's own reference text, shared with the api-gateway skill, with GitHub examples; they add no GitHub capability - GitHub is itself an event source, so its own events are in references/github/triggers.md, and the files under references/<source>/triggers.md are the platform's event catalogues for the sources Maton offers (time, Calendly, GitHub, Gmail, HubSpot, Linear, Notion, Slack, Stripe).

↓ 38.2K★ 53byungkyu
CodeDevelopment

A coding workflow skill covering planning, implementation, verification, and testing.

↓ 36.8K★ 66Iván
Docker EssentialsDevelopment

Essential Docker commands and workflows for container management, image operations, and debugging.

↓ 36.6K★ 42Arnarsson

Data month: 2026-09 · Downloads, stars and installs are aggregated monthly from public skill registries (ClawHub, SkillHub). See methodology.