Truth in IT
    • Sign In
    • Register
        • Videos
        • Channels
        • Pages
        • Galleries
        • News
        • Events
        • All
Truth in IT Truth in IT
  • Data Management ▼
    • Converged Infrastructure
    • DevOps
    • Networking
    • Storage
    • Virtualization
  • Cybersecurity ▼
    • Application Security
    • Backup & Recovery
    • Data Security
    • Identity & Access Management (IAM)
    • Zero Trust
    • Compliance & GRC
    • Endpoint Security
  • Cloud ▼
    • Hybrid Cloud
    • Private Cloud
    • Public Cloud
  • Webinar Library
  • TiPs
  • DRAW

Snyk: Setting Up Security Hooks in Claude Code VS Code

Snyk
07/05/2026
0 (0%)
Share
  • Comments
  • Download
  • Transcript
Report Like Favorite
  • Share/Embed
  • Email
Link
Embed

Transcript


I'm going to open up my settings JSON file within the Claude folder, and I'm going to add a new keyword here. I'm going to paste it in, hooks. So what I pasted in is two different hooks for the purposes that I'm looking to achieve here. One is a pre-tool use, and one is a post-tool use. For the pre-tool use, I want it to match on any bash actions that the agentic coding tool is trying to do within that type of scope. And before it goes ahead and uses or runs some bash command, I want it to actually run this command, which is local to my project here. And you can see I'm referencing .claude hooks sneak-pre-commit-gate.sh. So I wrote a shell script. So I'm going to paste in my shell script here. And this is actually something that I pulled directly from Snyk that is part of Snyk Studio Recipes. So now we have a script in place that can check to see if a commit is about to be executed and run some actions before we allow that to go through. When it comes to the post-tool use hook that I have set up here, I'm matching on any time a file had modifications to it, which is what the edit keyword is there, or if a new file is written or we write to a new file, we being the agentic coding tool here. And if that happens, the hook we want to run is a command. And it's going to be this other shell script. And very similarly here, I pulled this from our Studio Recipes repository for demonstration purposes. So with both those in place, now I have a guaranteed deterministic way that security checks will happen either before the model tries to make a commit to my branch in my project here or during code changes that are happening.

TL;DR

  • Claude Code hooks are configured in the project's settings JSON file inside the .claude folder, allowing project-scoped security automation.
  • A pre-tool use hook intercepts bash commands from the AI agent and runs a Snyk security check before execution proceeds.
  • A post-tool use hook triggers on file edits or new file writes, running a second Snyk script from the Studio Recipes repository.

Summary

This short tutorial demonstrates how to configure pre-tool use and post-tool use hooks within a Claude Code project scoped to Visual Studio Code. The presenter walks through editing the settings JSON file inside the .claude folder to add two distinct hooks: a pre-tool use hook that intercepts any bash commands the agentic coding tool attempts to execute, triggering a Snyk-provided shell script called snyk-pre-commit-gate.sh before the command runs; and a post-tool use hook that fires whenever a file is edited or a new file is written, executing a second shell script sourced from Snyk's open-source Studio Recipes repository. Together, these hooks create a deterministic security gate that ensures Snyk vulnerability checks run automatically — either before a commit is pushed to the project branch or immediately after code modifications are made by the AI agent. The approach requires no manual intervention once configured, making it a practical pattern for teams looking to embed security scanning directly into AI-assisted development workflows without relying on developer discipline alone.

Chapters

0:00 - Opening Settings JSON
0:10 - Pre-Tool Use Hook Setup
0:58 - Post-Tool Use Hook Setup
1:27 - Deterministic Security Gate Result

Key Quotes

0:15 "One is a pre-tool use, and one is a post-tool use."
0:44 "This is actually something that I pulled directly from Snyk that is part of Snyk Studio Recipes."
1:29 "Now I have a guaranteed deterministic way that security checks will happen either before the model tries to make a commit to my branch in my project here or during code changes that are happening."

FAQ

Where do you configure hooks for a Claude Code project in VS Code?

Hooks are added to the settings JSON file located inside the .claude folder within your project directory. You add a 'hooks' key containing your pre-tool use and post-tool use hook definitions.

Where can I find the Snyk shell scripts used in this demo?

Both shell scripts — including snyk-pre-commit-gate.sh — are available in Snyk's open-source Studio Recipes repository on GitHub at github.com/snyk/studio-recipes.


Categories:
  • » Cybersecurity » Application Security
  • » Data Protection
Channels:
News:
Events:
Tags:
  • DevSecOps
  • Application Security
  • How-To
  • Demo
  • Getting Started
  • Claude Code hooks
  • Agentic coding security
  • Pre-commit security gates
  • VS Code project configuration
  • Snyk Studio Recipes
  • DevSecOps automation
  • AI-assisted development
Show more Show less

Browse videos

  • Related
  • Featured
  • By date
  • Most viewed
  • Top rated
  •  

              Video's comments: Snyk: Setting Up Security Hooks in Claude Code VS Code

              XStreaminars (watch here)

              • Jul
                28

                Illumio + Netskope: Zero Trust in the Age of AI Autonomy

                07/28/202601:00 PM ET
                • Jul
                  29

                  Ask Your Cloud Anything: Unlocking Governance Silos in your Environments

                  07/29/202601:00 PM ET
                  More events

                  Industry Events (watch there)

                  • Jul
                    14

                    Crafting a Championship-Caliber Security Team for Lasting Defense

                    07/14/202601:00 PM ET
                    • Jul
                      14

                      Understanding the Crucial Role of Context in Safeguarding AI-Accessible Data

                      07/14/202602:00 PM ET
                      • Jul
                        22

                        Insights from Attackers During the FIFA World Cup: A HUMAN Dialogue

                        07/22/202601:00 PM ET
                        More events

                        Upcoming Webinar Calendar

                        • 07/14/2026
                          01:00 PM
                          07/14/2026
                          Crafting a Championship-Caliber Security Team for Lasting Defense
                          https://www.truthinit.com/index.php/channel/2025/crafting-a-championship-caliber-security-team-for-lasting-defense/
                        • 07/14/2026
                          02:00 PM
                          07/14/2026
                          Understanding the Crucial Role of Context in Safeguarding AI-Accessible Data
                          https://www.truthinit.com/index.php/channel/2037/understanding-the-crucial-role-of-context-in-safeguarding-ai-accessible-data/
                        • 07/21/2026
                          04:00 AM
                          07/21/2026
                          Strategies for Managing AI Governance and Securing App-to-LLM API Traffic
                          https://www.truthinit.com/index.php/channel/1967/strategies-for-managing-ai-governance-and-securing-app-to-llm-api-traffic/
                        • 07/22/2026
                          06:30 AM
                          07/22/2026
                          Insights and Strategies in Data Protection and Privacy Management
                          https://www.truthinit.com/index.php/channel/2000/insights-and-strategies-in-data-protection-and-privacy-management/
                        • 07/22/2026
                          01:00 PM
                          07/22/2026
                          Insights from Attackers During the FIFA World Cup: A HUMAN Dialogue
                          https://www.truthinit.com/index.php/channel/2029/insights-from-attackers-during-the-fifa-world-cup-a-human-dialogue/
                        • 07/28/2026
                          01:00 PM
                          07/28/2026
                          Illumio + Netskope: Zero Trust in the Age of AI Autonomy
                          https://www.truthinit.com/index.php/channel/2031/illumio-netskope-zero-trust-in-the-age-of-ai-autonomy/
                        • 07/29/2026
                          04:00 AM
                          07/29/2026
                          Real-Time Strategies for Safeguarding Against Prompt Injections
                          https://www.truthinit.com/index.php/channel/1968/real-time-strategies-for-safeguarding-against-prompt-injections/
                        • 07/29/2026
                          01:00 PM
                          07/29/2026
                          Ask Your Cloud Anything: Unlocking Governance Silos in your Environments
                          https://www.truthinit.com/index.php/channel/2048/ask-your-cloud-anything-unlocking-governance-silos-in-your-environments/
                        • 08/19/2026
                          12:00 PM
                          08/19/2026
                          Becoming Agent Ready: Insights from Cyera's Expertise
                          https://www.truthinit.com/index.php/channel/2036/becoming-agent-ready-insights-from-cyeras-expertise/
                        • 09/02/2026
                          12:00 PM
                          09/02/2026
                          Unified Data Security in Action: Uncover, Analyze, and Resolve Threats
                          https://www.truthinit.com/index.php/channel/2045/unified-data-security-in-action-uncover-analyze-and-resolve-threats/
                        • 09/30/2026
                          04:00 AM
                          09/30/2026
                          AI Command Center: Optimizing Visibility and Control in Your Operations
                          https://www.truthinit.com/index.php/channel/2024/ai-command-center-optimizing-visibility-and-control-in-your-operations/
                        Truth in IT
                        • Sponsor
                        • About Us
                        • Terms of Service
                        • Privacy Policy
                        • Contact Us
                        • Preference Management
                        Desktop version
                        Standard version