Token导航 LogoToken导航TokenDH.com
前端设计执行命令github未标认证来源可访问许可证需确认审计通过

scaffold-opencode-hooksscaffold opencode hooks 命令行

Agent Skill

scaffold-opencode-hooks 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

282

周安装

12

GitHub Stars

13

下载量

99
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:scaffold-opencode-hooks(scaffold opencode hooks 命令行)
来源仓库:https://github.com/jpcaparas/skills
仓库路径:skills/scaffold-opencode-hooks
安装命令:
npx skills add https://github.com/jpcaparas/skills --skill scaffold-opencode-hooks
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/jpcaparas/skills --skill scaffold-opencode-hooks

简介

scaffold-opencode-hooks 提供开源代码钩子脚手架,支持事件监听与流程扩展。

  • 适用于在 Codex、Claude、Cursor、Gemini CLI 中定制开发行为响应。
  • 通过 npx skills add 命令从 jpcaparas/skills 仓库安装使用。
  • 需评估钩子注入对原有流程的影响,避免副作用。
  • 建议查阅原始 README 了解 Hook 注册点与安全边界。

SKILL.md

scaffold-opencode-hooks

Audit the target project first, then scaffold OpenCode hooks as managed OpenCode plugins with deterministic file generation and repeatable config merges.

Decision Tree

What is the user asking for?

  • New OpenCode hooks in a repo with no existing plugin setup: Verify the live docs, audit the repo, inspect existing OpenCode config state, choose project-local or global scope, then scaffold managed plugins.
  • Existing .opencode/plugins/, .opencode/package.json, or opencode.json / opencode.jsonc files: Audit what already exists, choose additive or overhaul, then refresh only the managed plugin layer.
  • Existing plugins that should be shareable in the repo: Default to project-local .opencode/plugins/ and only touch opencode.json when npm plugin entries are part of the plan.
  • Personal or machine-local hooks across many repos: Target ~/.config/opencode/plugins/ and ~/.config/opencode/opencode.json instead of the project tree.
  • OpenCode plugin troubleshooting: Inspect config precedence, plugin directories, config-dir dependencies, and cache or disable flows before rewriting plugin logic.
  • Explanation only, not implementation: Read references/hook-events.md, references/config-layering.md, references/plugin-patterns.md, and references/scaffold-layout.md, then answer without scaffolding.

Quick Reference

TaskAction
Verify the current official OpenCode plugin modelRead https://opencode.ai/docs/plugins/, https://opencode.ai/docs/config/, https://opencode.ai/docs/sdk, https://opencode.ai/docs/custom-tools, and compare them with assets/hook-events.json
Audit a target repoRun scripts/audit_project.sh /path/to/project
Inspect project-vs-global OpenCode setupRun python3 scripts/check_plugin_setup.py --project /path/to/project --json
Merge npm plugin names into an OpenCode config fileRun python3 scripts/merge_opencode_config.py --config-file /path/to/opencode.json --plugins plugin-a plugin-b
Merge config-dir dependencies for local pluginsRun python3 scripts/merge_package_json.py --package-file /path/to/.opencode/package.json --dependencies-json '{"@opencode-ai/plugin":"^1.4.3"}'
Generate or refresh the managed OpenCode hook scaffoldRun `bash scripts/scaffold_hooks.sh --project /path/to/project --plan /path/to/plan.json --mode additive
Regenerate the plugin README in a target projectRun bash scripts/render_hooks_readme.sh --project /path/to/project --plan /path/to/plan.json

Non-Negotiable Workflow

  1. Verify the live official OpenCode plugin docs before planning any scaffold.
  2. Compare the live docs, config guidance, and SDK examples with assets/hook-events.json before assuming the surface catalog is unchanged.
  3. Audit the target project in detail before deciding scope, deployment style, module format, or which plugin patterns to enable.
  4. Inspect any existing opencode.json, opencode.jsonc, .opencode/plugins/, .opencode/package.json, AGENTS.md, and other automation files before choosing a merge mode.
  5. Choose scope deliberately:

- default to project-local when the hooks should travel with the repo - default to global only when the behavior should stay personal or cross-project

  1. Produce or update a concrete plan JSON. Keep the scaffold deterministic by putting project-specific judgment into the plan, not into the scaffold script.
  2. Scaffold reference stubs for every current official OpenCode hook surface under the managed state directory, even if only some live plugin files become active.
  3. Generate only the enabled managed plugin modules into the active plugin load path so dormant stubs do not become runtime plugins by accident.
  4. Merge config plugin arrays and config-dir package dependencies deterministically, without deleting unrelated user-owned entries.
  5. Regenerate the plugin README so the target project has a readable map of active plugins, managed state, and available hook surfaces.

Config Layer First Heuristic

Inspect OpenCode setup early whenever any of these signals appear:

  • the user wants OpenCode hooks scaffolded into a repo
  • .opencode/plugins/ already exists
  • opencode.json or opencode.jsonc already contains a plugin array
  • the user wants personal hooks that should apply across multiple repos
  • plugins exist on disk but OpenCode behaves strangely, crashes, or ignores the intended workflow

Use this flow:

  1. Canonicalize the target project path first.
  2. Run python3 scripts/check_plugin_setup.py --project /path/to/project --json.
  3. Decide scope from the existing OpenCode footprint:

- existing repo-local .opencode/ setup or a shared repo use case -> project - personal or cross-repo behavior -> global

  1. Decide deployment style:

- custom logic you own -> local plugin files - shared third-party packages plus local custom logic -> hybrid

  1. Only then edit plugin files, config arrays, or config-dir dependencies.

Live Docs First

The official OpenCode docs are the source of truth:

  • https://opencode.ai/docs/plugins/
  • https://opencode.ai/docs/config/
  • https://opencode.ai/docs/sdk
  • https://opencode.ai/docs/custom-tools
  • https://opencode.ai/docs/troubleshooting

Use the article at https://blog.devgenius.io/opencode-auto-lint-your-ai-agents-code-with-a-post-turn-biome-hook-7158d75c63db?postPublishedType=repub as secondary practical guidance for post-turn validation patterns, not as the source of truth for paths, load order, or lifecycle semantics.

If the official docs and the article disagree, follow the official docs and update the local references.

Project Analysis Rules

Before choosing any OpenCode hook structure, inspect:

  • repo root and workspace shape
  • whether the project already has .opencode/plugins/, .opencode/package.json, opencode.json, or opencode.jsonc
  • languages and package managers
  • build, test, lint, format, and validation entry points
  • monorepo tools like Turborepo, Nx, pnpm workspaces, Bun workspaces, Cargo workspaces, or custom task runners
  • existing AI instructions such as AGENTS.md, repo rules, or automation docs
  • sensitive paths like .env, secrets, lockfiles, generated code, migrations, and infra directories
  • whether the hook setup should be shareable in-repo or remain machine-local
  • whether local plugin logic needs config-dir dependencies, Bun shell calls, or SDK-driven feedback loops

Run scripts/audit_project.sh first, then read references/project-analysis.md when you need the full checklist.

Deterministic vs Project-Specific Work

Keep these parts deterministic:

  • the managed plugin filename prefix
  • the managed state directory layout
  • the stub coverage for every current official hook surface
  • config plugin-array merges
  • config-dir package dependency merges
  • README generation
  • additive vs overhaul semantics for previously managed plugin files

Allow these parts to stay project-specific:

  • which live plugin modules are enabled
  • whether the scaffold targets project or global scope
  • whether the generated modules are JavaScript or TypeScript
  • whether npm plugin entries should be merged into config
  • the actual plugin logic inside enabled modules
  • cooldowns, tool lists, validation commands, and feedback prompts
  • whether the refresh is additive or overhaul

Repeat-Run Rules

When the skill is invoked again against a project:

  • Re-verify the live docs before assuming the surface set is unchanged.
  • Re-audit the project before assuming the current plugin plan still fits.
  • Preserve unrelated user plugins by default.
  • Preserve unrelated plugin array entries in opencode.json or opencode.jsonc.
  • Preserve unrelated config-dir dependencies in .opencode/package.json.
  • Treat previously generated plugin files listed in the managed manifest as replaceable in overhaul mode.
  • Treat previously generated files as append-only in additive mode unless the user explicitly asks for a reset.
  • If the official docs add or remove hook surfaces, update the manifest inputs first.

Scaffold Rules

  • Generate JavaScript plugin modules by default. Switch to TypeScript only when the repo already leans heavily on TypeScript or the user explicitly wants typed plugin authoring.
  • Keep live managed plugin modules directly in the active plugin directory so OpenCode definitely loads them.
  • Keep full hook-surface stubs under a non-loading managed state directory as .txt reference files.
  • Default to project-local .opencode/plugins/ for shared repo scaffolds.
  • Default to global ~/.config/opencode/plugins/ only when the behavior should remain personal or cross-project.
  • Create or normalize the config-dir package.json when live plugin modules need a stable ESM boundary or extra runtime dependencies.
  • Only add @opencode-ai/plugin when the generated scaffold actually needs the tool() helper or typed imports.
  • Prefer client.app.log() over console.log() for plugin logging.
  • Use tool.execute.before for prevention, tool.execute.after for observation, and event for cross-event coordination like session.idle.
  • Treat experimental.session.compacting as opt-in and experimental. Do not make core safety logic depend on it.
  • Never assume local helper .js or .ts files under the plugin directory are inert. Anything with a runtime module extension may load as a plugin.

Reading Guide

NeedRead
Full audit checklist and planning questionsreferences/project-analysis.md
Config precedence, scope selection, and plugin directoriesreferences/config-layering.md
Current official hook surfaces, event groups, and special plugin capabilitiesreferences/hook-events.md
Common plugin archetypes like guardrails, post-turn checks, shell env, and custom toolsreferences/plugin-patterns.md
Managed folder layout and plan file shapereferences/scaffold-layout.md
Additive versus overhaul behaviorreferences/merge-strategy.md
Runtime traps, path drift, cache issues, and JSONC caveatsreferences/gotchas.md

Operational Scripts

  • scripts/audit_project.sh builds a project profile from real repo signals.
  • scripts/check_plugin_setup.py inspects project and global OpenCode config, plugin directories, and config-dir package files.
  • scripts/merge_opencode_config.py preserves unrelated config keys while merging plugin-array entries into opencode.json or opencode.jsonc.
  • scripts/merge_package_json.py preserves unrelated package fields while merging config-dir dependencies needed by local plugins.
  • scripts/scaffold_hooks.sh renders live managed plugin modules, hook-surface stubs, the manifest, and the plugin README.
  • scripts/render_hooks_readme.sh rebuilds .opencode/plugins/README.md from the manifest and the current plan.
  • scripts/validate.py checks structure, frontmatter, manifest integrity, and cross-references.
  • scripts/test_skill.py runs lightweight validation plus temp-project integration checks.

Gotchas

  1. OpenCode hooks are plugins, not a separate hook-config file.
  2. All plugins from all sources load in sequence, so a project-local scaffold does not replace global plugins.
  3. Use the documented plugin directories: project-local .opencode/plugins/ and global ~/.config/opencode/plugins/.
  4. tool.execute.after is reactive, not preventative. Use tool.execute.before for guardrails.
  5. event plus named event handlers can double-handle the same workflow if you do not keep ownership clear.
  6. Local plugin dependencies belong in the config directory package file, not in the repo root package by default.
  7. experimental.session.compacting is real in the docs examples, but it is explicitly experimental.
  8. OpenCode startup issues often trace back to bad plugins or stale cache, so troubleshooting sometimes matters more than rewriting logic.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.25%
按下载量换算38

Claude

28.55%
按下载量换算28

Cursor

18.49%
按下载量换算18

Gemini CLI

8.9%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/jpcaparas/skills --skill scaffold-opencode-hooks 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills