Skip to content

Skills Commands Hooks

refact-planner edited this page Jun 7, 2026 · 1 revision

Skills Commands Hooks

Three extension mechanisms that add reusable behavior: skills, slash commands, and hooks.

Refact’s extension system splits behavior into three related but distinct pieces:

  • skills: reusable instruction sets and workflow knowledge
  • slash commands: reusable chat triggers stored as Markdown files
  • hooks: lifecycle and tool-event automation around agent execution

Skills

Skills are loaded through the extension layer and represented by load_skill(...) / deload_skill(...)-style behavior in the runtime. They are intended for reusable instruction sets and workflow guidance, not for external connectivity.

Important skill locations and behaviors:

  • project-local skills live in .refact/skills/<skill-id>/SKILL.md
  • skill discovery loads indexes first, then full content on demand
  • the extension layer can read the skill body, context, tools, and metadata
  • skills are surfaced in the GUI Extensions page under the Skills tab

Slash commands

Slash commands are reusable prompts stored under:

.refact/commands/

A slash command is a Markdown file, and the command name is derived from the filename. The extension API exposes CRUD operations for commands, and the GUI Extensions page exposes them under the Commands tab.

Hooks

Hooks extend behavior around agent events and tool use. The hook system supports events such as:

  • PreToolUse
  • PostToolUse
  • UserPromptSubmit
  • SessionStart
  • SessionEnd
  • Stop
  • SubagentStop
  • Notification
  • PreCompact

Hooks are loaded from extension config files and run with event payloads. The runner filters hooks by event, optional matcher, and trust/source rules, then executes them with bounded output and timeouts.

How they fit together

  • skills provide reusable workflow knowledge
  • slash commands provide reusable chat entry points
  • hooks provide automation around lifecycle and tool events

The setup.yaml guidance explicitly treats them as separate primitives, and advises not to force a workflow into the wrong one.

flowchart LR
  A[Skills] --> B[Reusable workflow knowledge]
  C[Slash commands] --> D[Reusable chat trigger]
  E[Hooks] --> F[Pre/Post tool and lifecycle automation]
  G[Extensions UI] --> A
  G --> C
  G --> E
Loading

File and code anchors

  • .refact/skills/<skill-id>/SKILL.md
  • .refact/commands/
  • crates/refact-ext/src/skills.rs
  • crates/refact-ext/src/slash_commands.rs
  • crates/refact-ext/src/hooks.rs
  • src/ext/hooks_runner.rs

See also: Marketplace

Clone this wiki locally