PostToolUse

PostToolUse is a hook for Claude Code from mhylle/claude-skills-collection. Its token cost is not measured, scanned A, a copy of AfterTool, MIT.

A collection of commands that run automatically after selected coding-agent actions, such as shell commands or edits to JavaScript and TypeScript files.

In plain words
What is it for?
Use it to log newly created GitHub pull requests and run configured follow-up processing after edits to supported source files.
Why use it?
It can record results or perform follow-up checks after matching actions, reducing the need to repeat those steps manually.

Hook for Claude Code

Written for Claude Code: PostToolUse hook event. Also seen: positional $N argument.

Part of the devflow plugin — 38 skills, 13 agents, 5 hooks shipped together

One of 5 entries in hooks.json upstream. Installing this one merges just its entry into your config; the other 4 are separate, each on its own page.

Good fit Use it to log newly created GitHub pull requests and run configured follow-up processing after edits to supported source files.

Compare 6 hooks from other repositories ↓
Install with agentmods
npx agentmods add hooks/mhylle/claude-skills-collection/post-tool-use
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.

Clone the repo
git clone --depth 1 https://github.com/mhylle/claude-skills-collection

Made for: Claude Code.

Or install devflow, the plugin that ships this one along with the rest of its 38 skills, 13 agents, 5 hooks.

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 PostToolUse

README.md
[![agentmods](https://agentmods.dev/badge/hooks/mhylle/claude-skills-collection/post-tool-use/github.svg)](https://agentmods.dev/hooks/mhylle/claude-skills-collection/post-tool-use)
Your own site
<a href="https://agentmods.dev/hooks/mhylle/claude-skills-collection/post-tool-use"><img src="https://agentmods.dev/badge/hooks/mhylle/claude-skills-collection/post-tool-use/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for PostToolUse

Your own site · 80×15
<a href="https://agentmods.dev/hooks/mhylle/claude-skills-collection/post-tool-use"><img src="https://agentmods.dev/badge/hooks/mhylle/claude-skills-collection/post-tool-use.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session not measured What this adds to a session before it is invoked.
When invoked not measured Not applicable: nothing here is loaded into a session.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 86% copy Near-identical to another mod in the catalogue.
Security

Grade A, and why

PostToolUse scanned grade A with 1 finding 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 10d ago.

A static scan of the commands this hook runs, not an audit. A hook is shell that executes on your machine at the event it names, which is why every command in it is printed with what was found.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

"command": "node -e \"const{execSync}=require('child_process');const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const p=i.tool_input?.file_path;if(p&&fs.e
Origin

This is a copy

86% identical to AfterTool — 30 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

hooks/hooks.json · 44 lines

How it starts

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

{
  "PostToolUse": [
    {
      "matcher": "tool == \"Bash\" && tool_input.command matches \"gh pr create\"",
      "hooks": [
        {
          "type": "command",
          "command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const cmd=i.tool_input?.command||'';if(/gh pr create/.test(cmd)){const out=i.tool_output?.output||'';const m=out.match(/https:\\/\\/github.com\\/[^/]+\\/[^/]+\\/pull\\/\\d+/);if(m){console.error('[Hook] PR created: '+m[0]);const repo=m[0].replace(/https:\\/\\/github.com\\/([^/]+\\/[^/]+)\\/pull\\/\\d+/,'$1');const pr=m[0].replace(/.*\\/pull\\/(\\d+)/,'$1');console.error('[Hook] To review: gh pr review '+pr+' --repo '+repo)}}console.log(d)})\""
        }
      ],
      "description": "Log PR URL and provide review command after PR creation"
    },
    {
      "matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx|js|jsx)$\"",
      "hooks": [
        {
          "type": "command",
          "command": "node -e \"const{execSync}=require('child_process');const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const p=i.tool_input?.file_path;if(p&&fs.existsSync(p)){try{execSync('npx prettier --write \"'+p+'\" 2>/dev/null',{stdio:['pipe','pipe','pipe']})}catch(e){}}console.log(d)})\""
        }
      ],
      "description": "Auto-format JS/TS files with Prettier after edits"
    },
    {
      "matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx)$\"",
      "hooks": [
        {
          "type": "command",
          "command": "node -e \"const{execSync}=require('child_process');const fs=require('fs');const path=require('path');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const p=i.tool_input?.file_path;if(p&&fs.existsSync(p)){let dir=path.dirname(p);while(dir!==path.dirname(dir)&&!fs.existsSync(path.join(dir,'tsconfig.json'))){dir=path.di

Read the full file on GitHub · 44 lines

Same file

What else hooks.json configures

This page is one entry in a file that holds 5. Installing the file brings all of them; each is measured and scanned on its own page.

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. 10d ago First seen · 44 lines scan A 761fd22e70c3

Subscribe to this mod's changes

PostToolUse is a hook published in the GitHub repository mhylle/claude-skills-collection (18 stars, last pushed 7d ago), licensed MIT. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it A with 1 finding (runs shell commands). It is 86% identical to AfterTool, differing in 30 lines, and is treated as a copy.