python-project-structure

Guide Python project organization, module architecture, and public API design with `__all__`.

Updated Feb 18, 2026
One-click install
npx skills add https://github.com/ollieb89/viflo --skill python-project-structure-ollieb89
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-project-structure
Source: https://github.com/ollieb89/viflo/tree/main/.windsurf/skills/python-project-structure
Command: npx skills add https://github.com/ollieb89/viflo --skill python-project-structure-ollieb89

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of organizing Python codebases, ensuring clarity, maintainability, and ease of navigation through well-defined module architectures and public API designs.

Core Features & Use Cases

  • Module Cohesion: Guides on grouping related code for better maintainability.
  • Explicit Interfaces: Demonstrates using __all__ to define public APIs.
  • Directory Layouts: Provides patterns for flat vs. nested structures and test file placement.
  • Use Case: When starting a new Python project, use this Skill to establish a robust and scalable directory structure from the outset, preventing future refactoring headaches.

Quick Start

Use the python-project-structure skill to create a standard layout for 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 structure a Python project for maintainability?

Python project structure relies on grouping related code into cohesive modules and defining explicit public APIs using `__all__`. Establishing a consistent directory hierarchy from the outset ensures maintainability and prevents future refactoring headaches.

What is the best way to define a public API in a Python module?

The best way to define a public API in a Python module is by using the `__all__` variable. This explicitly declares which functions and classes are part of the public interface, ensuring discoverability and hiding internal implementation details.

Where should I place test files in a Python project directory layout?

Test file placement in a Python project depends on your directory layout patterns. This skill provides guidance on conventional test file placement alongside flat or nested directory structures to ensure codebase discoverability and clear module architecture.

When do I need a nested directory hierarchy vs a flat structure for Python code organization?

You need a nested directory hierarchy for larger Python codebases requiring strict module architecture, while a flat structure suits simpler projects. This skill provides patterns for both to ensure file cohesion and scalable code organization.

Can I use this Python project structure guidance for an existing codebase?

You can use this guidance to refactor an existing Python codebase by applying its module architecture conventions. Reorganizing files for better module cohesion and defining explicit interfaces improves codebase navigation and maintainability.