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

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.

The file

Files
SKILL.md

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.
  • Field constraints (ge=1, pattern=...) are validated by the kernel for every head.
  • Return pydantic models (or lists of them, or str); never print. Add render= only for a better human view.
  • Name: the function name with _ → -; use name= 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 HeinzelError with an actionable message for expected failures.

Verification

  • Unit test of the service method, integration test through the CLI (--json output asserted)
  • uv run hz <module> <operation> --help reads well
  • make docs regenerated the CLI and configuration references
  • make check passes

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.