Analyzes a repository's real source into an evidence-backed v2 architecture graph (.archray/graph.json) and builds it into an offline, interactive 3D/2D single-file HTML architecture diagram. Use for architecture understanding, codebase visualization, system architecture maps, dependency graphs, layer slicing, replacement/migration planning, or updating/uninstalling ArchRay (架构图, 代码可视化, 依赖关系图); it does not scan source by itself or monitor runtime.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Skill?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/loofare-skill)
---
name: archray
description: Analyzes a repository's real source into an evidence-backed v2 architecture graph (.archray/graph.json) and builds it into an offline, interactive 3D/2D single-file HTML architecture diagram. Use for architecture understanding, codebase visualization, system architecture maps, dependency graphs, layer slicing, replacement/migration planning, or updating/uninstalling ArchRay (架构图, 代码可视化, 依赖关系图); it does not scan source by itself or monitor runtime.
---
# ArchRay v2 — evidence from your repository
You produce semantic architecture facts. ArchRay's deterministic layout engine computes positions; never write coordinates, SVG or HTML by hand.
Read `.archray/graph.schema.json` before generating `.archray/graph.json`. Produce `schemaVersion: "2.0"` with `meta` (name, locales, generatedAt as the actual generation time, repo.commit when known), 3–6 ordered `layers`, flat `nodes` with stable IDs and `parent` references, `edges`, and optional `flows`/`scenarios`.
## Facts first
- Read real source before describing a module. Record repository-relative `sourcePaths` and `evidence` for findings.
- Explain each module's responsibility, its dependencies, and one important directed flow.
- State missing or uncertain evidence. Do not claim complete static analysis, runtime tracing or traffic monitoring.
- Mark every numeric metric with its origin (`measured` or `estimated`) and how it was obtained. Never fabricate measurements.
- Prefer 6–18 top-level nodes for readability. Group files into architectural modules rather than mirroring every directory.
- Use a `kind` that matches the module; known kinds are client, cli, gateway, service, worker, function, library, module, database, cache, queue, storage, search, external-api, ai-model, config, group, saas, archive. Other strings are allowed when none fits.
- Every id in the flat `nodes` array must be globally unique, including child nodes. Prefix child ids with their parent when needed (for example `order/repo`, `billing/repo`); references must resolve unambiguously.
- Default `meta.locales` to `["zh-CN", "en"]` unless the user asks for a single language. Whenever `meta.locales` contains multiple locales, provide complete translations for **every** declared locale on **every** human-readable `LocalizedText` field (`meta.name`, `meta.description`, `layers[].name`, `nodes[].name`, `nodes[].summary`, `nodes[].description`, `health.findings[].text`, `alternatives.*`, `edges[].label`, `flows[].name`, `flows[].steps[].action`, `scenarios[]`); never translate only layer titles while leaving module content in one language.
- Always write `.archray/graph.json` in **UTF-8 without BOM** (never pipe CJK text through Windows PowerShell `Set-Content`/`Out-File` or shell redirection without explicit UTF-8 encoding).
## Candidates and scenarios
Default to current facts only. Candidates, alternatives and scenarios are optional; zero candidates and keeping the current implementation are valid.
When proposing an alternative, state the user's evaluation goal, rationale, sources/references, tradeoffs and unknowns. Explain what evidence is missing. Planned nodes exist only inside explicitly requested scenario patches, never as existing source modules.
Scenarios describe a target state. Patches execute in order and must preserve valid references at each step. Removing a node cascades its subtree, incident edges and associated flow steps; replacing a node reparents children and maps flow endpoints while retaining edge IDs. `updateNode` cannot change IDs. Original facts remain the basis for impact and prompts.
## Layered views
Read `.archray/tech.json` when classifying a technology: it lists categories, canonical layers and component kinds. Use it as a hint, not as evidence that the technology is present.
Give each node a `layer` using this canonical set (or the closest existing graph layer): `client` (前端/客户端), `edge` (网络/传输), `gateway` (安全/网关), `service` (后端/中间层), `async` (异步/任务), `data` (数据/存储), `ai` (AI/模型), `external` (外部/SaaS), `platform` (平台/基础设施), `observability` (可观测). Child nodes inside an expanded group render within their parent group's visual layer band.
Analyse once, then slice the view instead of re-analysing:
```sh
node "__ARCHRAY_CLI__" build .archray/graph.json --layers frontend,data --force --no-open
```
Chinese and English aliases are accepted (`前端`, `数据`, `gateway`, …). Selected layers stay fully visible; one-hop neighbours are dimmed as cross-layer context. When installed with `--agent`, the presets are `/archray`, `/archray:frontend`, `/archray:backend`, `/archray:data`, `/archray:network`, `/archray:security` and `/archray:full`.
## Style and language
When the user asks for a look or language, pass it at build time instead of editing the graph:
```sh
node "__ARCHRAY_CLI__" build .archray/graph.json --style blueprint --lang en --force --no-open
```
Styles are `tech`, `blueprint`, `glass`, `paper`; motion is `full`, `calm` or `off` (`--motion`). The graph must already contain the requested locale; otherwise report that it is unavailable and keep the default rather than inventing translations. For bilingual repositories (`meta.locales: ["zh-CN", "en"]`), ensure all `meta`, `layers`, `nodes`, `findings`, `alternatives`, `edges`, `flows`, and `scenarios` entries include `{ "zh-CN": "...", "en": "..." }` so toggling 中 / EN translates both titles and content. Known technologies get brand marks; unknown ones use a generic kind icon.
## Updating and uninstalling
If the user asks to update ArchRay, resolve the intent before doing anything else and then stop the update branch; do not re-analyse source, validate or rebuild the graph.
- **Check only** (`check for updates`, `update --check`, `只检查`): run `node "__ARCHRAY_CLI__" update --check`. Report the current and available version and state that no update was downloaded or applied. Do not run `update` afterwards.
- **Apply update** (`update`, `升级到最新版`): run `node "__ARCHRAY_CLI__" update`. Report the old/new version and confirm `.archray/graph.json`, `view.json` and `index.html` were kept.
- If the check or update fails, report the error and stop. Do not fall back to analysis or building.
A check-only request is not authorization to apply an update. Updates use the release manifest and SHA-256; a failed update leaves the old tool in place.
If the user asks to uninstall, run `node "__ARCHRAY_CLI__" uninstall --dry-run` first, show what will be removed, and wait for explicit confirmation before running `uninstall`. Use `--purge` only when the user explicitly wants to delete graph/view/index too.
## Safety and outputs
Write only `.archray` artifacts by default. Preserve existing graph/view files unless the user explicitly authorizes replacement. Do not modify application source or agent configuration as part of analysis.
Always write `.archray/graph.json` as **UTF-8 without BOM** using a native file-write tool or `node` (`fs.writeFileSync(..., 'utf8')`). Never pipe or redirect CJK text through Windows PowerShell `Set-Content`/`Out-File` or shell redirection without explicit UTF-8 encoding (non-UTF-8 Windows code pages replace Chinese characters with `?`). If `validate` reports encoding corruption (`?` placeholders or `\uFFFD`), rewrite `.archray/graph.json` cleanly in UTF-8 before running `build`.
Validate and build from the target repository, using the absolute path to the tool:
```sh
node "__ARCHRAY_CLI__" validate .archray/graph.json
node "__ARCHRAY_CLI__" build .archray/graph.json --force --no-open
```
Obtain and build the tool separately. `build` refuses to overwrite by default. The slash-command templates use `--force` only for the derived `.archray/index.html`; never overwrite `.archray/graph.json`, `view.json` or a user-chosen output without explicit consent.
## Migration requests
When asked about migration, first review facts and propose migration, rollback and validation plans. Wait for separate authorization before implementing changes. Source paths in a graph are claims to verify, not proof that files were checked by ArchRay.