# Skill and Hook Tools

Tools that run, write and validate skills, and read, write and test hooks.

| Tool | Description |
|---|---|
| `run_skill` | Load a named skill's reference material into the current turn; the result is `skill: <name>`, the skill directory, and the resolved `SKILL.md` body. It is reference, not a script to execute line by line. Since v1.1.0 a skill matched or named at the start of a run arrives the same way: the runtime records a `run_skill` call whose tool result carries the skill content, rather than adding a separate system message |
| `write_skill` | Renamed from `edit_skill` (Removed in v1.5.0). The files under `~/.config/agenvoy/skills/`, and since v1.5.0 the only way to change them: `write_file`, `run_command` and the sandbox cannot write there. `mode=write` creates or rewrites a file at a relative path (`my-skill/SKILL.md`), `mode=patch` replaces an exact string, only its first occurrence unless `replace_all` is set, `mode=remove` trashes a whole skill directory by single-segment name (recoverable from `.Trash`), and `mode=copy` (added in v1.5.0) copies the skill directory at `from` (it must contain `SKILL.md`; absolute or relative to the work directory, e.g. `~/.claude/skills/my-skill`) in as `name` (default: the source directory's name; a name that already exists fails with `[Conflict]`), binary files included, skipping `.git`, `__pycache__`, `.DS_Store`, symlinks and sensitive or denied paths. Since v1.5.0 a write, patch or copy that lands in a trusted skill (matched by its directory name and its frontmatter `name`; files under the skill's `.doc/` excepted) still goes through, but that skill is removed from `trust_skill` and the result tells the user to trust it again in `/skill` → permission (or WebUI Skills). In normal mode it asks for confirmation like any tool that is not read-only; auto mode or allow this turn lets it through Since v1.5.2 a `write` or `patch` of a `SKILL.md` checks its frontmatter first: a missing or mismatched `name` is set to the directory name and reported as `frontmatter fixed: ...`; a directory name that is not hyphen-case within 128 characters (64 before v1.6.0), a missing frontmatter, or a `description` that is missing or longer than 1024 characters (256 before v1.6.0) is refused with `[Invalid]` and the fix to make, and nothing is written. |
| `validate_skill` | Added in v1.5.2. Checks one skill's `SKILL.md` frontmatter without changing it and returns `valid` or every issue at once: only `name` and `description` keys, `name` hyphen-case within 128 characters (64 before v1.6.0) and equal to its directory, `description` present, at most 1024 characters (256 before v1.6.0) and without `<` / `>`. `path` is relative to `~/.config/agenvoy/skills` (`my-skill`, `scheduler/<short>-<hash8>`), or an absolute / `~` path for another location (a sensitive path asks for confirmation first); it may point at the directory or its `SKILL.md`. An invalid result ends with the tool to fix it with (`write_skill` inside the Agenvoy skills directory, `write_file` elsewhere); since v1.6.0 the tool description tells the model to fix every issue itself and validate again until valid, without asking the user. Runs without confirmation |
| `read_hook` | Added in v1.4.0. Takes one hook state `name` and returns that state's demo Python script from `~/.config/agenvoy/hooks/demo/<name>.py` (showing every field the state receives on stdin) together with the hook currently installed for it (`.py` over `.js`), or `(none)`. Read before writing or changing a hook |
| `write_hook` | Added in v1.4.0. The hook scripts in `~/.config/agenvoy/hooks/`. Since v1.5.0 a write asks for confirmation in normal mode (it was written without a prompt before); auto mode or allow this turn lets it through. `name` must be one of the hook states; `mode=write` creates or rewrites `<name>.py` (`lang=js` writes `.js`; an existing file keeps its language), `mode=patch` replaces an exact string in the installed hook, only its first occurrence unless `replace_all` is set, `mode=remove` trashes it (recoverable from `.Trash`) |
| `test_hook` | Added in v1.4.0. Runs the installed hook once the way Agenvoy does, with `input` (a JSON string, default `{}`) on stdin, and returns its `success` with `debug` or `error`; a crash, a timeout or a last stdout line that is not the required JSON comes back as an error. The verification step after every `write_hook` write or patch; on failure the loop is `write_hook(mode=patch)` → test again. Since v1.5.0 it asks for confirmation in normal mode like `write_hook` |
