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

              Industry Events (Sponsor Hosted)

              • Oct
                13

                Ensuring Compliance Through Audit Evidence: From CJIS to FERPA

                10/13/202601:00 PM ET
                • Oct
                  15

                  Risk in Real Time Demo Series: Virtual Patching: Protection at the Speed of Exploitation

                  10/15/202611:00 AM ET
                  • Oct
                    20

                    Harnessing Data Governance for AI with Cyera and Snowflake

                    10/20/202611:00 AM ET
                    More events

                    Upcoming Webinar Calendar

                    • 10/13/2026
                      01:00 PM
                      10/13/2026
                      Ensuring Compliance Through Audit Evidence: From CJIS to FERPA
                      https://www.truthinit.com/index.php/channel/2159/ensuring-compliance-through-audit-evidence-from-cjis-to-ferpa/
                    • 10/15/2026
                      11:00 AM
                      10/15/2026
                      Risk in Real Time Demo Series: Virtual Patching: Protection at the Speed of Exploitation
                      https://www.truthinit.com/index.php/channel/1372/risk-in-real-time-demo-series-the-autonomous-era-orchestrating-a-resilient-enterprise/
                    • 10/20/2026
                      11:00 AM
                      10/20/2026
                      Harnessing Data Governance for AI with Cyera and Snowflake
                      https://www.truthinit.com/index.php/channel/2137/harnessing-data-governance-for-ai-with-cyera-and-snowflake/
                    • 10/27/2026
                      01:00 PM
                      10/27/2026
                      The HUMAN Experience: Real-Time Insights into Page Intelligence
                      https://www.truthinit.com/index.php/channel/2139/the-human-experience-real-time-insights-into-page-intelligence/
                    • 11/04/2026
                      11:00 AM
                      11/04/2026
                      Leveraging CISA’s Zero Trust Maturity Model for an AI-Driven Landscape
                      https://www.truthinit.com/index.php/channel/2149/leveraging-cisas-zero-trust-maturity-model-for-an-ai-driven-landscape/
                    • 11/05/2026
                      01:00 PM
                      11/05/2026
                      HUMAN Dialogue: Redefining Authentic Trust in the Agentic Internet
                      https://www.truthinit.com/index.php/channel/2160/human-dialogue-redefining-authentic-trust-in-the-agentic-internet/
                    • 11/19/2026
                      01:00 PM
                      11/19/2026
                      360View: Govern, Secure & Recover Your Microsoft 365 Environment
                      https://www.truthinit.com/index.php/channel/2076/360view-govern-secure-recover-your-microsoft-365-environment/
                    Truth in IT
                    • Sponsor
                    • About Us
                    • Terms of Service
                    • Privacy Policy
                    • Contact Us
                    • Preference Management
                    Desktop version
                    Standard version