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
In this repository36 other files it gives its agents.
- skills/backend-best-practices/AGENTS.mdAGENTS.md
- adr-writerSkill
- application-healthchecksSkill
- backend-best-practicesSkill
- bspec-prd-discoverySkill
- bspec-story-implementationSkill
- bspec-story-reviewSkill
- bspec-story-syncSkill
- bspec-technical-architectureSkill
- bspec-workflowSkill
- conventional-commitsSkill
- copier-scaffoldSkill
- devenvSkill
- direnvSkill
- docker-composeSkill
- dockerfileSkill
- docker-setupSkill
- docs-writerSkill
- github-actions-dockerSkill
- golang-developmentSkill
- golang-slogSkill
- golang-testingSkill
- playwright-devenvSkill
- project-webappSkill
- readme-writerSkill
- release-drafter-setupSkill
- release-drafterSkill
- release-notesSkill
- renovate-pr-triageSkill
- renovate-setupSkill
- structured-loggingSkill
- summarize-articleSkill
- summarize-youtube-videoSkill
- tailwind-v4Skill
- vicinae-extensionsSkill
- zensical-setupSkill
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
- Distinctive: line 10
Use this skill when asked to "add gitleaks", "add secret scanning", "set up gitleaks" on a project that already exists (not a fresh …
- Very specific: line 22
Check for .github/workflows/gitleaks.yml, .gitleaks.toml, lefthook.yml/lefthook.yaml, .pre-commit-config.yaml, Taskfile.yml/Taskfile.yaml, …
- Distinctive: line 23
If present, read it, summarize what's there, ask whether to leave, extend, or replace before touching it.
- Very specific: line 66
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 …
- Very specific: line 87
If the Taskfile has a ci or check/test aggregate task that runs other linters, add gitleaks as a dependency there too (deps: [gitleaks]) …
- Distinctive: line 109
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.
- Very specific: line 112
Run gitleaks detect --source .
- Distinctive: line 113
If findings turn up, report them — do not decide unilaterally to add them to an allowlist to make CI green.
- Very specific: line 114
If a Taskfile task was added, run it (task gitleaks) to confirm it works.
- Very specific: line 115
If a hook was added, confirm the hook manager is installed/initialized (lefthook install / pre-commit install) — a hook config with no …
- Distinctive: line 119
Not for bulk/multi-repo rollout — that's a scripted codemod (e.g.
- Very specific: line 120
Not for scaffolding a brand-new repo — use the project's normal bootstrap flow (e.g.
≈ “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.
Files
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.ymlyet 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
- 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.
- Check for
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: 0is required — gitleaks scans full history by default; shallow checkout produces false negatives.Config file — only add
.gitleaks.tomlif 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/.*''', ]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.yamlexists (or user picks lefthook): add/merge apre-commitcommand — don't clobber existing commands under that hook.pre-commit: commands: gitleaks: run: gitleaks protect --staged --verbose --redactIf lefthook isn't installed yet, note it needs
lefthook installonce locally (or add that call to the Taskfile/devenv setup task from step 5/6).If
.pre-commit-config.yamlexists (or user picks pre-commit):- repo: https://github.com/gitleaks/gitleaks rev: v8.21.2 # check latest tag before pinning hooks: - id: gitleaksTaskfile task — if
Taskfile.yml/Taskfile.yamlexists, add agitleaks(orsecurity: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 -vIf the Taskfile has a
ciorcheck/testaggregate task that runs other linters, addgitleaksas a dependency there too (deps: [gitleaks]) only if that matches the existing pattern for other scanners.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 topackages:{ 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.
- Verify before finishing:
- Run
gitleaks detect --source . -vlocally 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.
- Run
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-webappskill or copier template) and bake gitleaks into that instead.
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
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.

