スキル一覧に戻る
michaelalber

python-arch-review

by michaelalber

This MCP server provides AI assistants with tools to search and retrieve information from 10 CFR Part 712 - the federal regulation governing the Human Reliability Program (HRP) for DOE and NNSA facilities.

0🍴 0📅 2026年1月13日
GitHubで見るManusで実行

SKILL.md


name: python-arch-review description: Architecture review for Python 3 projects enforcing TDD (Red→Green→Refactor→Quality Check), YAGNI principles, and code quality gates. Use when (1) writing new Python code, (2) reviewing existing Python code, (3) refactoring Python modules, (4) adding tests to Python projects, or (5) checking code quality metrics. Integrates Ruff, mypy, and security scanning.

Python Architecture Review

TDD Workflow

Every code change follows: Red → Green → Refactor → Quality Check

  1. Red: Write failing test first
  2. Green: Minimal code to pass
  3. Refactor: Clean up, no new functionality
  4. Quality Check: Run full quality gate
# Run quality gate
scripts/quality_check.py <path>

Test Standards

Naming: test_should_<expected>_when_<condition> or test_<method>_<scenario>_<result>

Pattern: Arrange-Act-Assert (one assertion per test, except related validations)

def test_should_return_sum_when_two_positive_numbers():
    # Arrange
    calc = Calculator()
    
    # Act
    result = calc.add(2, 3)
    
    # Assert
    assert result == 5

Quality Gates

MetricTargetTool
Cyclomatic ComplexityMethods <10, Classes <20radon
Coverage80% business logic, 95% security-criticalpytest-cov
Maintainability Index70+radon
Code Duplication<3%pylint

Core Philosophy: Pragmatic Over Perfect

Start simple, add complexity only when needed.

YAGNI Principles

  • Start simple with direct implementations
  • Add abstractions only when complexity demands (Rule of Three)
  • Prefer composition over inheritance
  • No abstractions for future "what-ifs"
  • Refactor to add abstractions when patterns emerge

Architecture Decision Flow

Is this a simple CRUD operation?
  → YES: Direct implementation, no layers
  → NO: Does it have complex business rules?
      → NO: Service + Repository (2 layers max)
      → YES: Consider Clean Architecture layers

See references/architecture-patterns.md for selective Clean Architecture and strategic SOLID guidance.

Tool Integration

Ruff (Lint + Format)

ruff check --fix .
ruff format .

See references/ruff-config.md for pyproject.toml config.

mypy (Type Checking)

mypy --strict .

See references/mypy-config.md for strict config.

Security

bandit -r src/
pip-audit

See references/security-checklist.md for OWASP checks.

Review Workflow

  1. Pre-commit: scripts/quality_check.py (blocks on failures)
  2. Code Review: Check against references/review-checklist.md
  3. Merge: All gates green, coverage met

When to Skip Quality Checks

Never skip for production code. Acceptable for:

  • Spike/prototype branches (labeled spike/*)
  • Documentation-only changes
  • CI/CD config changes

スコア

総合スコア

70/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です