Skip to content
Development
Command

/analyze-workspace

Full dynamic analysis of workspace topology, dependencies, and contracts.

From plugin
maggy
70525 skills7 agents25 commands1 hook
Install
$ npx -y skills add alinaqi/maggy --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/analyze-workspace

Context preview

What this command does when you run it.

Full dynamic analysis of workspace topology, dependencies, and contracts.

Command definition

analyze-workspace.md

/analyze-workspace

> Full dynamic analysis of workspace topology, dependencies, and contracts.

Trigger

Run this command when:

  • First time setting up workspace awareness
  • Major refactor or new module added
  • Weekly scheduled refresh
  • `/sync-contracts` reports too much drift
  • Switching to work on a different workspace

Behavior

Phase 1: Topology Discovery (~30 seconds)

๐Ÿ” Analyzing workspace topology...

Checking workspace indicators:
  โœ“ Found turbo.json (Turborepo)
  โœ“ Found pnpm-workspace.yaml
  โœ— No nx.json
  โœ— No lerna.json

Workspace type: Monorepo (Turborepo)
Root: /Users/ali/code/myapp

Discovering modules...
  โœ“ apps/web (package.json found)
  โœ“ apps/api (pyproject.toml found)
  โœ“ packages/shared-types (package.json found)
  โœ“ packages/db (package.json found)

Modules found: 4

Phase 2: Module Analysis (~60 seconds)

For each module, analyze:

๐Ÿ“ฆ Analyzing apps/web...
  Tech stack: Next.js 14, TypeScript, TailwindCSS
  Entry point: src/app/layout.tsx
  Key directories: src/lib/, src/components/, src/types/
  Dependencies: @repo/shared-types, @repo/ui
  External calls: fetch โ†’ apps/api (15 files)
  Token estimate: 18K full, 5K summarized

๐Ÿ“ฆ Analyzing apps/api...
  Tech stack: FastAPI, Python 3.12, SQLAlchemy
  Entry point: app/main.py
  Key directories: app/routes/, app/schemas/, app/models/
  Dependencies: packages/db (internal)
  Exposes: OpenAPI spec (47 endpoints)
  Token estimate: 24K full, 7K summarized

๐Ÿ“ฆ Analyzing packages/shared-types...
  Tech stack: TypeScript
  Entry point: src/index.ts
  Exports: 34 types
  Consumed by: apps/web, apps/api (codegen)
  Token estimate: 3K

๐Ÿ“ฆ Analyzing packages/db...
  Tech stack: Drizzle ORM, TypeScript
  Entry point: src/index.ts
  Tables: 12
  Migrations: 23
  Token estimate: 8K full, 2K schema only

Phase 3: Contract Extraction (~45 seconds)

๐Ÿ“œ Extracting contracts...

OpenAPI Detection:
  โœ“ apps/api/openapi.json (47 endpoints, 23 schemas)

GraphQL Detection:
  โœ— No GraphQL schemas found

TypeScript Types:
  โœ“ packages/shared-types/src/index.ts (34 exports)

Pydantic Schemas:
  โœ“ apps/api/app/schemas/ (23 models)

Database Schema:
  โœ“ packages/db/schema/ (12 tables)

Contract sources registered: 5 files

Phase 4: Dependency Graph (~30 seconds)

๐Ÿ”— Building dependency graph...

Internal dependencies:
  apps/web โ†’ packages/shared-types (23 imports)
  apps/web โ†’ apps/api (15 API calls)
  apps/api โ†’ packages/db (12 imports)
  apps/api โ†’ packages/shared-types (codegen)
  packages/db โ†’ (none)
  packages/shared-types โ†’ (none)

Dependency order (for changes):
  1. packages/shared-types (leaf)
  2. packages/db (leaf)
  3. apps/api (depends on db, shared-types)
  4. apps/web (depends on api, shared-types)

Phase 5: Key File Identification (~30 seconds)

๐Ÿ“ Identifying key files...

High priority (always relevant):
  โœ“ apps/api/openapi.json
  โœ“ packages/shared-types/src/index.ts
  โœ“ apps/web/src/lib/api/client.ts

Context-specific:
  โœ“ API work: apps/api/app/routes/*.py
  โœ“ DB work: packages/db/schema/*.ts
  โœ“ Auth work: apps/api/app/routes/auth.py + deps
  โœ“ Frontend: apps/web/src/components/**

Token budget by context:
  Frontend API: ~8K tokens
  Backend endpoints: ~12K tokens
  Database changes: ~6K tokens
  Shared types: ~4K tokens

Phase 6: Generate Artifacts

๐Ÿ“ Generating workspace artifacts...

Created:
  โœ“ _project_specs/workspace/TOPOLOGY.md
  โœ“ _project_specs/workspace/CONTRACTS.md
  โœ“ _project_specs/workspace/DEPENDENCY_GRAPH.md
  โœ“ _project_specs/workspace/KEY_FILES.md
  โœ“ _project_specs/workspace/CROSS_REPO_INDEX.md
  โœ“ _project_specs/workspace/.contract-sources

Final Output

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  WORKSPACE ANALYSIS COMPLETE
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Workspace: myapp
Type: Monorepo (Turborepo)
Modules: 4 (2 apps, 2 packages)

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ apps/web (Next.js) โ†โ”€โ”€โ”€โ”€ apps/api (FastAPI)     โ”‚
โ”‚      โ”‚                        โ”‚                 โ”‚
โ”‚      โ–ผ                        โ–ผ                 โ”‚
โ”‚ packages/shared-types    packages/db            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Contracts:
  REST API: 47 endpoints
  Shared types: 34 interfaces
  DB tables: 12

Token Estimates:
  Current module only: ~20K tokens
  With cross-module context: ~45K tokens
  Full workspace: ~53K tokens
  Budget remaining: ~100K tokens โœ“

Artifacts generated in: _project_specs/workspace/

Next steps:
  โ€ข Contracts will auto-sync on commit (if changed)
  โ€ข Run /sync-contracts manually to refresh
  โ€ข Run /workspace-status for quick check

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Flags

| Flag | Description | |------|-------------| | `--force` | Regenerate all artifacts even if recent | | `--type <type>` | Override auto-detection: `monorepo`, `multi-repo`, `hybrid` | | `--repos <paths>` | For multi-repo: comma-separated paths to related repos | | `--skip-contracts` | Skip contract extraction (faster) | | `--verbose` | Show detailed analysis output | | `--json` | Output as JSON (for tooling) |

Multi-Repo Mode

For workspaces with separate git repositories:

# Auto-detect sibling repos
/analyze-workspace --type multi-repo

# Specify repo locations explicitly
/analyze-workspace --type multi-repo --repos "../backend,../shared,../mobile"

Claude will: 1. Detect related repos in parent directory 2. Set up symlinks in `.workspace/repos/` if needed 3. Analyze each repo 4. Build cross-repo dependency graph 5. Extract contracts from each

Integration Points

On First Run

Creates the full workspace context structure:

_project_specs/
โ””โ”€โ”€ workspace/
    โ”œโ”€โ”€ TOPOLOGY.md
    โ”œโ”€โ”€ CONTRACTS.md
    โ”œโ”€โ”€ DEPENDENCY_GRAPH.md
    โ”œโ”€โ”€ KEY_FILES.md
    โ”œโ”€โ”€ CROSS_REPO_INDEX.md
    โ”œโ”€โ”€ .contract-sources
    โ””โ”€โ”€ cache/              # Cached cross-repo files

Updates CLAUDE.md

Ad

Read more
Ships withmaggy

Turn Claude Code into a self-reviewing, test-enforced engineering system that remembers context across sessions โ€” then route work across 13 models from a single dashboard.

Get the whole plugin