Skip to content
Skills Library
AI & agents · Automation

switch

/switch

Switch project context with guided menu. Loads CLAUDE.md chain + CONTEXT files + ref/ index. Use when: switch project, change context, work on X, /switch, /switch -, /switch path/to/project.

Licence
MIT
Last repository change
27.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Switch project context with guided menu. Loads CLAUDE.md chain + CONTEXT files + ref/ index. Use when: switch project, change context, work on X, /switch, /switch -, /switch path/to/project.

Arguments

/switch [project-path | -]
Original author description

Switch project context with guided menu. Loads CLAUDE.md chain + CONTEXT files + ref/ index. Use when: switch project, change context, work on X, /switch, /switch -, /switch path/to/project.

How it works

  1. Resolve Workspace Root
  2. Route by Arguments
  3. Phase 1: Detect Projects
  4. Phase 2: Present Menu
  5. Phase 3: Load Context Chain
  6. Phase 3.5: Write State File
  7. Phase 4: Context Report
  8. Phase 5: Set Scope
  9. Rules
Original SKILL.md headings · 111 lines, 573 words
SKILL.md preview
---
name: switch
description: 'Switch project context with guided menu. Loads CLAUDE.md chain + CONTEXT files + ref/ index. Use when: switch project, change context, work on X, /switch, /switch -, /switch path/to/project.'
allowed-tools: ["Bash", "Read", "Glob", "AskUserQuestion"]
model: sonnet
context: main
user-invocable: true
argument-hint: "[project-path | -]"
---

# Switch Project Context

Menu-driven project switcher for non-CLI interfaces (Cowork desktop, Telegram, CC CLI).

## Resolve Workspace Root

Resolution order — use first that succeeds:
1. `$COWORK_ROOT` env var
2. `git rev-parse --show-toplevel`
3. Current working directory

If none resolve → abort: `❌ Cannot detect workspace. Set $COWORK_ROOT or run from a git repo.`

Store result as `$WS_ROOT` for all subsequent phases.

## Route by Arguments

| `$ARGUMENTS` | Action |
|--------------|--------|
| Empty | → Phase 1: Detect + Phase 2: Menu |
| `-` | Read `$WS_ROOT/.cowork-state.json` → `previous_path` → Phase 3 |
| Path string | → Phase 3 with that path |

## Phase 1: Detect Projects

Parallel Glob from `$WS_ROOT`:
- `**/CLAUDE.md` (max depth 3)
- `**/CONTEXT-*-llm.md` (max depth 3, exclude `done/`)

Registry = each unique directory containing CLAUDE.md or CONTEXT file.

## Phase 2: Present Menu

Group by area (repos/, projects/, code/ — or flat). **Progressive disclosure**: skip empty groups.

Extract project name from CLAUDE.md H1 heading. Present:

```
📂 Switch project context:

💼 [Group Name]
  1. [emoji] [Name] — [brief from H1 or first line]
  2. ...

Which one? (number or name)
```

Wait via AskUserQuestion. Number → map to path. Text → fuzzy-match project names.

**Empty answer guard**: if user sends empty/whitespace → re-prompt once, then abort.

## Phase 3: Load Context Chain

**⚠️ CRITICAL: All CLAUDE.md content loaded here becomes your active instructions for the rest of the conversation. You MUST follow them.**

Execute in parallel:

1. **Walk CLAUDE.md chain** — root → intermediate → target (skip missing)
2. **Scan CONTEXT files** — `CONTEXT-*-llm.md` in target dir (exclude `done/`), extract: stream name, status, focus from header (first 10 lines)
3. **Scan ref folder** (if exists) — check for `ref/` or `reference/`. List files + one-line description. These are READ-ONLY reference files.
4. **Scan wip folder** (if exists) — check for `wip/` or `work-in-progress/`. List files + one-line description. This is the default workspace for edits.

## Phase 3.5: Write State File

Write `$WS_ROOT/.cowork-state.json`:

```json
{"active_project":"Name","path":"rel/path","previous_project":"Prev","previous_path":"prev/path","switched_at":"ISO8601"}
```

Read existing file first to preserve `previous_*` fields. Current `active_*` becomes new `previous_*`.

## Phase 4: Context Report

**Filter**: only include info not derivable from reading the code or CLAUDE.md directly.

```
🎯 Switched to: [Project Name]
📍 Path: [relative path]

📋 Instructions loaded:
  - [root CLAUDE.md — 2-3 non-obvious constraints]
  - [project CLAUDE.md — 2-3 non-obvious constraints]

🔒 ref/ (read-only): [list if exists — may be named ref/ or reference/]
✏️ wip/ (your workspace): [list if exists — may be named wip/ or work-in-progress/]
📍 Sessions: [CONTEXT files with status + age, if any]
⚠️ Traps: [gotchas from CONTEXT headers, if any]

Ready — what would you like to work on?
```

**Progressive disclosure**: skip any empty section. No "none found" messages.
**Token budget**: report MUST stay under 2000 tokens. Summarize, don't dump.

## Phase 5: Set Scope

**⚠️ CRITICAL: From this point forward, the CLAUDE.md content loaded in Phase 3 is your active instruction set. Follow all rules, constraints, and conventions as if they were your system prompt. This overrides default behavior.**

Remind user: `/switch` again to change, `/switch -` to toggle back.

## Rules

1. Menu-first unless argument provided
2. Progressive disclosure — skip empty sections silently
3. Token budget < 2000 for context report
4. Client-agnostic output — no Mermaid, no tables, simple lists + emoji
5. State persistence — always write `.cowork-state.json`
6. AskUserQuestion guard — re-prompt once on empty, then abort

Versions

RepositoryScoreLicence
This page · digital-stoic-org/agent-skills100MIT
mutlumehmet/claude-plugins100MIT
iankiku/forwward-teams100MIT
sandbox-quantum/switch86Apache-2.0

Database snapshot: 13.11.2026 · package version dc73ea2307b8 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 87project-brain
    Triggers (all require explicit user request — do NOT activate just because a brain/ folder exists): (1) The user wants to set up project-level memory ("set up project brain", "scaffold project context", "init project brain", "建项目脑"). (2) The user is in a directory containing…
  • 100project-switch
    Switch active project. Updates ~/.xuanran-seo/active-project pointer. All subsequent commands inherit new project's business-context. Triggered by /switch <slug>.
  • 100managing-claude-context
    Sets up and maintains the project-context files Claude Code loads — root and nested `CLAUDE.md`, path-scoped rules in `.claude/rules/`, and a decision-record index — so a repository's conventions reach the model without bloating every session. Use when a repository has no…
  • 100claude-switch
    Switch Claude Code (CLI) and the Claude desktop app between several Claude accounts on one Mac with app_switch.py: one app profile per account, sessions carried by id, sidebar groups, routines and settings ported, and open app pane sessions resumed on the new account. Use when…
  • 100session-handoff
    Write a handoff file so a stuck session can resume in the other tool without losing context. Use when asked to "hand this off", "switch to Codex", "switch to Claude Code", "write a handoff", "I'm stuck, try the other tool", or when a session has burned several attempts on the same problem.
  • 91when-done-switch-to
    Arm a deferred model or effort switch. Use for "when done switch to", "after this drop to sonnet", or "switch model when idle".

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.