Axıs
技能目录

Skill vs Rule vs Hook vs Subagent

Skill vs Rule vs Hook vs Subagent

Ask These First

  1. Should it trigger on phrases, or stay always-on?
  2. Should it run code around events, or guide reasoning?
  3. Should it isolate context with its own prompt?

Decision Table

Signal Artifact Frontmatter Body
"When user says X, follow procedure Y" skill name, description (WHAT+WHEN) steps + template + checklist
"Always write code like Z" / "For **/*.ts, do W" rule description, globs or alwaysApply: true <50 lines, one concern, with GOOD/BAD example
"Before shell, block X" / "After edit, format" hook hooks.json v1 entry: command, type, matcher, failClosed stdin JSON in, stdout JSON out; exit 2 = block
"Delegate deep work without polluting context" subagent name, description with trigger + "use proactively" when apt role, workflow, output shape, constraints

Hook Quick Pick

  • Block/approve shell: beforeShellExecution (+ matcher curl|wget|nc ).
  • Audit output: afterShellExecution.
  • Format after edit: afterFileEdit.
  • Rewrite one tool call: preToolUse (permission, updated_input).
  • Follow up after success: postToolUse (additional_context).
  • Gate subagents: subagentStart (permission); chain loops: subagentStop (followup_message).

Matchers are JS regex (\s, not [[:space:]]). Start without a matcher, tighten after it fires. Scripts must be executable; verify helpers with command -v jq python3 node before finishing.