agentleFS
helmut-hoffer-von-ankershoffenhelmut-hoffer-von-ankershoffen/heinzel/.claude/skills/add-module/SKILL.md

add-module

Skill2 starsChanged 16 days agoMITView on GitHub

Add a module or submodule to Heinzelmännchen (or to a Heinzelmännchen plugin) the idiomatic way, with service, operations, tests and docs. Use when asked for a new command group, a new area of functionality, or a submodule of an existing module.

10 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep operations thin: annotate parameters Annotated[T, Field(description=...)], take the service by type, return a model.

    line 23
  2. Very specific:

    Check it shows up: uv run hz system modules, uv run hz <name> --help.

    line 28
  3. Distinctive:

    Update README (usage) and ARCHITECTURE.md if the module is part of the core story.

    line 29
  4. Very specific:

    If people must or may configure the module before using it, declare one setup step: @module.setup (or required=True) on a function that …

    line 38

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “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

Add a module

A module is a package whose __init__.py declares module = Module(name, summary). The kernel discovers it; there is no registry to edit. A package nested in a module's package that declares its own module is a submodule.

Process

  1. Decide where it lives: src/heinzel/modules/<name>/ for core (generic, company-neutral — see INTENT.md tenet 9), or a plugin for anything specific. A new top-level concept in the core warrants an ADR (write-adr).
  2. Create the package:
    <name>/
      __init__.py    # module = Module(...); module.service(...); @module.operation functions; __all__
      _models.py     # pydantic models the operations return
      _service.py    # the logic, a class whose constructor asks for what it needs by type
      _render.py     # optional: rich renderers used as render= hints
  3. Keep operations thin: annotate parameters Annotated[T, Field(description=...)], take the service by type, return a model. Raise HeinzelError for failures a user should read.
  4. Tests (write-tests): unit tests for the service in tests/unit/modules/, integration tests through the CLI head in tests/integration/ (build the app with make_kernel(builtins=True, ...)).
  5. Regenerate the references with make docs (make lint fails until you do).
  6. Check it shows up: uv run hz system modules, uv run hz <name> --help.
  7. Update README (usage) and ARCHITECTURE.md if the module is part of the core story.
  8. Optional, for a built-in module or a first-party plugin under plugins/ worth showing in the README demo: add a demo.tape next to its __init__.py with a few real hz commands (Type, Enter, Wait, Sleep, Hide, Show; Require for other programs it pipes into), run make fix to regenerate docs/assets/demo.tape and make demo to render the GIF; look at its last frames before committing it. Rules and an example: CONTRIBUTING.md, "The README demo".

Setup step (optional)

If people must or may configure the module before using it, declare one setup step: @module.setup (or required=True) on a function that asks through an injected Prompter (text, choice, choices, confirm, number, secret) and writes through ConfigEditor.write("<module>.<key>", value) and Credentials.set(...). It runs as hz setup <module> and as part of hz setup, never as a command of the module, so declaring it never changes the module's command path (ADR 0032). Modules without a declared step get none. Test it with scripted answers: ScriptedPrompter([...]) bound with kernel.bind(Prompter, ...), or the hz_prompter fixture.

Red flags

  • The module imports another module's _private file → inject its service instead.
  • An operation has more than a few lines of logic → move it into the service.
  • The module imports heinzel.heads → never; use render=.

Verification

  • make check passes
  • hz system modules lists the module with its lets
  • hz <name> <operation> --json returns valid JSON

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.