[IMPORTANT] Use TaskCreate to break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI may ask user whether to skip.
Quick Summary
Goal: Help users install, configure, troubleshoot, and extend Claude Code CLI (hooks, MCP, skills, commands).
Workflow:
- Categorize — Identify problem type (Setup, Hooks, MCP, Context, Extensibility, Config)
- Diagnose — Follow category-specific diagnostic steps
- Fix & Verify — Apply solution and confirm it resolves the issue
Key Rules:
- Not for writing application code -- use feature/fix/refactor skills instead
- Never modify settings without user approval
- For hooks: check event type, script executability, and JSON output format
Claude Code
Purpose
Help users install, configure, troubleshoot, and extend Claude Code CLI -- Anthropic's agentic coding tool with skills, hooks, MCP servers, and slash commands.
When to Use
- Setting up Claude Code for the first time (installation, authentication)
- Troubleshooting hooks that don't fire or produce errors
- Diagnosing MCP server connection failures
- Understanding or resolving context window limits
- Creating or modifying slash commands and agent skills
- Configuring settings (model, allowed tools, output style)
When NOT to Use
- Writing application code -- use
feature-implementation, fix, or refactoring skills
- Creating MCP servers from scratch -- use
mcp-builder skill
- Managing existing MCP server connections -- use
mcp-management skill
- AI prompt engineering -- use
ai-artist skill
Prerequisites
- Access to
.claude/ directory in the project root
- For hooks: read
.claude/hooks/ directory structure
- For skills: read
.claude/skills/ directory structure
Workflow
Step 1: Identify the Problem Category
| User Says |
Category |
Go To |
| "install", "set up", "authenticate" |
Setup |
Step 2A |
| "hook not firing", "hook error" |
Hook Issues |
Step 2B |
| "MCP not connecting", "MCP error" |
MCP Issues |
Step 2C |
| "context too long", "compaction", "token limit" |
Context Issues |
Step 2D |
| "create skill", "create command" |
Extensibility |
Step 2E |
| "configure", "settings", "model" |
Configuration |
Step 2F |
Step 2A: Setup
- Check prerequisites: Node.js 18+, npm
- Verify authentication:
claude auth status
- IF auth fails: guide through
claude auth login
- Verify project detection: check for
CLAUDE.md in project root
Step 2B: Hook Issues
- Read the hook file causing issues
- Check hook event type matches expected trigger (PreToolUse, PostToolUse, SessionStart, Stop, SubagentStop)
- Verify hook script is executable and has correct shebang
- Check
.claude/settings.json for hook registration
- Test hook in isolation: run the script directly with mock input
- Check for syntax errors in hook output (must be valid JSON for PreToolUse/PostToolUse)
Common fixes:
- Hook not firing: wrong event name or tool matcher pattern
- Hook errors: script not finding dependencies (check relative paths)
- Hook blocks unexpectedly: PreToolUse returning
{ "decision": "block" } incorrectly
Step 2C: MCP Issues
- Check
.claude/settings.json for MCP server configuration
- Verify the MCP server process can start: run the command manually
- Check environment variables (API keys, tokens) are set
- Test connectivity:
claude mcp list to see registered servers
- IF timeout: increase timeout in config or check network
Common fixes:
- "Connection refused": MCP server not running or wrong port
- "Authentication failed": expired or missing API token
- "Tool not found": MCP server registered but tool name mismatch
Step 2D: Context Issues
- Check current context usage (Claude will report when near limit)
- IF approaching limit: suggest
/compact command
- Review if large files are being read unnecessarily
- Check for recovery files in
/tmp/ck/swap/ after compaction
- Verify
post-compact-recovery hook is configured for session continuity
Step 2E: Extensibility
- For skills: read
references/agent-skills.md for structure
- For custom slash commands: create skills in
.claude/skills/{name}/SKILL.md
- Verify SKILL.md frontmatter has required fields (name, version, description)
- Test: invoke the skill/command and verify it loads
Step 2F: Configuration
- Read
references/configuration.md for settings hierarchy
- Settings locations:
.claude/settings.json (project), ~/.claude/settings.json (user)
- IMPORTANT: Never modify settings without user approval
- Common settings: model selection, allowed tools, output verbosity
Step 3: Verification
- Confirm the fix resolves the user's issue
- Document any configuration changes made
- Warn if changes affect other team members (project-level settings)
Output Format
## Claude Code: [Issue/Task Summary]
### Problem
[What was wrong or what was requested]
### Solution
[Step-by-step fix or setup instructions]
### Files Changed
[List any config files modified, with before/after]
### Verification
[How to confirm the fix works]
Examples
Example 1: Hook Not Firing
User: "My PreToolUse hook for blocking large file reads isn't triggering"
Diagnosis:
- Read
.claude/settings.json -- hook registered under hooks.PreToolUse
- Check tool matcher:
"matcher": "Read" -- correct
- Run script directly:
node .claude/hooks/block-large-reads.cjs -- works
- Found: Hook command uses
%CLAUDE_PROJECT_DIR% but runs from wrong CWD
Fix: Update hook command to use absolute path or verify %CLAUDE_PROJECT_DIR% resolves correctly. Check that the hook entry in settings uses the correct variable syntax for the platform (Windows vs Unix).
Example 2: Setting Up a New Slash Command
User: "I want a /deploy command that runs our staging deployment"
Steps:
- Create
.claude/skills/deploy/SKILL.md:
Deploy to staging environment.
Run the following steps:
1. Verify all tests pass: `npm test`
2. Build the project: `npm run build`
3. Deploy: `npm run deploy:staging`
4. Report deployment status
- Test: type
/deploy in Claude Code CLI
- Verify: command appears in autocomplete and executes the workflow
Reference Files
Load these for detailed guidance on specific topics:
| Topic |
File |
| Installation |
references/getting-started.md |
| Slash commands |
references/slash-commands.md |
| Skills creation |
references/agent-skills.md |
| MCP servers |
references/mcp-integration.md |
| Hooks system |
references/hooks-comprehensive.md |
| Configuration |
references/configuration.md |
| Troubleshooting |
references/troubleshooting.md |
| Enterprise |
references/enterprise-features.md |
Related Skills
mcp-builder -- for creating new MCP servers from scratch
mcp-management -- for managing existing MCP server connections
skill-creator -- for creating new agent skills with best practices
IMPORTANT Task Planning Notes (MUST FOLLOW)
- Always plan and break work into many small todo tasks
- Always add a final review todo task to verify work quality and identify fixes/enhancements
1---2name: claude-code-43description: [Utilities] Claude Code CLI setup, configuration, troubleshooting, and feature guidance. Triggers on claude code setup, hook not firing, MCP connection, context limit, skill creation, slash command setup.4---5
6> **[IMPORTANT]** Use `TaskCreate` to break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI may ask user whether to skip.
7
8## Quick Summary
9
10**Goal:** Help users install, configure, troubleshoot, and extend Claude Code CLI (hooks, MCP, skills, commands).
11
12**Workflow:**
13
141. **Categorize** — Identify problem type (Setup, Hooks, MCP, Context, Extensibility, Config)
152. **Diagnose** — Follow category-specific diagnostic steps
163. **Fix & Verify** — Apply solution and confirm it resolves the issue
17
18**Key Rules:**
19
20- Not for writing application code -- use feature/fix/refactor skills instead
21- Never modify settings without user approval
22- For hooks: check event type, script executability, and JSON output format
23
24# Claude Code
25
26## Purpose
27
28Help users install, configure, troubleshoot, and extend Claude Code CLI -- Anthropic's agentic coding tool with skills, hooks, MCP servers, and slash commands.
29
30## When to Use
31
32- Setting up Claude Code for the first time (installation, authentication)
33- Troubleshooting hooks that don't fire or produce errors
34- Diagnosing MCP server connection failures
35- Understanding or resolving context window limits
36- Creating or modifying slash commands and agent skills
37- Configuring settings (model, allowed tools, output style)
38
39## When NOT to Use
40
41- Writing application code -- use `feature-implementation`, `fix`, or `refactoring` skills
42- Creating MCP servers from scratch -- use `mcp-builder` skill
43- Managing existing MCP server connections -- use `mcp-management` skill
44- AI prompt engineering -- use `ai-artist` skill
45
46## Prerequisites
47
48- Access to `.claude/` directory in the project root
49- For hooks: read `.claude/hooks/` directory structure
50- For skills: read `.claude/skills/` directory structure
51
52## Workflow
53
54### Step 1: Identify the Problem Category
55
56| User Says | Category | Go To |
57| ----------------------------------------------- | -------------- | ------- |
58| "install", "set up", "authenticate" | Setup | Step 2A |
59| "hook not firing", "hook error" | Hook Issues | Step 2B |
60| "MCP not connecting", "MCP error" | MCP Issues | Step 2C |
61| "context too long", "compaction", "token limit" | Context Issues | Step 2D |
62| "create skill", "create command" | Extensibility | Step 2E |
63| "configure", "settings", "model" | Configuration | Step 2F |
64
65### Step 2A: Setup
66
671. Check prerequisites: Node.js 18+, npm
682. Verify authentication: `claude auth status`
693. IF auth fails: guide through `claude auth login`
704. Verify project detection: check for `CLAUDE.md` in project root
71
72### Step 2B: Hook Issues
73
741. Read the hook file causing issues
752. Check hook event type matches expected trigger (PreToolUse, PostToolUse, SessionStart, Stop, SubagentStop)
763. Verify hook script is executable and has correct shebang
774. Check `.claude/settings.json` for hook registration
785. Test hook in isolation: run the script directly with mock input
796. Check for syntax errors in hook output (must be valid JSON for PreToolUse/PostToolUse)
80
81**Common fixes:**
82
83- Hook not firing: wrong event name or tool matcher pattern
84- Hook errors: script not finding dependencies (check relative paths)
85- Hook blocks unexpectedly: PreToolUse returning `{ "decision": "block" }` incorrectly
86
87### Step 2C: MCP Issues
88
891. Check `.claude/settings.json` for MCP server configuration
902. Verify the MCP server process can start: run the command manually
913. Check environment variables (API keys, tokens) are set
924. Test connectivity: `claude mcp list` to see registered servers
935. IF timeout: increase timeout in config or check network
94
95**Common fixes:**
96
97- "Connection refused": MCP server not running or wrong port
98- "Authentication failed": expired or missing API token
99- "Tool not found": MCP server registered but tool name mismatch
100
101### Step 2D: Context Issues
102
1031. Check current context usage (Claude will report when near limit)
1042. IF approaching limit: suggest `/compact` command
1053. Review if large files are being read unnecessarily
1064. Check for recovery files in `/tmp/ck/swap/` after compaction
1075. Verify `post-compact-recovery` hook is configured for session continuity
108
109### Step 2E: Extensibility
110
1111. For skills: read `references/agent-skills.md` for structure
1122. For custom slash commands: create skills in `.claude/skills/{name}/SKILL.md`
1133. Verify SKILL.md frontmatter has required fields (name, version, description)
1144. Test: invoke the skill/command and verify it loads
115
116### Step 2F: Configuration
117
1181. Read `references/configuration.md` for settings hierarchy
1192. Settings locations: `.claude/settings.json` (project), `~/.claude/settings.json` (user)
1203. IMPORTANT: Never modify settings without user approval
1214. Common settings: model selection, allowed tools, output verbosity
122
123### Step 3: Verification
124
125- Confirm the fix resolves the user's issue
126- Document any configuration changes made
127- Warn if changes affect other team members (project-level settings)
128
129## Output Format
130
131```markdown
132## Claude Code: [Issue/Task Summary]
133
134### Problem
135
136[What was wrong or what was requested]
137
138### Solution
139
140[Step-by-step fix or setup instructions]
141
142### Files Changed
143
144[List any config files modified, with before/after]
145
146### Verification
147
148[How to confirm the fix works]
149```
150
151## Examples
152
153### Example 1: Hook Not Firing
154
155**User**: "My PreToolUse hook for blocking large file reads isn't triggering"
156
157**Diagnosis**:
158
1591. Read `.claude/settings.json` -- hook registered under `hooks.PreToolUse`
1602. Check tool matcher: `"matcher": "Read"` -- correct
1613. Run script directly: `node .claude/hooks/block-large-reads.cjs` -- works
1624. **Found**: Hook command uses `%CLAUDE_PROJECT_DIR%` but runs from wrong CWD
163
164**Fix**: Update hook command to use absolute path or verify `%CLAUDE_PROJECT_DIR%` resolves correctly. Check that the hook entry in settings uses the correct variable syntax for the platform (Windows vs Unix).
165
166### Example 2: Setting Up a New Slash Command
167
168**User**: "I want a /deploy command that runs our staging deployment"
169
170**Steps**:
171
1721. Create `.claude/skills/deploy/SKILL.md`:
173
174```markdown
175Deploy to staging environment.
176
177Run the following steps:
178
1791. Verify all tests pass: `npm test`
1802. Build the project: `npm run build`
1813. Deploy: `npm run deploy:staging`
1824. Report deployment status
183```
184
1852. Test: type `/deploy` in Claude Code CLI
1863. Verify: command appears in autocomplete and executes the workflow
187
188## Reference Files
189
190Load these for detailed guidance on specific topics:
191
192| Topic | File |
193| --------------- | ----------------------------------- |
194| Installation | `references/getting-started.md` |
195| Slash commands | `references/slash-commands.md` |
196| Skills creation | `references/agent-skills.md` |
197| MCP servers | `references/mcp-integration.md` |
198| Hooks system | `references/hooks-comprehensive.md` |
199| Configuration | `references/configuration.md` |
200| Troubleshooting | `references/troubleshooting.md` |
201| Enterprise | `references/enterprise-features.md` |
202
203## Related Skills
204
205- `mcp-builder` -- for creating new MCP servers from scratch
206- `mcp-management` -- for managing existing MCP server connections
207- `skill-creator` -- for creating new agent skills with best practices
208
209---
210
211**IMPORTANT Task Planning Notes (MUST FOLLOW)**
212
213- Always plan and break work into many small todo tasks
214- Always add a final review todo task to verify work quality and identify fixes/enhancements