agentleFS
brpazbrpaz/agent-skills/skills/gitleaks-setup/SKILL.md

gitleaks-setup

Skill1 starsChanged 7 months agoMITView on GitHub

Add or update Gitleaks secret-scanning to an existing repo — GitHub Action workflow, .gitleaks.toml, hook via lefthook/pre-commit, Taskfile task, devenv/mise tool pin — idempotently, without clobbering existing config.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 5 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Use this skill when asked to "add gitleaks", "add secret scanning", "set up gitleaks" on a project that already exists (not a fresh …

    line 10
  2. Very specific:

    Check for .github/workflows/gitleaks.yml, .gitleaks.toml, lefthook.yml/lefthook.yaml, .pre-commit-config.yaml, Taskfile.yml/Taskfile.yaml, …

    line 22
  3. Distinctive:

    If present, read it, summarize what's there, ask whether to leave, extend, or replace before touching it.

    line 23
  4. Very specific:

    If lefthook isn't installed yet, note it needs lefthook install once locally (or add that call to the Taskfile/devenv setup task from step …

    line 66
  5. Very specific:

    If the Taskfile has a ci or check/test aggregate task that runs other linters, add gitleaks as a dependency there too (deps: [gitleaks]) …

    line 87
  6. Distinctive:

    Only touch these if the file already exists — don't introduce devenv or mise into a repo that isn't using them just to install one CLI.

    line 109
  7. Very specific:

    Run gitleaks detect --source .

    line 112
  8. Distinctive:

    If findings turn up, report them — do not decide unilaterally to add them to an allowlist to make CI green.

    line 113
  9. Very specific:

    If a Taskfile task was added, run it (task gitleaks) to confirm it works.

    line 114
  10. Very specific:

    If a hook was added, confirm the hook manager is installed/initialized (lefthook install / pre-commit install) — a hook config with no …

    line 115
  11. Distinctive:

    Not for bulk/multi-repo rollout — that's a scripted codemod (e.g.

    line 119
  12. Very specific:

    Not for scaffolding a brand-new repo — use the project's normal bootstrap flow (e.g.

    line 120

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Gitleaks Setup — retrofit secret scanning onto an existing repo

Use this skill when asked to "add gitleaks", "add secret scanning", "set up gitleaks" on a project that already exists (not a fresh scaffold).

When to Use

  • Repo has no .github/workflows/gitleaks.yml yet and user wants CI secret scanning.
  • Repo has gitleaks already but config looks stale/default and user wants it reviewed.
  • User wants a local hook (lefthook or pre-commit) in addition to (or instead of) CI.
  • Repo has a Taskfile, devenv, or mise config that should gain a gitleaks task/tool pin.

Procedure

  1. Detect existing setup first — never blind-overwrite.
    • Check for .github/workflows/gitleaks.yml, .gitleaks.toml, lefthook.yml/lefthook.yaml, .pre-commit-config.yaml, Taskfile.yml/Taskfile.yaml, devenv.nix/devenv.yaml, and .mise.toml/mise.toml.
    • If present, read it, summarize what's there, ask whether to leave, extend, or replace before touching it.
    • Hook tooling: prefer whichever is already in the repo (lefthook vs pre-commit). Don't introduce a second hook manager. If neither exists, ask which the user wants, or default to lefthook for non-Python repos / pre-commit for Python repos.
  2. CI workflow — add .github/workflows/gitleaks.yml:

    name: gitleaks
    on: [push, pull_request]
    jobs:
      scan:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
            with:
              fetch-depth: 0
          - uses: gitleaks/gitleaks-action@v2
            env:
              GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

    fetch-depth: 0 is required — gitleaks scans full history by default; shallow checkout produces false negatives.

  3. Config file — only add .gitleaks.toml if the repo needs custom allowlisting (test fixtures, known false-positive patterns, vendored files). Don't add a boilerplate config with nothing in it; default gitleaks rules are fine without one.

    [allowlist]
    description = "project-specific false positives"
    paths = [
      '''testdata/.*''',
    ]
  4. Local hook — only if the project already uses a hook manager, or the user explicitly asks for local enforcement, not just CI.

    If lefthook.yml/lefthook.yaml exists (or user picks lefthook): add/merge a pre-commit command — don't clobber existing commands under that hook.

    pre-commit:
      commands:
        gitleaks:
          run: gitleaks protect --staged --verbose --redact

    If lefthook isn't installed yet, note it needs lefthook install once locally (or add that call to the Taskfile/devenv setup task from step 5/6).

    If .pre-commit-config.yaml exists (or user picks pre-commit):

    - repo: https://github.com/gitleaks/gitleaks
      rev: v8.21.2   # check latest tag before pinning
      hooks:
        - id: gitleaks
  5. Taskfile task — if Taskfile.yml/Taskfile.yaml exists, add a gitleaks (or security:gitleaks) task rather than expecting users to remember the raw CLI invocation. Match the naming/namespacing convention already used by other tasks in the file.

    tasks:
      gitleaks:
        desc: Scan repo for leaked secrets
        cmds:
          - gitleaks detect --source . --redact -v

    If the Taskfile has a ci or check/test aggregate task that runs other linters, add gitleaks as a dependency there too (deps: [gitleaks]) only if that matches the existing pattern for other scanners.

  6. devenv / mise tool pin — if the repo manages its toolchain via one of these, pin gitleaks there instead of (or in addition to) leaving install to the CI step:

    devenv (devenv.nix): add to packages:

    { pkgs, ... }: {
      packages = [
        pkgs.gitleaks
        # ...existing packages
      ];
    }

    mise (.mise.toml / mise.toml): add under [tools]:

    [tools]
    gitleaks = "latest"   # or pin an exact version, e.g. "8.21.2"

    Only touch these if the file already exists — don't introduce devenv or mise into a repo that isn't using them just to install one CLI.

  7. Verify before finishing:
    • Run gitleaks detect --source . -v locally if the CLI is available, to confirm the repo passes clean (or surface pre-existing findings to the user rather than silently shipping a red CI job).
    • If findings turn up, report them — do not decide unilaterally to add them to an allowlist to make CI green.
    • If a Taskfile task was added, run it (task gitleaks) to confirm it works.
    • If a hook was added, confirm the hook manager is installed/initialized (lefthook install / pre-commit install) — a hook config with no installed manager silently does nothing.

Non-Goals

  • Not for bulk/multi-repo rollout — that's a scripted codemod (e.g. octoherd) job, not a per-repo interactive skill.
  • Not for scaffolding a brand-new repo — use the project's normal bootstrap flow (e.g. project-webapp skill or copier template) and bake gitleaks into that instead.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.