microsoft/fsq-python-architecture
Use when designing, specifying, implementing, or auditing Python project architecture, package boundaries, public APIs, domain logic, persistence boundaries, or module dependencies.
npx skills add https://github.com/microsoft/FSQ --skill python-architecture
Use this as the Python architecture rules layer for SDD. It helps choose the simplest adequate architecture, write Python-aware SPEC.md sections, implement against those specs, and audit code/spec synchronization.
Start simple and escalate only with evidence. Architecture exists to clarify ownership, isolate change, and protect business rules; it is not a template to apply everywhere.
Use for Python work involving:
Do not use for tiny one-off scripts unless the script is becoming a maintained module.
Choose one level and record the rationale in SPEC for non-trivial work:
| Level | Use when | Avoid when |
| --- | --- | --- |
| 1. Script | One-off utility, no public API, little reuse | It has tests, users, or recurring changes |
| 2. Simple package | Small reusable code with clear functions/classes | Business rules span multiple workflows |
| 3. Layered application | API/CLI/worker with orchestration and persistence | Layers only pass data through |
| 4. Clean Architecture | Business rules must outlive framework/database choices | CRUD is simple and stable |
| 5. Light DDD | Rich domain behavior, invariants, bounded contexts | Domain is mostly data entry/retrieval |
Prefer the lowest level that keeps the module understandable and testable.
For Python modules, include this section in module SPEC.md:
## Python Architecture
- Architecture level: {1-5 and name}
- Public API: {exports, commands, endpoints, events, or classes}
- Internal modules: {files not imported outside this module}
- Domain boundaries: {where business rules live}
- Boundary models: {Pydantic schemas, DTOs, ORM models, serializers}
- Dependency direction: {allowed imports and forbidden imports}
- Rationale: {why this level is sufficient}
See references/module-spec-template.md for a fuller template.
__init__.py or the project-designated entry point._ when the project has no other convention.Before completion, check:
__init__.py exports, CLI commands, endpoints, or documented public symbols._internal files.Use references/audit-checklist.md when doing a full audit.
references/architecture-levels.md: detailed level selection guidance.references/module-spec-template.md: Python module SPEC template.references/implementation-rules.md: implementation patterns and anti-patterns.references/audit-checklist.md: SPEC/code audit checklist.Take microsoft/fsq-python-architecture from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.