Tool Structure
The standard layout for a CLI tool. The files, the directories, the conventions, and the documentation requirements.
Purpose
This page documents the standard layout for a CLI tool in the lab. Every CLI tool follows the same structure to make it easy to find, read, test, and integrate.
The structure is enforced by the CLI Python tool template. A new tool is created by copying the template and renaming the relevant files.
Directory layout
The structure is a generalization of the lab's real
tools (e.g., torrent-finder, subtitle-finder).
Required files
Every tool must have:
main.py— the CLI entry point.requirements.txt— the Python dependencies.pyproject.toml— the Python project config.package.json— the AutoSkills context.README.md— the user-facing documentation.TOOL.md— the technical specification.SKILL.md— the activation file.AGENTS.md— the instructions for the coding sub-agent.tests/— the unit tests.
A tool without these files is incomplete.
Optional files
A tool may have:
lib.py— the core logic, separated from the CLI glue.cli.py— the Click commands, separated frommain.py..env.example— example environment variables.src/— additional modules.skills/— related skills.docs/— additional documentation.examples/— usage examples.
The optional files are added when the tool grows. A small tool does not need them.
File contents
main.py
The CLI entry point. Typical structure:
The main.py should be small. The core logic should be
in lib.py.
lib.py
The core logic. Typical structure:
The lib.py is pure logic. It does not depend on argparse
or any CLI framework.
requirements.txt
The Python dependencies. One per line:
Pin the major version. Pin the minor version when the API is unstable.
pyproject.toml
The Python project config. Typical:
package.json (AutoSkills)
The AutoSkills context. This is a small JSON file that the coding sub-agent uses to understand the project:
The skills field is the list of skills the sub-agent
should activate. The tags field is the list of tags
the Coordinator uses to find the tool.
README.md
The user-facing documentation. Typical sections:
- Title and short description.
- Installation.
- Usage (with examples).
- Configuration.
- Limitations.
- License.
TOOL.md
The technical specification. The format is documented in Tool Spec.
SKILL.md
The activation file. The format is documented in Tool Spec.
AGENTS.md
The instructions for the coding sub-agent. Typical sections:
- Project overview.
- Conventions.
- File structure.
- How to add a new command.
- How to add a new dependency.
- How to run the tests.
Tests
The tests/ directory contains the unit tests. The
lab uses pytest for Python tools. The tests are
organized by module:
tests/test_main.py— tests for the CLI entry point.tests/test_lib.py— tests for the core logic.tests/test_<module>.py— tests for additional modules.
The tests follow the conventions in Tool Spec → Tests.
Skills
A tool may have one or more associated skills. A skill is a markdown file that the Coordinator activates when the user's request matches the skill's trigger phrases.
The skills live in skills/<skill-name>/SKILL.md. The
format is documented in
Tool Spec → SKILL.md.
Examples
The examples/ directory contains usage examples.
Examples are markdown files that show how to use the
tool in a specific scenario.
The format is: