/lstack:code-analysis-setupfrom lstack
Plans and installs free static analysis tools (linters, SAST, secret scanning, dependency scanning) across repos, merging into existing hooks and CI. Shows plan first, writes nothing without approval.
Ships in lstack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Analyse one or more existing projects, then plan a static code analysis layer built only from free and open-source tools: linters, SAST, secret scanning and dependency scanning. Fast, staged-file checks go in the pre-commit hook within a time budget; full scans go in CI or on a schedule. The plan is shown first and nothing is written until the user approves it. After approval the skill merges into the hook manager and CI each project already uses, adds baselines so existing findings do not block day one, then times the hook.
| The user says | Do |
|---|---|
| "Set up linting and security scanning for these repos" | The full workflow, one plan for every project |
| "Add static analysis to our pre-commit hook without slowing commits" | The full workflow with the hook budget the user names |
| "What analyzers should this project run?" | Steps 1 to 3 only: the plan, no install |
Not for: installing the security-setup stack in one repo (security-setup), building or speeding up CI/CD pipelines (devops-pipeline), reviewing code by hand (code-review), or responding to a leaked secret (incident response).
git. The hook manager a project already uses (pre-commit, husky, lefthook), or pre-commit when it has none.GITHUB_TOKEN a workflow already has. Licences come from references/tool-catalog.md. Bearer (Elastic License 2.0) is not open source: off by default, offered only for an app that handles personal data, and labelled as such. CodeQL is offered only for public GitHub repos.references/merge-and-baseline.md.security-check pre-commit hook, scripts/security_check.py or security/security-tools.json means the tools that JSON lists (and its CI workflow) already cover their category. The plan adds no second copy of those tools and says why.--help or docs for the installed version; otherwise the plan marks them verify on install.The sync runs only after the user approves the plan and before the first write, once per repository the plan writes to. It never runs during Steps 1 to 3. The plan shows, per repo, the sync it will run or why it is skipped.
repo="<git toplevel>"
if ! git -C "$repo" remote get-url origin >/dev/null 2>&1; then
echo "sync: skipped (no origin)"
elif [ "$(git -C "$repo" rev-parse --abbrev-ref HEAD)" = "HEAD" ]; then
echo "sync stopped: detached HEAD" >&2 # stop this repo's install and ask
else
branch="$(git -C "$repo" rev-parse --abbrev-ref HEAD)"
stashed=0
if [ -n "$(git -C "$repo" status --porcelain)" ]; then
before="$(git -C "$repo" rev-parse -q --verify refs/stash)"
git -C "$repo" stash push -u -m "code-analysis-setup pre-sync" &&
[ "$(git -C "$repo" rev-parse -q --verify refs/stash)" != "$before" ] && stashed=1
fi
if git -C "$repo" fetch origin && git -C "$repo" pull --rebase origin "$branch"; then
[ "$stashed" -eq 1 ] && git -C "$repo" stash pop --index
else
echo "sync failed on $branch (stashed=$stashed)" >&2
fi
fi
A repo without origin records sync: skipped (no origin), as the plan stated, and continues. For a repo with origin: a detached HEAD, or a failed fetch, pull, rebase or stash pop, stops that repo's install and asks the user. Before stopping, run git rebase --abort if a rebase is in progress, then git stash pop once if stashed=1. stashed=1 only when refs/stash changed, so a dirty submodule (nothing stashed) never pops an older stash of the user's.
For each input, follow references/project-analysis.md:
git -C <input> rev-parse --show-toplevel.
git status --porcelain --untracked-files=all as the pre-sync dirty list. Those paths are the user's work: never stage or time them, and never edit them except by an item approved by ID (Step 2).Use references/tool-catalog.md and references/merge-and-baseline.md:
dirty: only approval of its ID covers it, not approve all. Otherwise it is left out and reported.The plan is a dry-run preview: it lists every file, hook entry, CI job, install and baseline, and changes nothing. Print it in the format of references/plan-template.md, then ask one question: approve all, approve some (by item ID), change something, or stop. Then wait.
git stash list stay unchanged, and no fetch or pull runs. Report BLOCKED.PARTIAL Final Report in place of waiting; write and run nothing.Per repository, in plan order:
dirty item stays unwritten and is reported. Merge hook entries into the existing hook manager and CI jobs into the repo's workflows by the rules in references/merge-and-baseline.md: append, dedup, keep existing order and settings.references/merge-and-baseline.md → Baselines says: secrets as fingerprints or hashes, never values. The user confirms each finding (redacted); a likely real secret is reported to rotate. Temporary reports go outside the repo and are deleted. A baseline that quotes source is written there first and copied in only after its secret scan and the user's yes.Follow references/merge-and-baseline.md → Timing:
pre-commit install-hooks). Report this as setup time, not hook time.git write-tree and git status --porcelain.timing: skipped (no clean tracked files).pre-commit run --files <sample>, or each tool's own command). Never time through lint-staged or another staging wrapper, and never git add. A staged-diff scanner (the gitleaks hook) is reported as not measured (staged-diff scanner).git read-tree <saved tree>, git checkout -- <sample>) and report it. When the invariant cannot be guaranteed, print timing: skipped (<reason>) instead of timing.gitleaks git one limited to --log-opts="--branches --remotes --tags", refs a CI checkout can hold), the hook's matching tree scan over tracked files only (an index export, references/merge-and-baseline.md → gitleaks; the staged-diff hook command passes trivially with nothing staged), and every other baselined tool on the baselined repo; each must exit 0. A finding in a gitignored or untracked file, or in a commit no branch, remote or tag contains (a stash), is reported as local-only, not committed, never baselined. A file merely existing is not proof.End every run, stops included, with four lines: Result:, Evidence:, Uncertainty:, Decision:.
COMPLETE: every approved item was installed, the acceptance check passed, and the hook was timed (or timing: skipped with a reason).PARTIAL: no user approved the plan, the user approved part, a repo's sync stopped, or a check failed.BLOCKED: nothing was written: the plan was rejected, or the request is out of scope.Expected output of a full run:
Result: COMPLETE. 2 repos: api (ruff, bandit, gitleaks merged into .pre-commit-config.yaml; semgrep + osv-scanner in .github/workflows/code-analysis.yml) and web (eslint via .husky/pre-commit; osv-scanner weekly).
Evidence: setup 41 s (warm-up); hook 2.3 s on 4 files (budget 10 s); gitleaks CI command and hook-side tree scan exit 0 with .gitleaksignore (3 fingerprints, values REDACTED); write-tree and status unchanged; sync: api pulled main, web skipped (no origin).
Uncertainty: semgrep CI time not measured locally; gitleaks hook not measured (staged-diff scanner); 1 bandit finding baselined in tests/ needs review.
Decision: Review and commit the changes in both repos; rotate nothing (no real secret found).
More examples and the step report format: references/plan-template.md.
core.hooksPath and a .pre-commit-config.yaml also exists): keep the manager that git actually calls, and add entries there. Never install a second manager over it.git stash list unchanged.git write-tree and git status --porcelain unchanged, or reports why it was skipped or restored.After each step, print a compact status block with √ and × check lines and a Result: PASS | FAIL | PARTIAL line. Format: references/plan-template.md → Step reports.
Optional and propose-only. After the result is delivered:
references/.metadata.version. Commit nothing unless asked.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
static-analysis, linting, sast, secret-scanning, dependency-scanning, pre-commit
20 skills in this plugin
/agent-configCreate, update, or audit AGENTS.md (default) or CLAUDE.md agent instructions: set up, prune, add a rule, or merge CLAUDE.md or .cursorrules into one file Claude Code, Codex, and Cursor all read. Don't use for READMEs, skills, or subagents./auto-pushGenerate a commit message, stage all changes, and push to remote after scanning for secrets, large files, and protected-branch risks. Skip for opening PRs, code review, or cutting releases/tags./cleanup-projectPrepare a git repo before new work: review uncommitted changes, fix .gitignore, delete merged branches, end on clean main, or inspect one branch before deciding. Don't use for dead code, commit-and-push, releases, LICENSE files, or git how-tos.npx claudepluginhub luongnv89/skills --plugin lstackOther plugins' skills for the same job