dsh-hooks-authoring

dsh-hooks-authoring is a skill for Claude Code from KYinCode/dsh-hooks-plugin. It costs 112 tokens per session (1,444 once invoked), scanned A, original, MIT.

Instructions for writing and debugging dsh-hooks-plugin scripts, which run during tool or session events such as before a tool call or after it finishes. These scripts return JSON decisions such as allowing, asking about, or denying an action.

In plain words
What is it for?
Use it to create or troubleshoot hooks in .dsh/hooks.json, inspect shell commands, match events and tools, and return correctly formatted permission decisions.
Why use it?
It prevents common configuration mistakes, such as reading the command from the wrong input field or relying on an exit code to block a tool. It also accounts for differences between Bash and PowerShell on Windows.

Skill for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: mentions Claude Code.

Good fit Use it to create or troubleshoot hooks in .dsh/hooks.json, inspect shell commands…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kyincode/dsh-hooks-plugin/dsh-hooks-authoring
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add KYinCode/dsh-hooks-plugin --skill dsh-hooks-authoring
Clone the repo
git clone --depth 1 https://github.com/KYinCode/dsh-hooks-plugin

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dsh-hooks-authoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/kyincode/dsh-hooks-plugin/dsh-hooks-authoring.svg)](https://agentmods.dev/skills/kyincode/dsh-hooks-plugin/dsh-hooks-authoring)
Your own site
<a href="https://agentmods.dev/skills/kyincode/dsh-hooks-plugin/dsh-hooks-authoring"><img src="https://agentmods.dev/badge/skills/kyincode/dsh-hooks-plugin/dsh-hooks-authoring.svg" alt="Measured on agentmods" height="20"></a>
Per session 112 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,444 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00112 $0.01444
Opus 5 $0.00056 $0.00722
Sonnet 5 $0.00022 $0.00289
Haiku 4.5 $0.00011 $0.00144

Measured 6d ago against content hash ba545e634fe2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

dsh-hooks-authoring scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/dsh-hooks-authoring/SKILL.md · 79 lines

How it starts

The opening of the file, as written. The whole thing — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.

编写 dsh-hooks hook 脚本

这个部署里装了 dsh-hooks-plugin:它把 Claude Code 风格的 hooks 接到 DSH 的工具/会话生命周期上,配置从 <项目根>/.dsh/hooks.json 读取(另有 ~/.dsh/hooks.json 全局层等,可缺省、按序合并)。本技能的职责是让你写得对:把一条 hook 配好、让它能跑、让它的决策真正生效。

完整规范 / 边界表在安装包内的 docs/CONFIGURATION.md(本包自带,随发布版本同步)。深度问题以它为准;这里是常踩的硬事实摘要,先读这份就够了。

四条钉死的事实

  1. 输入顶层没有 command。要检的命令在 tool_input.commandbash/pwsh 这类 shell 工具的入参)。读顶层 input.command 永远是空的 → 校验直接废掉。
  2. 退出码不 gateexit 2 不会拦工具;决策只能靠 stdout JSON。没输出决策 JSON = 默认放行。
  3. hookEventName 回填hookSpecificOutput.hookEventName 用 stdin 的 hook_event_name 原样填,别手写死。
  4. 决策放脚本文件,配置只写一行 "command": "<一行>"(别把长逻辑塞进 JSON 的 command,Windows 内联引号必炸)。

怎么配

<项目根>/.dsh/hooks.json(项目层,热重载,保存即生效):

{
  "PreToolUse": [
    {
      "matcher": "bash|pwsh",
      "hooks": [
        { "type": "command", "command": "& 'F:/项目目录/guard.ps1'", "timeout": 10 }
      ]
    }
  ]
}
  • 事件 key 只认 8 个:PreToolUse / PostToolUse / PostToolUseFailure / UserPromptSubmit / SessionStart / SessionEnd / Stop / SubagentEnd{"hooks":{...}} 信封会被静默跳过。
  • Windows 的 shell 工具名是 pwsh,Unix 是 bash;matcher 管道精确匹配 bash|pwshif 用权限规则语法(如 Read(*.md))。

决策 JSON(只在 PreToolUse 有拦截效果)

deny(工具被挡,模型看到 Error: <reason>):

{ "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "deny",
    "permissionDecisionReason": "请改用单个文件删除或先归档"
} }
  • permissionDecisiondeny(拦截,官方失败卡)/ ask(走审批通道)/ allow(显式放行)。
  • permissionDecisionReason写给模型看的——拼成 Error: <reason> 引导它换正当做法。
  • deny/ask 只在 PreToolUse 消费;PostToolUse/SessionStart 等只消费 additionalContext

Windows / 沙箱的现实(最容易翻车)

  • 本机(Windows)的 commandWindows PowerShell 解释,不是 bash。按 PowerShell 语法写:& '脚本.ps1'(调用算子)、单引号包路径。
  • Workspace Write 等受限沙箱会拒拉工作区外的外部 exe(例如 Git Bash,实测报 Win32 error 5)→ 决策 hook 命令失败 = 该 hook 静默失效(fail-open,最危险)。
  • 稳妥做法:脚本放工作区内进程内执行——PowerShell & '工作区/guard.ps1'(读 stdin:[Console]::In.ReadToEnd(),写 stdout:[Console]::Out.WriteLine(...),记得设 UTF-8)。或 node
  • 写完先确认它真的被调用:让会话跑一条无害命令,去 GET /dsh-hooks/recent 看该 hook 记录 status=0;否则它根本没在跑。

Read the full file on GitHub · 79 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 79 lines · 112 tokens per session scan A ba545e634fe2

Subscribe to this mod's changes

dsh-hooks-authoring is a skill published in the GitHub repository KYinCode/dsh-hooks-plugin (4 stars, last pushed 18d ago), licensed MIT. It adds 112 tokens to every session and 1,444 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

playlet-wechat-feed

A daily report of popular short-drama articles from WeChat public accounts, a Chinese publishing platform, grouped by story themes and accompanied by writing insights.

redfox-data/redfox-community-dsh · 269 tokens

xiaohongshu-search

A tool for searching and ranking popular Xiaohongshu posts, a Chinese social content platform. It uses keywords, engagement, relevance, and recency to recommend content and related search directions.

redfox-data/redfox-community-dsh · 61 tokens

playlet-bili-feed

A daily tracker for popular short-drama content on Bilibili, a Chinese video-sharing website. It groups popular videos by topic and produces an HTML report, a web page that can display the results visually.

redfox-data/redfox-community-dsh · 203 tokens

playlet-xhs-feed

A daily tracker for popular short-drama posts on Xiaohongshu, a Chinese social-media platform. It groups posts by story themes and creates an HTML report with covers, interaction data, links, and writing insights.

redfox-data/redfox-community-dsh · 184 tokens

wechat-search

A search tool for popular articles on WeChat public accounts. It ranks results using relevance, popularity, and freshness, and can expand the search period when too few results are found.

redfox-data/redfox-community-dsh · 53 tokens

douyin-prohibited-word

A Chinese-language checker for Douyin, a short-video platform, that finds prohibited or sensitive words in copy, files, images, and web pages and suggests replacements.

redfox-data/redfox-community-dsh · 84 tokens