agentleFS
CreativeActtechCreativeActtech/llm-skills/skills/example-skill/python-structure-generator/SKILL.md

python-structure-generator

Skill2 starsChanged 7 months agoMITView on GitHub

Analyze user-provided Python code and generate a standardized, production-ready project directory structure. Use when sharing scripts, modules, or package code and requesting "organize this", "create project layout", or "setup repository tree". Do NOT use for non-Python languages, dependency installation troubleshooting, or generating boilerplate without analyzing existing code context.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do NOT use for non-Python languages, virtual environment setup, or generating new code without analyzing existing files

    line 19
  2. Distinctive:

    Do NOT use when the user explicitly wants to keep a flat, single-file structure

    line 20
  3. Very specific:

    Test suites → tests/ (mirror src/ structure)

    line 30
  4. Distinctive:

    If the input lacks Python code or contains only configuration/data files, respond with:

    line 60
  5. Distinctive:

    If the codebase is trivial (e.g., single script with no external imports or tests), respond with:

    line 70

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Python Structure Generator

Systematically converts raw or flat Python code into a standardized, scalable directory layout following modern packaging conventions.

🎯 When to Use

  • User shares Python scripts, modules, or fragmented files and requests organization
  • User asks "create project structure", "organize this repository", or "standardize layout"
  • Code contains multiple imports, mixed concerns, or lacks clear package boundaries
  • Do NOT use for non-Python languages, virtual environment setup, or generating new code without analyzing existing files
  • Do NOT use when the user explicitly wants to keep a flat, single-file structure

🧠 Core Workflow

Step 1 — Parse Entry Points & Imports Scan code for if __name__ == "__main__": blocks, top-level imports, and relative references. IF entry point exists → designate as cli/ or __main__.py. IF sibling/parent imports exist → enforce src/<package>/ layout. IF no imports → treat as standalone utility.

Step 2 — Classify & Group Components Categorize detected logic into standard zones:

  • Core modules → src/<project_name>/
  • Test suites → tests/ (mirror src/ structure)
  • Configuration & CI → .github/, configs/, or root-level pyproject.toml
  • Artifacts & Ignored → dist/, .venv/, __pycache__/

Step 3 — Resolve Package Boundaries Map import paths to physical directories. Create __init__.py files for every package directory. IF circular imports or tightly coupled modules are detected → propose logical splits and flag in warnings.

Step 4 — Generate Tree & Setup Artifacts Construct a clean ASCII directory tree. Produce shell commands to recreate it. Generate minimal pyproject.toml and .gitignore if missing, aligned with detected dependencies and build tools.

Step 5 — Validate & Package Cross-check against PEP 517/518 and modern src/ layout standards. Ensure test discoverability, clean namespace isolation, and zero hardcoded absolute paths. Return structured output.

📋 Output Format

Section 1 — Structure Report

{
  "status": "success | partial | error",
  "project_name": "string",
  "layout_type": "src_layout | flat_layout | hybrid",
  "files_categorized": 0,
  "warnings": ["circular_imports_detected", "missing_test_coverage", "mixed_responsibilities"]
}

Section 2 — Directory Tree & Initialization Commands

Provide the complete tree in a fenced block. Follow with executable shell commands (mkdir -p, touch) to recreate it locally. Include a minimal pyproject.toml and .gitignore snippet if applicable.

⚠️ Fallback Behavior If the input lacks Python code or contains only configuration/data files, respond with:

{
  "status": "error",
  "message": "No executable Python code detected for structural analysis.",
  "suggestion": "Please provide Python scripts, modules, or import statements to generate an accurate project layout."
}

If the codebase is trivial (e.g., single script with no external imports or tests), respond with:

{
  "status": "partial",
  "message": "Input represents a standalone script. Standard project scaffolding is unnecessary.",
  "suggestion": "Keep the file in the repository root or wrap it in a minimal src/ layout only if future expansion is planned."
}

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.