add-operation
Skill2 starsChanged 16 days agoMITView on GitHub
Add an operation (a command in the CLI, a tool in MCP, an endpoint in REST) to an existing Heinzelmännchen module. Use when asked for a new command, subcommand or capability of an existing module.
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/AGENTS.mdAGENTS.md
- tests/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/CLAUDE.mdCLAUDE.md
- starter/CLAUDE.mdCLAUDE.md
- template/CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
- add-moduleSkill
- codifySkill
- raise-the-barSkill
- releaseSkill
- reviewSkill
- scaffold-pluginSkill
- self-auditSkill
- ship-smallSkill
- write-adrSkill
- write-testsSkill
The file
Files
Add an operation
from typing import Annotated
from pydantic import Field
from heinzel import HeinzelError
@module.operation(read_only=True) # read_only=False when it changes state
def archive(
service: ReportService, # injected by type, hidden from every head; injected parameters come first
name: Annotated[str, Field(description="Which report to archive.")], # no default -> CLI argument
dry_run: Annotated[bool, Field(description="Only show what would happen.")] = False, # default -> option
) -> ArchiveResult:
"""Archive a report and return where it went.""" # first line = help text, required
return service.archive(name, dry_run=dry_run)Rules
- The docstring is mandatory; its first line is the summary in every head.
- Injected parameters (services, settings,
Kernel) come first, then arguments, then options with defaults. Fieldconstraints (ge=1,pattern=...) are validated by the kernel for every head.- Return pydantic models (or lists of them, or
str); never print. Addrender=only for a better human view. - Name: the function name with
_→-; usename=when the natural name clashes with a builtin (list). - An operation named like its module, in a module with no other operations or submodules, collapses into a single
command (
hz system changelog). - Raise
HeinzelErrorwith an actionable message for expected failures.
Verification
- Unit test of the service method, integration test through the CLI (
--jsonoutput asserted) uv run hz <module> <operation> --helpreads wellmake docsregenerated the CLI and configuration referencesmake checkpasses
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
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.

