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)

              • Aug
                27

                Becoming Agent Ready with Cyera: Essential Strategies and Insights

                08/27/202601:00 PM ET
                • Sep
                  03

                  Verge.io: Can You Afford Your Next Storage Refresh?

                  09/03/202601:00 PM ET
                  More events

                  Industry Events (Sponsor Hosted)

                  • Aug
                    27

                    Summer of Satori: FunFoneFarm's Transformation of Fraud into Seamless Integration

                    08/27/202601:00 PM ET
                    • Sep
                      23

                      Understanding Invisible Data Risks and Enhancing Your Protection Strategies

                      09/23/202601:00 PM ET
                      More events

                      Upcoming Webinar Calendar

                      • 08/27/2026
                        01:00 PM
                        08/27/2026
                        Becoming Agent Ready with Cyera: Essential Strategies and Insights
                        https://www.truthinit.com/index.php/channel/2081/becoming-agent-ready-with-cyera-essential-strategies-and-insights/
                      • 08/27/2026
                        01:00 PM
                        08/27/2026
                        Summer of Satori: FunFoneFarm's Transformation of Fraud into Seamless Integration
                        https://www.truthinit.com/index.php/channel/2086/summer-of-satori-funfonefarms-transformation-of-fraud-into-seamless-integration/
                      • 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/03/2026
                        01:00 PM
                        09/03/2026
                        Verge.io: Can You Afford Your Next Storage Refresh?
                        https://www.truthinit.com/index.php/channel/2082/verge-io-can-you-afford-your-next-storage-refresh/
                      • 09/23/2026
                        01:00 PM
                        09/23/2026
                        Understanding Invisible Data Risks and Enhancing Your Protection Strategies
                        https://www.truthinit.com/index.php/channel/2087/understanding-invisible-data-risks-and-enhancing-your-protection-strategies/
                      • 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/
                      • 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