AgentSkillsCN

project-layout

在新建项目、添加目录,或验证项目布局时,严格遵循 Sun Lab 项目目录结构规范。涵盖五种项目原型(纯 Python 项目、Python + C++ 扩展项目、C++ PlatformIO 库项目、C++ PlatformIO 固件项目、C# Unity 项目)、常见根文件、环境目录、测试目录,以及文档目录的合理布局。适用于新建项目、添加顶层目录、重构项目结构,或当用户询问项目目录规范时使用。

SKILL.md
--- frontmatter
name: project-layout
description: >-
  Applies Sun Lab project directory structure conventions when creating new projects, adding
  directories, or verifying project layout. Covers the five project archetypes (Python-only,
  Python+C++ extension, C++ PlatformIO library, C++ PlatformIO firmware, C# Unity), common root
  files, environment directories, test directories, and documentation directory placement. Use
  when creating a new project, adding top-level directories, restructuring a project, or when the
  user asks about project directory conventions.
user-invocable: true

Project layout

Applies Sun Lab conventions for project directory structure across all five project archetypes.

You MUST read this skill before creating, restructuring, or verifying any Sun Lab project's directory layout. You MUST verify your changes against the checklist before submitting.


Scope

Covers:

  • Project directory trees for all five Sun Lab archetypes
  • Common root files and their purposes
  • Environment directories (envs/) with OS-specific files
  • Test directory conventions (tests/ vs test/)
  • Documentation directory placement (defers to /api-docs for internal structure)
  • .github/ directory structure
  • Archetype identification criteria

Does not cover:

  • File-level ordering within source files (see /python-style, /cpp-style, /csharp-style)
  • Documentation file contents and Sphinx configuration (see /api-docs)
  • pyproject.toml structure and fields (see /pyproject-style)
  • README file contents (see /readme-style)
  • Code style or formatting rules (see language-specific style skills)

Workflow

You MUST follow these steps when this skill is invoked.

Step 1: Identify the project archetype

Determine which archetype applies using this table:

ArchetypeKey indicators
Python-onlypyproject.toml + src/ layout, no .clang-format or CMakeLists
Python + C++ extensionpyproject.toml + CMakeLists.txt + src/c_extensions/
C++ PlatformIO libraryplatformio.ini + library.json + src/*.h
C++ PlatformIO firmwareplatformio.ini + src/main.cpp, no library.json
C# UnityAssets/ + ProjectSettings/ + *.slnx

Step 2: Load the reference tree

Read archetype-trees.md and locate the section matching the identified archetype. The reference tree is the authoritative source for directory structure.

Step 3: Apply conventions

Create or verify the project structure against the reference tree and the rules below. When creating a new project, generate all required directories and files. When verifying, report any deviations from the expected structure.

Step 4: Verify compliance

Complete the verification checklist at the end of this file. Every item must pass before submitting work.


Common root files

These files appear at the root of all (or most) Sun Lab projects:

FileAll archetypesPurpose
LICENSEYesGPL-3.0 license
README.mdYesProject documentation (see /readme-style)
.gitignoreYesGit ignore patterns
CLAUDE.mdYesClaude Code project instructions
tox.iniPython + C++Automation orchestration (lint, type, test, docs)

Python-specific root files

FileArchetypesPurpose
pyproject.tomlPython-only, Python+C++ extBuild config, metadata, tool settings
CMakeLists.txtPython+C++ extCMake build config for nanobind extension
DoxyfilePython+C++ extDoxygen documentation configuration
.clang-formatPython+C++ extC++ formatting configuration
.clang-tidyPython+C++ extC++ linting configuration

PlatformIO-specific root files

FileArchetypesPurpose
platformio.iniPlatformIO lib, PlatformIO fwPlatformIO build configuration
library.jsonPlatformIO lib onlyPlatformIO library manifest
DoxyfilePlatformIO lib, PlatformIO fwDoxygen documentation configuration
.clang-formatPlatformIO lib, PlatformIO fwC++ formatting configuration
.clang-tidyPlatformIO lib, PlatformIO fwC++ linting configuration

Unity-specific root files

FilePurpose
*.slnxUnity solution file
.editorconfigEditor configuration (indentation, encoding)
.csharpierrc.yamlCSharpier formatter configuration
.csharpierignoreCSharpier formatter ignore patterns

Environment directories

Python projects (Python-only and Python+C++ extension) include an envs/ directory with OS-specific conda/mamba environment files:

text
envs/
├── {abbr}_dev_lin.yml            # Linux conda environment specification
├── {abbr}_dev_lin_spec.txt       # Linux explicit package list
├── {abbr}_dev_osx.yml            # macOS conda environment specification
├── {abbr}_dev_osx_spec.txt       # macOS explicit package list
├── {abbr}_dev_win.yml            # Windows conda environment specification
└── {abbr}_dev_win_spec.txt       # Windows explicit package list

The {abbr} placeholder is a short project abbreviation (e.g., axa for ataraxis-automation, axbu for ataraxis-base-utilities). Each platform has two files:

  • .yml — human-readable conda environment specification used by mamba env create
  • _spec.txt — explicit package list generated by mamba list --explicit

PlatformIO and Unity projects do NOT have envs/ directories.


Test directories

ArchetypeDirectoryFrameworkFile pattern
Python-onlytests/pytestmodule_test.py
Python + C++ extensiontests/pytestmodule_test.py
C++ PlatformIO librarytest/Unity (C)test_component.cpp
C++ PlatformIO firmware(none)No test directory
C# Unity(none)Unity Play Mode / Edit Mode

Python test structure

The tests/ directory mirrors the src/package_name/ subpackage structure:

text
tests/
├── submodule/
│   └── module_test.py
└── standalone_test.py

PlatformIO test structure

The test/ directory (singular, not tests/) follows PlatformIO's native test convention:

text
test/
└── test_component.cpp

Documentation directory

All Python and C++ projects include a docs/ directory for Sphinx documentation. For the complete internal structure, Sphinx configuration, and RST templates, invoke /api-docs.

C# Unity projects do NOT have a docs/ directory.


.github/ directory

Python projects include a .github/ directory with issue templates:

text
.github/
└── ISSUE_TEMPLATE/
    ├── bug_report.md
    └── feature_request.md

PlatformIO and Unity projects may or may not include .github/ depending on whether they are published to GitHub as standalone repositories.


Source directory conventions

Python-only (src/ layout)

text
src/
└── package_name/
    ├── __init__.py
    ├── module.py
    └── py.typed

Python + C++ extension (src/ flat namespace)

text
src/
├── c_extensions/
│   └── module_ext.cpp
├── python_wrapper/
│   ├── __init__.py
│   └── wrapper_module.py
├── __init__.py
├── module_ext.pyi
└── py.typed

PlatformIO library (header-only src/)

text
src/
├── main.cpp                  # Development entry point (excluded from library)
├── primary_header.h
└── shared_assets.h

PlatformIO firmware (src/)

text
src/
├── main.cpp                  # Firmware entry point (setup/loop)
└── custom_module.h

C# Unity (Assets/)

text
Assets/
├── TaskName/
│   ├── Configurations/
│   ├── Materials/
│   ├── Prefabs/
│   ├── Scripts/
│   │   └── TaskScript.cs
│   ├── Sounds/
│   └── Textures/
├── Plugins/
└── Scenes/

Related skills

SkillRelationship
/api-docsOwns the internal docs/ structure; this skill owns directory placement
/python-styleOwns file-level ordering within Python source files
/cpp-styleOwns file-level ordering within C++ source files
/csharp-styleOwns file-level ordering within C# source files
/pyproject-styleOwns pyproject.toml structure; references src/ layout convention
/tox-configOwns tox.ini conventions; tox.ini is a common root file
/readme-styleOwns README.md content conventions
/skill-designOwns plugins/automation/skills/ directory structure conventions

Proactive behavior

You should proactively offer to invoke this skill when:

  • Creating a new Sun Lab project from scratch
  • The user asks where to place a new file or directory
  • A project structure appears to deviate from conventions during exploration
  • The user asks about project directory conventions or archetypes

Verification checklist

You MUST verify your work against this checklist before submitting any layout changes.

text
Project Layout Compliance:

Archetype Identification:
- [ ] Project archetype correctly identified from key indicators
- [ ] Reference tree loaded from archetype-trees.md

Common Root Files:
- [ ] LICENSE present (GPL-3.0)
- [ ] README.md present
- [ ] .gitignore present
- [ ] CLAUDE.md present
- [ ] Archetype-specific root files present (pyproject.toml, platformio.ini, etc.)

Source Directory:
- [ ] Python projects use src/ layout with package_name/ subdirectory
- [ ] Python+C++ extension uses flat namespace under src/ (c_extensions/, wrapper/, etc.)
- [ ] PlatformIO projects use src/ with header-only .h files
- [ ] Unity projects use Assets/ with task-specific subdirectories

Environment Directory:
- [ ] Python projects have envs/ with 6 files (3 platforms x 2 files each)
- [ ] envs/ file names use correct abbreviation prefix
- [ ] PlatformIO and Unity projects do NOT have envs/

Test Directory:
- [ ] Python projects use tests/ (plural) with _test.py suffix
- [ ] PlatformIO library projects use test/ (singular) with test_ prefix
- [ ] PlatformIO firmware and Unity projects have no dedicated test directory

Documentation Directory:
- [ ] Python and C++ projects have docs/ directory
- [ ] Unity projects do NOT have docs/

GitHub Directory:
- [ ] .github/ISSUE_TEMPLATE/ present for published GitHub repositories

No Duplicates:
- [ ] Directory trees not duplicated in other skills (api-docs owns docs/ internals)
- [ ] File-level ordering not specified (owned by language style skills)