python-project-structure

Organize Python projects with module boundaries and explicit __all__ interfaces.

1|Updated Apr 27, 2026
One-click install
npx skills add https://github.com/haxlys/skills --skill python-project-structure-haxlys
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-project-structure
Source: https://github.com/haxlys/skills/tree/main/vendored/wshobson-agents/plugins/python-development/skills/python-project-structure
Command: npx skills add https://github.com/haxlys/skills --skill python-project-structure-haxlys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Organizes Python projects by enforcing module boundaries and explicit public interfaces.

Core Features & Use Cases

  • Module cohesion and explicit interfaces defined with all to keep public APIs clean.
  • Guidance for flat directory structures, naming conventions, and test layout to improve maintainability.
  • Use cases include starting new projects, reorganizing existing codebases, and designing scalable package layouts.

Quick Start

Apply the recommended directory layout and public API conventions to bootstrap a new Python project.

Frequently Asked Questions about python-project-structure

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I organize a Python project with clean module boundaries?▼

To organize a Python project with clean module boundaries, enforce explicit public interfaces using __all__ and maintain flat directory structures. This approach ensures modules remain cohesive and scalable by clearly separating internal implementations from exposed APIs.

What is the best way to design a public API in a Python package?▼

The best way to design a public API in a Python package is by explicitly defining __all__ in your modules. This exposes specific functions and classes while hiding internal logic, keeping your interfaces clean and maintainable across src and packaging layouts.

How does __all__ work for controlling module imports in Python?▼

The __all__ mechanism works by listing the explicit public interface names a module exposes. It controls imports so that wildcard imports only pull defined names, enforcing strict module boundaries and preventing internal code from leaking into the public API.

Can I use this approach to reorganize an existing Python codebase?▼

Yes, you can use this approach to reorganize an existing Python codebase. It applies structure by introducing clear modular boundaries, consistent naming conventions, and explicit __all__ exposure to refactor tangled code into a maintainable, scalable architecture.

What is the recommended testing layout for a scalable Python project?▼

The recommended testing layout for a scalable Python project involves a flat directory structure that mirrors your src layout. This ensures consistent naming conventions and clear modular boundaries, keeping tests aligned with your explicit public API.

When should I not use a flat directory structure for Python projects?▼

You should reconsider a flat directory structure for Python projects when your codebase lacks clear modular boundaries. If your modules are highly interdependent without a separable public API, enforcing strict __all__ exposure and flat layouts may overcomplicate the architecture.