---
name: Python Architecture
slug: python-architecture
category: Quality
description: Python Architecture guides the creation of new modules, refactoring class hierarchies, introducing design patterns, and making multi-file changes in the APM CLI codebase. Use it to follow existing patterns and centralize shared logic with regression tests and static checks.
github: "https://github.com/microsoft/apm/tree/main/.agents/skills/python-architecture"
language: Python
stars: 3544
forks: 324
install: "npx degit https://github.com/microsoft/apm/tree/main/.agents/skills/python-architecture ~/.claude/skills/python-architecture"
installs_to: ~/.claude/skills/python-architecture
source_path: .agents/skills/python-architecture/SKILL.md
collection_size: 21
category_size: 1354
collection_url: "https://dirskills.com/collections/microsoft/apm"
added: 2026-08-16T07:02:27.115Z
last_synced: 2026-08-16T07:02:27.115Z
canonical_url: "https://dirskills.com/skills/python-architecture"
---

# Python Architecture

Python Architecture guides the creation of new modules, refactoring class hierarchies, introducing design patterns, and making multi-file changes in the APM CLI codebase. Use it to follow existing patterns and centralize shared logic with regression tests and static checks.

**Install:**

```bash
npx degit https://github.com/microsoft/apm/tree/main/.agents/skills/python-architecture ~/.claude/skills/python-architecture
```

## README

# Python Architecture Skill

[Python architect persona](../../../.apm/agents/python-architect.agent.md)

## When to activate

- Creating new Python modules or packages under `src/apm_cli/`
- Refactoring class hierarchies or introducing base classes
- Changes that touch 3+ files with shared logic patterns
- Introducing new design patterns (Strategy, Observer, etc.)
- Cross-cutting concerns (logging, auth, error handling)
- Performance-sensitive paths (parallel downloads, large manifests)

## Key rules

- Follow existing patterns (BaseIntegrator, CommandLogger, AuthResolver) before inventing new ones
- Prefer composition over deep inheritance
- Push shared logic into base classes, not duplicated across siblings
- One canonical owner per decision: route through the existing authority (target_catalog, AuthResolver/host_providers, runtime registry, CommandLogger, CompiledOutputWriter, deployment_ledger, install-outcome, neutral hook IR, BaseIntegrator); extend it, never fork it. Full rule: `.apm/instructions/architecture.instructions.md`
- Lock every centralization with a dual guardrail: a regression test plus a static check in `scripts/lint-architecture-boundaries.sh`
