From arrow-maintenance
Deep-maps existing codebases: reads every file in scope, offers lens-based clustering, generates bottom-up LLD/HLD/EARS/arrow doc skeletons, prompts refinements. For reverse-engineering or LID bootstrap.
npx claudepluginhub jszmajda/lid --plugin arrow-maintenanceThis skill uses the workspace's default tool permissions.
This skill maps an existing codebase into the arrow of intent. It works bottom-up: read all the code in scope first, then propose lens-based clusterings for the user to choose among, then generate skeleton docs that describe what actually exists.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Share bugs, ideas, or general feedback.
This skill maps an existing codebase into the arrow of intent. It works bottom-up: read all the code in scope first, then propose lens-based clusterings for the user to choose among, then generate skeleton docs that describe what actually exists.
See brownfield-bootstrap.md for detailed guidance per phase.
These govern every phase. Apply consistently.
[inferred] markers; known technical debt and behavioral quirks go in Open Questions.Ask one question first:
This question determines scope and mode simultaneously — the user is not asked a separate "Full or Scoped?" later at terminal verification. Default to Full (whole project) if the user is undecided.
Then ask:
Token-intensity warning. Tell the user upfront this is token-intensive by design — reading every file, proposing multiple lenses, drafting skeletons for every segment, multi-step reconciliation. Not a lightweight operation. Users expecting a quick one-shot map should reconsider.
Undo. The workflow's STOPs between phases are the undo mechanism — aborting at any STOP leaves nothing written to disk. Agent harnesses also provide their own session-level rewind. LID does not ship a dedicated /unmap-codebase command; users roll back via the agent framework's rewind or by reverting a git commit.
Inspect the project before starting:
docs/arrows/. Redirect the user to /arrow-maintenance — that command bootstraps the overlay from existing docs without the brownfield sweep. Do not proceed here.Read every file in the declared scope. Not a sample. Sampling risks missing behaviors that only surface in edge-case files and locks in segmentation based on incomplete view.
For each file, record a structured summary:
Output: a flat list of observed behaviors with file/line references. No segmentation attempted here.
Capacity constraint handling. If the declared scope exceeds the invocation's capacity (single-agent context window, or the chosen subagent budget), surface the constraint with concrete sizing evidence, warn the user that a sampled sweep produces lower-quality mapping, and recommend narrowing scope or enabling subagent parallelism. The user may override and proceed with sampling anyway. Under override, preserve state across truncation points via per-subagent files (.lid/map-codebase/sweep-{N}.md) or by incrementally writing arrow-doc partial drafts during reconnaissance — never silently discard information the orchestrator cannot hold.
When subagents ran in parallel, each subagent writes its sweep to its own file; the orchestrator processes them in chunks during Phase 2.
See subagent-sweep-prompt.md for the prompt template given to sweep workers.
Propose 3–5 fundamentally different clusterings, each using a distinct lens. Not variations on one theme — entirely different mental models.
Good lenses to propose:
Anti-pattern lenses to explicitly avoid:
For each proposed clustering, present: name, lens, the clusters it produces, pros, cons, and best-for (what kind of reasoning it supports well).
STOP. User picks a lens. Multiple lenses are the primary edge-detection mechanism — the user's choice of lens reveals latent intent in a way no single clustering can.
See reconciliation-template.md for the presentation format.
Within the chosen lens, propose 2–3 slicing variations:
Coarse absorbs more code per LLD; fine gives precise segment-scoped tracking. Pick based on project maturity and the user's appetite for maintenance.
STOP. User picks a slicing.
Present the final candidate clustering (chosen lens + chosen granularity). User:
Where parallel subagents disagreed on segment assignments earlier, flag those conflicts prominently here.
Component quality check. When reviewing, apply the working definition: a segment should be an independent system achieving an independent purpose. Flag proposed segments that match anti-patterns (team boundaries, deployment units, file locations, generic "utils") rather than accepting them silently.
STOP. User approves the final clustering before artifact generation begins.
For each approved segment, generate these artifacts in order with a STOP after each:
docs/arrows/{segment-name}.md — References pointing to actual files, initial status: MAPPED. See arrow-doc template. STOP.docs/llds/{segment-name}.md — standard LLD template (lld-templates), no separate brownfield template. Content carries brownfield state: [inferred] markers in Decisions & Alternatives table, Open Questions for observed-but-unexplained behaviors. STOP.docs/specs/{segment-name}-specs.md — reserved spec-ID prefix (derived from segment name; ask the user for a namespacing segment if the prefix collides with an existing one). Initial status semantics:
[x] — behavior is observed as working in current code.[ ] — behavior is specified but broken or partial in current code.[D] — explicit non-wants (intentional non-features); rare in brownfield.
STOP.index.yaml entry under arrows: with the taxonomy placement chosen during reconciliation. Follow the schema in index-schema.md.After all segments are generated, if no HLD exists:
docs/high-level-design.md — standard template (hld-template), bodies marked *(not yet specified)* rather than filled with placeholder content. If an HLD already exists, skip this step — never modify an existing HLD. STOP.Before completing:
Ensure CLAUDE.md is configured. Invoke the /lid-setup behavior (equivalent to running the lid-setup skill), passing the mode that was determined from the invocation-time scope question. lid-setup honors caller-provided mode and does not re-prompt. Result: LID directives block present, ## LID Mode: marker set to the determined mode, arrow-navigation rows included (since the overlay is now installed), and a ## LID Tooling section scaffolded if a coherence script is to be declared. lid-setup runs exactly once per /map-codebase invocation — at terminal verification, not during artifact generation.
Issue the flesh-out prompt. Direct the user to move into the linked-intent-dev workflow segment-by-segment to populate the skeleton LLDs and EARS specs. Without this prompt the user may leave reconstruction incomplete — and partial arrows propagate incoherence into future sessions. The flesh-out prompt is the terminal step; do not exit without issuing it.