/unwind:uw-scanfrom unwind
Scans an unfamiliar codebase to produce a structured architecture document with file inventory, import graph, and layer assignments. Useful when onboarding or planning a migration.
Ships in unwind. 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.
None: SKILL.md is the whole skill.
Run a deterministic scan of the codebase, then dispatch a subagent to add
narrative observations and adjudicate anything the scanner could not classify.
The scanner (@unwind/core) produces a machine-readable scan-manifest.json —
the ground truth for the file inventory, per-file structural symbols, the
import graph, and a first-pass rebuild-layer assignment. The architecture
document is derived from this manifest, so layer counts and entry points are
verifiable rather than guessed.
Output: docs/unwind/architecture.md (derived) + docs/unwind/.cache/scan-manifest.json (ground truth)
Graceful fallback: if Node/pnpm or
@unwind/coreare unavailable, the deterministic scan is skipped and discovery falls back to the legacy pure-LLM Explore flow (Step 1-LEGACY below). The skill always functions; the scan is an enhancement, not a hard dependency.
Build (first run only) and run the scanner. The helper resolves the plugin root
and lazily builds @unwind/core:
# Locate the installed Unwind plugin, then load the core helper.
# $0/BASH_SOURCE are unreliable under `bash -c`, so glob the install cache.
UNWIND_PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-${UNWIND_PLUGIN_ROOT:-}}"
[ -f "$UNWIND_PLUGIN_ROOT/skills/scripts/_resolve-plugin-root.sh" ] || \
UNWIND_PLUGIN_ROOT="$(ls -dt "$HOME"/.claude/plugins/cache/*/unwind/*/ 2>/dev/null | head -1)"
source "${UNWIND_PLUGIN_ROOT%/}/skills/scripts/_resolve-plugin-root.sh"
ensure_unwind_core || { echo "core unavailable — using legacy discovery"; }
node "$UNWIND_PLUGIN_ROOT/skills/scripts/scan.mjs" "$(pwd)"
docs/unwind/.cache/scan-manifest.json. Proceed to Step 1.The manifest already contains everything the old Step-1 git parsing produced, plus far more:
| architecture.md field | Manifest source |
|---|---|
repository block (type/url/branch/link_format) | manifest.repository (note: manifest uses linkFormat; emit it as link_format in YAML) |
| Project name / language / framework | manifest.project |
Per-layer status + entry_points | manifest.stats.byLayer (status) + manifest.layerIndex[layer].files (entry points) |
| Exact file/symbol counts | manifest.stats, manifest.files[].symbols |
Read docs/unwind/.cache/scan-manifest.json. Then dispatch an Explore
subagent whose job is now narrower (the inventory is already known):
unassigned bucket. manifest.layerIndex.unassigned.files
lists files the scanner could not confidently place. Inspect them and assign
each to a real layer (or confirm it's genuinely cross-cutting/non-layer).Pass the subagent the manifest's repository, project, stats.byLayer, and
the unassigned file list. It returns the architecture document content (same
format as the Architecture Document Format below); the main agent writes it.
Map the scanner's layers to architecture.md layer keys:
database→database,domain→domain_model,service→service_layer,api→api,messaging→messaging,frontend→frontend. Tests and infrastructure are recorded under their own sections. A layer with a non-zero count instats.byLayerisstatus: detected.
Used only when the deterministic scan was unavailable in Step 0. Gather repo info and dispatch the Explore subagent to discover layers from scratch:
git remote get-url origin 2>/dev/null
git branch --show-current 2>/dev/null
Parse the remote URL:
[email protected]:owner/repo.git → https://github.com/owner/repohttps://github.com/owner/repo.git → https://github.com/owner/repolocal type with null URLBuild the repository info block:
repository:
type: github|gitlab|bitbucket|local
url: https://github.com/owner/repo # or null if local
branch: main # or null if local
link_format: https://github.com/owner/repo/blob/main/{path}#L{start}-L{end}
Then dispatch an Explore subagent (see Subagent Prompt below) to discover layers and return the architecture document content.
Check if docs/unwind/architecture.md exists (Glob: docs/unwind/architecture.md):
When the Explore subagent completes with the document content:
Create the output directory:
mkdir -p docs/unwind
Write the content to docs/unwind/architecture.md using the Write tool
Verify the file was created
After the subagent completes, present the results to the user:
## Architecture Discovery Complete
I've analyzed the codebase and created the architecture document.
**Output:** `docs/unwind/architecture.md`
### Summary
[Include the summary from the subagent - framework, layers detected, etc.]
### Detected Layers
[List layers with their confidence levels]
### Next Steps
**Use AskUserQuestion to let them choose** between:
1. **Open the dashboard now** *(recommended)* — visualize the scanned structure before going deeper
2. **Continue with layer analysis** — dispatch specialist subagents for each layer
3. **Review the architecture document first** — open `docs/unwind/architecture.md` to verify the detection is accurate
Then act on the choice in the same turn — don't just describe it:
- **Dashboard** → immediately invoke the `unwind:uw-dashboard` skill. It generates
`rebuild-graph.json` from the scan manifest and launches the interactive graph
(everything shows as `scanned` this early). When they're done exploring, offer to
continue with `unwind:uw-analyze`.
- **Continue** → invoke `unwind:uw-analyze`.
- **Review** → open `docs/unwind/architecture.md`; afterwards re-offer the same choice.
If they pause, tell them how to resume: *"Run `unwind:uw-analyze` (type `/uw-analyze`) when ready."*
> **Pipeline:** **scan ✓** → analyze → grill → plan → dashboard. Each phase is its own skill
> and ends by asking whether to continue or pause. (`uw-graph` is an optional export;
> the dashboard builds its graph on demand.)
Important: Always give the user the option to review before proceeding. The architecture document drives all subsequent analysis, so accuracy matters.
Use this prompt when dispatching the discovery subagent:
Explore this codebase to identify its architectural layers and structure.
## Your Task
Systematically explore the codebase and return the architecture document content. The main agent will write the file.
**Repository information has already been gathered and will be provided to you.** Use the provided `repository.link_format` for all source links.
## Phase 1: Project Identification
Identify the technology stack by looking for:
**Build System:**
- `package.json` → Node.js/JavaScript
- `pom.xml` / `build.gradle` → Java
- `requirements.txt` / `pyproject.toml` → Python
- `go.mod` → Go
- `Cargo.toml` → Rust
- `*.csproj` → .NET
**Framework:** Check dependencies for Spring Boot, Django, Express, Rails, Next.js, etc.
**Database:** Look for connection strings, ORM config, migration directories.
## Phase 2: Directory Mapping
Scan source directories and map to layers:
| Directory Pattern | Likely Layer |
|-------------------|--------------|
| `repository/`, `dao/`, `data/` | Database |
| `model/`, `entity/`, `domain/` | Domain Model |
| `service/`, `usecase/`, `application/` | Service Layer |
| `controller/`, `api/`, `rest/`, `graphql/` | API Layer |
| `messaging/`, `events/`, `queue/`, `kafka/` | Messaging |
| `components/`, `pages/`, `views/`, `ui/` | Frontend |
## Phase 3: Confidence Assessment
For each layer, assess confidence:
- **High**: Clear directory structure, multiple files, consistent naming
- **Medium**: Some indicators but mixed patterns
- **Low**: Minimal evidence
- **Not Detected**: No evidence found
## Phase 4: Cross-Cutting Concerns
Identify aspects spanning multiple layers:
- Authentication/Authorization
- Logging
- Error Handling
- Caching
- Validation
## Phase 5: Return Architecture Document
**DO NOT attempt to write the file** - you don't have write permissions. Instead, return the complete architecture document content in your response. The main agent will write it to `docs/unwind/architecture.md`.
Return the document in this exact format:
```markdown
# Architecture Discovery: [Project Name]
> **For Claude:** REQUIRED SUB-SKILL: Use unwind:uw-analyze to analyze each layer.
## Discovery Metadata
- **Generated:** [ISO timestamp]
- **Project Root:** [path]
- **Framework:** [detected framework]
- **Language:** [primary language]
## Repository Information
```yaml
repository:
type: github|gitlab|bitbucket|local
url: https://github.com/owner/repo # or null if local
branch: main # or null if local
link_format: https://github.com/owner/repo/blob/main/{path}#L{start}-L{end}
For all downstream agents: Use link_format to create source links. Replace {path}, {start}, {end} with actual values.
layers:
database:
status: detected|not_detected
confidence: high|medium|low
entry_points:
- path/to/data/layer/
dependencies: []
domain_model:
status: detected|not_detected
confidence: high|medium|low
entry_points:
- path/to/domain/
dependencies: [database]
service_layer:
status: detected|not_detected
confidence: high|medium|low
entry_points:
- path/to/services/
dependencies: [domain_model]
api:
status: detected|not_detected
confidence: high|medium|low
entry_points:
- path/to/controllers/
dependencies: [service_layer]
messaging:
status: detected|not_detected
confidence: high|medium|low
entry_points: []
dependencies: [service_layer]
frontend:
status: detected|not_detected
confidence: high|medium|low
entry_points: []
dependencies: [api]
cross_cutting:
authentication:
touches: [api, service_layer]
entry_points:
- path/to/security/
Status: [Detected/Not Detected] | Confidence: [High/Medium/Low]
Entry Points:
Initial Observations:
[Repeat for each layer with status != not_detected]
Touches: [layers] [Observations]
{REFRESH_CONTEXT}
## Output
After creating the architecture document, provide a brief summary:
- Project type and framework
- Which layers were detected (with confidence)
- Any notable findings or concerns
If previous architecture.md exists, add this to the subagent prompt:
## Previous Analysis
A previous architecture analysis exists. Compare the current codebase state to this previous analysis and:
1. Note any changes in the `## Changes Since Last Discovery` section
2. Update layer status/confidence if changed
3. Add new entry points discovered
4. Remove entry points that no longer exist
5. Update the `last_analyzed` timestamp
Previous analysis:
[CONTENTS OF EXISTING architecture.md]
repository/, dao/, data/, persistence/*Repository.java, *_repository.py, *.repo.tsdomain/, model/, entity/, entities/*Entity.java, models.py, *.entity.ts@Entity, class Model, aggregates, value objectsservice/, services/, usecase/, application/*Service.java, *_service.py, *.service.ts@Service, @Transactional, business logic methodscontroller/, api/, rest/, routes/, graphql/*Controller.java, views.py, *.controller.ts@RestController, @router, route definitionsmessaging/, events/, queue/, kafka/, rabbitmq/*Listener.java, *Consumer.py, *.handler.tscomponents/, pages/, views/, ui/, src/app/*.tsx, *.vue, *.component.tsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub nearform/unwind --plugin unwind25 skills in this plugin
/uw-analyzeUse after unwind:uw-scan to orchestrate layer-by-layer analysis using specialist subagents/uw-analyze-apiUse when analyzing REST/GraphQL API endpoints, contracts, authentication, and client-facing interfaces/uw-analyze-databaseUse when analyzing the database layer including schema, migrations, ORM configuration, and data access patterns/uw-analyze-domainUse when analyzing domain entities, value objects, aggregates, and business rules encoded in the model/uw-analyze-e2e-testsUse when analyzing end-to-end tests including browser automation, API workflows, and full system testing/uw-analyze-frontendUse when analyzing frontend/UI layer including components, state management, routing, and API integration (optional - skip if no frontend exists)Other plugins' skills for the same job