Format with google-java-format · Hooks for Cursor | Prompt Studio
    1. Cursor
    2. Hooks
    3. Format with google-java-format
    Cursor · HooksFormato

    Format with google-java-format

    Formats Java every time the agent edits.

    by Prompt Studio

    hooksafterFileEdit

    License: MITView original

    Contents

    Where it goes: .cursor/hooks.json

    {
      "version": 1,
      "hooks": {
        "afterFileEdit": [
          {
            "command": "bash -c 'f=$(jq -r .file_path); echo \"$f\" | grep -Eq -e \"[.]java\" && google-java-format -i \"$f\" >/dev/null 2>&1; exit 0'"
          }
        ]
      }
    }
    

    More in Hooks

    • Block dangerous commands

      Stops rm -rf, git push --force and similar before they run.

    • Protect .env

      Prevents the agent from reading files with secrets.

    • Format on edit

      Runs Prettier on every file the agent edits.

    • Lint on stop

      Runs the linter when the agent finishes its turn.

    • Notify when done

      Desktop notification when the agent finishes (macOS).

    • Command log

      Saves every agent command to .cursor/audit.log.

    See all in Hooks (506) →

    Your ultimate collection of AI prompts. Gather inspiration, explore examples, and create with AI.

    Main hubs

    • Prompts
    • Images
    • Videos
    • Generate Videos
    • Templates
    • Animations
    • Prices
    • About
    • Affiliate

    Browse by type

    • Component kits
    • Image Tags
    • Video Tags
    • Webs

    Popular topics

    • Music
    • Portfolio
    • Gaming
    • Travel
    • Nano Banana Pro

    Legal

    • Terms of Use
    • Privacy Policy
    • Cookie Policy
    • Licenses Policy
    • Refund Policy
    • Affiliate Program Terms
    • Crowdfunding Terms

    Magzin LLC, 800 Third Avenue Associates, New York, NY, 10022, United States

    © 2026 Prompt Studio by Magzin. All rights reserved.