Map landscape

From melodic-software/claude-code-plugins · View interactive version

Map landscape is an AI agent skill from the GitHub repository melodic-software/claude-code-plugins. C4 System Landscape plus application-portfolio table of a repository and the systems it references, with drift reported against a committed landscape record. Use when 'what systems do we have', 'what does this repo depend on', 'who owns which repo', 'what runtimes are we on', 'inventory our systems'

How to use this skill

Skill file

Repository context

The current repository is both the consumer, whose convention home declares where artifacts land,

and the default subject, the repository whose tracked files name the rest of the landscape.

Collect with an individual Bash call, one command per call: the project root,

git rev-parse --show-toplevel. Treat a failure (not a repository, git unavailable) as an unknown

value and carry on; ${CLAUDE_PROJECT_DIR} is the resolver's --root either way.

Purpose

Answer "what systems does this organization have, who owns them, what do they run on, and how do

they relate" from what a repository already says about its neighbors. Every fact traces to a named

file; every edge traces to a matched string in a tracked file; both are collected by scripts, never

derived by hand. The committed record makes the answer re-runnable, so the second run reports what

moved instead of quietly replacing the first.

Resolve home and dialect

Read ${CLAUDE_PLUGIN_ROOT}/reference/config.md first; it owns the keys, the topic-doc location,

and the resolution order. This skill reports against that contract rather than restating it.

Run bash "${CLAUDE_PLUGIN_ROOT}/lib/resolve-convention-home.sh" --root "${CLAUDE_PROJECT_DIR}" and

follow the exit code. Never parse the root instruction file yourself. Exit 0 means read

<home>/architecture/README.md for architecture_dir and landscape_dialect; exit 1 (no pointer

line), 2 (usage), and 3 (FAIL, surface the resolver's own message) all mean there is no declared

home to read.

Per key, in order: --out <dir> wins for this run alone, then a declared topic-doc value, then an

inference proposed from repository evidence and confirmed by the operator, then one question. When

nothing answers, landscape_dialect falls back to mermaid, and architecture_dir has no

default, so an undeclared and unconfirmed home, including every non-interactive run, stops and

points at /architecture:setup.

This skill never writes the consumer's root instruction file or its topic doc. `/architecture:setup

apply` owns both.

Choose the subject repositories

  1. No scope argument: the current repository, plus every repository its tracked files reference,

one hop out. This is the default and the primary use. Facts are collected from the current

checkout; the referenced repositories are nodes with edges and no probed facts unless they are

also checked out locally or --remote is passed.

  1. --repos <path>[,<path>...]: exactly those repositories. Facts come from every path; edges

come from the first path only (the --edges-from default). No discovery runs at all.

  1. --root <dir> (repeatable): discovery, delegated to the repo-fleet-hygiene plugin when it

is enabled and an announced bundled walk when it is not. Read

scope-modes.md before

running this mode; the collaborator's plan is wider than the roots you asked for, and charting it

unfiltered grows the landscape to the operator's whole configured fleet.

The session's working directory is never walked for nested repositories under any mode. Reading the

current repository as the default subject is not a walk: it is one path, resolved from

git rev-parse --show-toplevel.

Build the record

One call assembles both collectors into the committed record:

"${CLAUDE_SKILL_DIR}/scripts/landscape-record.sh" \
  --source "<how the subject set was chosen>" --remote "<not used | used, owned only | used, all>" \
  --edges-from <subject-repo> <repo-path>...

Keep the ${CLAUDE_SKILL_DIR} anchor;

CODE0 ยง Script paths

says why.

--source and --remote are recorded verbatim, so a later reader can tell an explicit list from a

fleet plan, and a local-only run from one that fetched. --edges-from is the repository whose

tracked files supply the edges: the current repository under the default and --root modes, the

first path under --repos unless the operator names another.

The record carries repositories[] from portfolio-facts.sh (name, remote, owner, runtime,

tooling, target_framework, dependencies[], dev_dependencies[], last_touched, evidence{})

and edges[] from reference-edges.sh (from, to as owner/repo, type, relation, count,

files[]).

It also records subject_owner, the organization the graph was drawn from, resolved by the edge

extractor so the nodes and the edges cannot disagree about it. That is what makes a checkout

internal: having a repository on disk says where someone works, not who owns the system, so a

cross-owner checkout is the same external system the edges to it already call external.

Anything no probe could derive is the literal unknown. Carry it through to the artifacts as-is;

never replace it with a guess, and never fill it from a commit author, a directory name, or

ecosystem memory.

runtime and dependencies are runtime scope, what the repository runs on. tooling and

dev_dependencies are development scope, what it is built with: npm devDependencies, PEP 735

dependency groups, a requirements-ci.txt, anything under a dot-directory. Report them as separate

facts; a linter is not a runtime.

Edge relation is internal when the target owner matches the subject's own and external

otherwise. An external repository is reference material: drawn and recorded, never written to, never

fetched from unless --remote=all. Edges are the script's output, not your judgment: do not add one

the script did not extract, and do not delete one for looking incidental, because a low cites

count is the signal that the reference is weak.

Report drift, and honor --check

When <architecture_dir>/landscape.json already exists, compare before writing anything:

"${CLAUDE_SKILL_DIR}/scripts/landscape-record.sh" \
  --drift-against "<architecture_dir>/landscape.json" --edges-from <subject-repo> <repo-path>...

Exit 0 means the committed record still matches. Exit 3 means it drifted; the report names

repositories and edges added or removed, facts whose value changed, and cited evidence files that no

longer exist. A last_touched that moved is reported as moved on <repo> and does not set the exit

code, because the subject repository advances its own HEAD on every commit. Surface the whole

report, gating and non-gating lines alike, before the artifacts. Exit 1 naming the

one-object-per-line layout means someone reformatted the committed record (compacted, or one key per

line), so neither the comparison nor the renderer can read it. Report that, not drift and not a thin

result, and regenerate the record.

--check stops there: run the comparison, print the report, write nothing, and report the

comparison's exit code as the run's outcome, so a lane invoking the script directly fails on drift.

That is the CI shape, and the only mode in which this skill writes no file at all when a home is

declared. Do not "helpfully" refresh the record so the next run is clean.

Remote facts, only when asked

Without --remote, no network call is made at all and the record says remote: not used. That is

the default and it is not negotiable by a referenced repository looking empty.

With --remote (or --remote=all for externals too), read

scope-modes.md for the

presence gate, the fact list, the evidence shape, and the rule that a local checkout always wins.

Fetched facts reach the record through --remote-facts <file>, one JSON object per line in the

shape portfolio-facts.sh emits. Without it the flag records only that a fetch happened, and every

referenced repository stays factless. Pass the same file to the drift run: a merged record compared

against a local-only collection reads every fetched repository as removed.

Emit artifacts

Render, then annotate. The renderer does the mechanical work; you write only prose.

"${CLAUDE_SKILL_DIR}/scripts/render-landscape.sh" \
  --record "<architecture_dir>/landscape.json" --out "<architecture_dir>" \
  --dialect "<landscape_dialect>" --notes "<architecture_dir>/landscape-notes.md"

Write landscape.json first, then render from it. The script writes landscape.md (mermaid) or

landscape.dsl (structurizr) plus portfolio.md, and appends landscape-notes.md verbatim when it

exists. --top-external <N> sets how many external systems the diagram draws, most referenced

first; every internal system is always drawn and the remainder is counted under the diagram.

The renderer prints one summary line on stdout and nothing else:

landscape: internal=<i> external=<e> drawn_systems=<s> edges=<n> drawn_edges=<d> unresolved_edges=<u> thin=<yes|no>.

Keep it for the report; --help defines each field and the thin threshold.

landscape-notes.md is the only file in the architecture directory you author, and the only one you

never overwrite: read it, extend it, leave what a person wrote alone, and mark an annotation as an

annotation. Annotations say what a system is for, which the extractor cannot know.

Close with the report

End every run with this block, in this order, filled from the record and the script exits:

record under --check).

summary line. Under --check it reads not assessed (--check).

question: a landscape answers which systems exist and how they reference each other. How one

deployable is built inside is /architecture:map-components. Module-design friction inside

that code is /architecture:improve. How the code behaves is /discovery:explore (if enabled). Then offer

--repos <repository-that-names-others>,<this>, the edge-supplying one first.

repository that supplies them is not charted. Add it to --repos, first.

Re-render with a larger --top-external; nothing needs collecting again.

subject kept first, adds the organization's other repositories as nodes.

repository's deployable, whatever the counts. Also name /architecture:improve when the

question is module design. Never offer --remote here: it fills facts for existing nodes and

adds no system and no edge.

plan, or bundled walk.

the missing backend named.

Interactive view

After the report, offer an interactive view of landscape.json in one sentence. The markdown and the record

stay authoritative. Build it only with ${CLAUDE_PLUGIN_ROOT}/scripts/build-view.mjs landscape, never

hand-written; the shared medium resolver decides the destination, with this plugin's medium option

${user_config.medium}, or "" when that reads empty or unsubstituted (never put a

${user_config.*} string in a shell command), and its report line is printed. Procedure:

CODE0.

What this skill does not do

Deployables are /architecture:map-containers. Configured neighbors are

/architecture:map-context. Build edges are /architecture:map-dependencies. A traced entry

point is /architecture:map-flow. Messages are /architecture:map-events. A declared schema

is /architecture:map-data. Infrastructure is /architecture:map-deployment.

This skill is the landscape altitude only.

External repositories are read-only reference in every mode.

/architecture:setup apply.

default.

Next

Related

Gotchas

C4Context diagram used without a focal system. The mermaid default, this output shape and

their recheck trigger live in the authoring-formats convention's

record.

Structurizr DSL: systemLandscape view.

scope only the subject repository has probed facts. Everything else is a node with edges and an

unknown row. That is the honest answer without --remote, not a gap to fill by guessing.

nothing more, and on a documentation-heavy repository it outnumbers every other type several times

over. Read a high cites count as "this repository talks about that one", never as a dependency.

.mypy_cache, .tox) are pruned outright; the CI and container config directories (.github,

.gitlab, .circleci, .devcontainer) are kept, and every manifest under one is pinned to

development scope whatever its content says. So a repository of shell and markdown whose CI

installs ruff reports runtime: shell with tooling: python. The same rule makes a

package.json carrying only devDependencies report tooling, which is why target_framework can

be unknown while a Tooling entry is present.

subject_owner renders as an external system with its probed facts intact, outside every

enterprise boundary, even though this run read its files. It is drawn whatever --top-external

says: that cap trims the tail of repositories the run only read about, never the set someone

asked it to chart.

owner from CODEOWNERS and a repository name are all repository-controlled text that lands

inside a quoted string in both dialects and inside a cell in the portfolio table. Neither diagram

grammar has a portable escape for its own delimiter, so the delimiter is swapped for one that

cannot close the literal. A value that comes out altered is a value that was never a fact.

first owner, then the owner segment of the origin remote, then unknown. Who edits a repository

most is not who owns it, so neither the script nor the write-up looks at git authorship.

A stale checkout reports a stale date. The generated-on line carries the remote state so a reader

can tell which it is.

the record drops it, because a committed artifact naming one machine's directory layout differs on

every other machine that regenerates it. Read the collector directly when a run needs the path.

to --root alone and are stated in full in

scope-modes.md.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.