/lagune:lagune-detect Optionally name files/dirs or a focus, or leave empty for a full scanfrom lagune
Scans code to detect security-relevant features (login, uploads, payments, data exposure) and maps findings with evidence for later phases. Supports full project, specific files, or focused scope.
Ships in lagune. 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.
The User Input above decides how this command runs. Read it before proceeding. A placeholder left unfilled above is not the input: the User Input is then the words that came with this command, or empty when there are none.
You are producing a detect map at .lagune/memory/detect.md: a record of what the system actually does that carries security weight, based on reading the code. This is detection, not invention. Record only what the code supports, with the evidence (files, routes) that later phases need to act on. Each finding is also explained in plain language with its risk, so any reader understands it.
This phase works the same way whether the project is brand new or already exists. You map whatever code is present, even if there is very little.
The User Input selects one of three modes:
If the input is ambiguous between a path and a focus, prefer the most literal reading (an existing path is a path), and state which mode you chose before continuing.
.lagune/memory/detect.md.
template.md, next to this file, first, and identify every placeholder token of the form [ALL_CAPS_IDENTIFIER]..lagune/memory/charter.md for context only, if it exists. Do not force the findings to fit the charter. Matching risks against the charter's rules is the plan phase, not this one. This phase stays a neutral detection of what the system does.This map is reconciled, never append-only. If the map was empty or freshly initialized, skip this step. Otherwise, before detecting anything new, re-check each existing finding against the current code:
A finding that verify already proved closed was stood down out of the whole chain, so it is simply absent here. That absence is expected, not a broken chain, and is no reason to run repair.
If reconciling reveals the chain is inconsistent (for example the tracking map points a finding at a file that was renamed or moved, so the path on record no longer exists), run /lagune-repair and then continue. Repair fixes Lagune's internal tracking across every phase at once, so the chain stays coherent. Do not try to repair the tracking yourself: this phase reconciles its own map in prose, repair owns the tracking.
Before you read the code, list the catalog once. This is the only read of the catalog in this phase: call lagune_read with command set to catalog.
It prints each specialization this project uses as name: tags. The list does two jobs. Its tags are search targets: each one sends you looking for that context in the code, widening the detection in Step 5. The list itself is the work list Step 6 carries forward to give every entry a verdict, so keep it whole and do not read the catalog again.
Read the code within the chosen scope and detect the things that carry security weight. What carries weight depends on what the project is, so detect from the project at hand, not from a fixed list. As a starting point, the things to look for include untrusted input and how it is validated, secrets and configuration, data storage and any exposure of sensitive data, authentication and access control where the project has users, the boundaries where the project takes input from the outside (a web request, a command-line argument, a file it reads, a public API it exports, an external or third-party call), and any place it runs commands, queries, or deserializes data. A web service, a library, a CLI, a script, and a desktop or mobile app each weight these differently. Detect from evidence in the code, not from assumption. If the scope is a described focus, concentrate on that concern.
A control the code already applies is not closed by being present. When the code validates, sanitizes, or guards input with a construct a specialization covers, that guard is presumed unproven: it goes to the matching specialization in Step 6 to prove it holds.
Specializations are focused, language-agnostic security knowledge modules that load only on demand. This step is the door to them, and it has a fixed mechanism. Do not improvise an equivalent.
Work from the list Step 4 printed, the authoritative work list. The tags are the matching signal, and they exist nowhere else.
Reach a verdict on every entry on that list, one at a time, before you write any finding. An entry marked [required] is always applied: when it ships a deterministic checker, you run that checker over the whole project and its output is the verdict, never a skip. For every other entry, the only question is whether the code you read in Step 5 contains the context its tags name, read off the code, not estimated from how relevant the entry feels:
lagune_read with command set to catalog and arguments set to ["<name>", "--phase", "detect"], and follow it, scoped to the paths in question: do what it says, do not improvise beyond it, and do not edit the user's code. Its checker's proof is the verdict over what the checker reads, and your own reading never clears it. What the specialization says its checker cannot reach, and everything a specialization without a checker covers, takes the verdict your reasoning concludes against the actual code. A guard the code already applies is judged here, never waved through for being present.Anything a specialization surfaces is recorded as a finding through the steps below, like any other. Hold each entry's verdict for the table Step 11 emits.
Scope to reflect the mode you ran: a full scan, the specific paths, or the described focus.catalog lists it, never by a path, and listing under it the finding(s) it surfaced or confirmed. Remove the section if none applied.Mapped to today's date in ISO format YYYY-MM-DD.Scope line matches the mode you actually ran.YYYY-MM-DD..lagune/memory/detect.md, re-reading it first to keep any change made since you loaded it.entries list of {name, paths}, and it records the new ones and follows a renamed path for the rest. It never removes anything you did not report. name is the finding's name (this section's title), and paths holds the file paths the finding points at (one or more). The path lives here, in tracking, never in the prose. The tracking map holds no note: the prose carries the wording, the map carries only identity and paths. Call lagune_write with command set to track and this payload as the single item of arguments (a name with quotes or backticks stays intact), then read the JSON result it prints:{ "entries": [{ "name": "<FINDING NAME>", "paths": ["<PATH>"] }] }
Do not edit .lagune/tracking.json yourself, and do not reconcile here. Track only registers what this phase wrote. Repairing the chain across phases stays with /lagune-repair.
Call lagune_read with command set to validate and arguments set to ["detect"]. If it reports problems, follow its output and rerun it until it passes.
Output a short summary to the user:
The scope you ran (full scan, paths, or focus).
The findings detected, each with its one-line risk.
The verdict table from Step 6, one row for every entry Step 4 printed, never only the applied ones:
| Specialization | Context present? | Verdict |
|---|---|---|
| the entry's name | Yes or No, with a short reason read off the code | Applied, with what it surfaced, or Skip |
A [required] entry always reads Applied, even when its checker found nothing: its Context present? cell then states the checker ran across the whole project and what it returned.
What changed since the last run: findings added, findings removed because they are now resolved, and findings updated.
Anything left under Not determined.
When this run created the map, unless the project's ignore files already carry them, suggest these .gitignore lines in the conversation to keep its open findings out of a public repository:
/.lagune/memory/detect.md
/.lagune/memory/plan.md
/.lagune/memory/harden.md
/.lagune/tracking.json
A suggested commit message, for example docs: update detect map.
Next step: point the user to /lagune-plan, the phase that turns these findings into prioritized fixes, each tied to a charter principle. Frame it as the recommended next step, and note they can rerun /lagune-detect (on the whole project or a narrower scope) whenever the code changes.
Keep the map in plain language throughout. A non-developer should understand what each finding is and the risk it carries, while the evidence stays precise enough for the next phases to use.
Run every lagune <subcommand> call from the project root through the lagune_read and lagune_write MCP tools and, only if those tools are not available, run it in the shell as npx --yes [email protected] read <command> <arguments> and npx --yes [email protected] write <command> <arguments> as a fallback.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx skills add wellwelwel/lagune --skill '*' --agent claude-code -y9 skills in this plugin
/laguneUse this skill whenever you are about to build or change code. It builds safe-by-default from the project's charter and the defensive security knowledge the work touches, then checks the result./lagune-charterEstablish or update the project's security charter, the safe-by-default principles every later phase must respect. Reads the project's files to learn what it is and uses, weighs any description you give against them, and asks when something is unclear./lagune-hardenApply the defense plan's fixes to the code, safely and one at a time, then record what was applied and what is left. Reads the plan and the charter, then hardens every fix, the fixes, files, or directories you name, or a priority you choose.Other plugins' skills for the same job