How this skill is triggered — by the user, by Claude, or both
Slash command
/topic-switch:initThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are running the `topic-switch:init` skill. Your job is to scan the current project, detect logical topic boundaries, and write a `.claude/topic-switch.json` config file. Be conversational -- ask the user before making decisions.
You are running the topic-switch:init skill. Your job is to scan the current project, detect logical topic boundaries, and write a .claude/topic-switch.json config file. Be conversational -- ask the user before making decisions.
Follow these steps in order:
Use the Read tool to check if .claude/topic-switch.json already exists in the project root.
If a CLAUDE.md file exists at the project root, read it. Look for architecture sections, directory layout descriptions, or domain organization hints. Use this context to make smarter topic boundary suggestions in step 3.
Use the Glob tool to detect the project type and find topic boundaries. Try these patterns in order and use the first set that produces meaningful results:
| Project type | Glob patterns to try |
|---|---|
| Go | cmd/*/, internal/*/, pkg/*/ |
| React / Next.js | src/features/*/, src/pages/*/, src/components/*/, app/*/ |
| Monorepo | packages/*/, apps/*/, services/*/ |
| Python | src/*/, */__init__.py |
| Generic fallback | Top-level directories, then check which ones contain 3+ source files |
You may detect multiple patterns (e.g., a Go project with both cmd/*/ and internal/*/). Include all that apply.
For each matching pattern, extract the list of topic names (the directory names matched by the wildcard).
Also identify directories that look like shared utilities rather than distinct topics. Common indicators:
util, utils, shared, common, lib, helpers, internal/pkgPresent your findings to the user in this format:
I found these topic areas in your project:
Pattern: <glob pattern>
Topics: <comma-separated list of directory names>
Suggested ignore: <directories that look like shared utilities>
Default message threshold: 30 (suggest a topic switch after 30 messages on one topic)
Does this look right? Any topics to add or remove? Want a different threshold?
If CLAUDE.md provided useful architecture context, mention what you learned from it.
Wait for the user to confirm or adjust before continuing.
After the user confirms, create .claude/topic-switch.json with this structure:
{
"topic_roots": ["<pattern1>", "<pattern2>"],
"ignore": ["<shared-util-path1>"],
"message_threshold": 30
}
topic_roots: The glob patterns that define topic boundaries (e.g., internal/verda-cli/cmd/*)ignore: Paths within topic_roots that are shared utilities, not standalone topicsmessage_threshold: Number of messages before suggesting a topic switch (use the user's preference, default 30)Use the Write tool to create the file. Make sure the .claude/ directory exists first.
Check if .claude/topic-switch.json is already covered by existing .gitignore patterns. Read .gitignore if it exists and look for patterns like .claude/, .claude/*, or .claude/topic-switch.json.
If the config file is NOT covered, append .claude/topic-switch.json to .gitignore on a new line. If there is no .gitignore, create one with that single entry.
Print this message:
topic-switch configured! I'll watch for topic shifts as you work.
Creates bite-sized, testable implementation plans from specs or requirements, with file structure and task decomposition. Activates before coding multi-step tasks.
npx claudepluginhub hi-lei/topic-switch