Skip to content

feat(skill): add built-in configure-hooks skill - #53

Merged
LeXwDeX merged 2 commits into
devfrom
feat/hooks-capability-skill
Jul 3, 2026
Merged

feat(skill): add built-in configure-hooks skill#53
LeXwDeX merged 2 commits into
devfrom
feat/hooks-capability-skill

Conversation

@LeXwDeX

Copy link
Copy Markdown
Owner

Summary

  • OpenCode's hooks system (hooks.json, 27 events, 5 handler types) has no discovery path for agents without an explicit prompt — the format only lives in source/docs, so an agent either guesses wrong or never realizes hooks exist.
  • Adds a built-in configure-hooks skill, mirroring the existing customize-opencode pattern: a short always-in-context description ("hooks exist, here's when to use them") with the full reference (file locations, event list, handler protocol, migration pointer) loaded lazily only when the skill is invoked.
  • Registered in both skill surfaces that already carry customize-opencode: packages/opencode/src/skill/index.ts (v1, CLI runtime) and packages/core/src/plugin/skill.ts (v2, define()-based plugin registry) — kept in parity so neither runtime silently lacks the skill.

Changes

  • packages/core/src/plugin/skill/configure-hooks.md — skill body: hooks.json locations/hot-reload behavior, concat-append merge order, matcher syntax, 27-event list, 5 handler types, command protocol (stdin/exit-code-2/env vars), and the /import-claude-hooks migration pointer
  • packages/core/src/plugin/skill.ts — exports ConfigureHooksContent, registers the skill in the v2 Plugin
  • packages/opencode/src/skill/index.ts — registers the built-in skill for the v1 (CLI) skill registry
  • packages/core/test/plugin/skill.test.ts — asserts the v2 plugin registers configure-hooks

Test plan

  • bun test packages/core/test/plugin/skill.test.ts — 2 pass (existing customize-opencode case + new configure-hooks case)
  • bun test packages/opencode/test/skill/ — 22 pass, no regressions
  • bun turbo typecheck (via pre-commit hook) — 29/29 packages pass

Test added 2 commits July 3, 2026 16:21
Agents have no innate knowledge of opencode's hooks system — the format
lives only in source/docs, so without a prompt nudge an agent either
guesses wrong or never discovers hooks are possible. Registers a
customize-opencode-style built-in skill: description alone tells the
agent hooks exist and when to reach for them, full event/format/handler
reference loads lazily only when the skill is actually invoked.
@LeXwDeX
LeXwDeX merged commit d844702 into devJul 3, 2026
4 checks passed
@LeXwDeX
LeXwDeX deleted the feat/hooks-capability-skill branch July 3, 2026 08:30
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@LeXwDeX