feat(skill): add built-in configure-hooks skill - #53
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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.configure-hooksskill, mirroring the existingcustomize-opencodepattern: 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.customize-opencode:packages/opencode/src/skill/index.ts(v1, CLI runtime) andpackages/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-hooksmigration pointerpackages/core/src/plugin/skill.ts— exportsConfigureHooksContent, registers the skill in the v2Pluginpackages/opencode/src/skill/index.ts— registers the built-in skill for the v1 (CLI) skill registrypackages/core/test/plugin/skill.test.ts— asserts the v2 plugin registersconfigure-hooksTest plan
bun test packages/core/test/plugin/skill.test.ts— 2 pass (existingcustomize-opencodecase + newconfigure-hookscase)bun test packages/opencode/test/skill/— 22 pass, no regressionsbun turbo typecheck(via pre-commit hook) — 29/29 packages pass