claude-code-internals
This skill should be used when the user asks to "explore claude code source", "find internal features", "investigate cli.js", "check beta headers", "discover hidden settings", or mentions "minified code analysis", "anthropic-beta headers", "context management internals".
$ Installer
git clone https://github.com/jongwony/cc-plugin /tmp/cc-plugin && cp -r /tmp/cc-plugin/claude-code-internals/skills/claude-code-internals ~/.claude/skills/cc-plugin// tip: Run this command in your terminal to install the skill
name: claude-code-internals description: >- This skill should be used when the user asks to "explore claude code source", "find internal features", "investigate cli.js", "check beta headers", "discover hidden settings", or mentions "minified code analysis", "anthropic-beta headers", "context management internals". context: fork
Claude Code Internals Explorer
Analyze Claude Code's minified source to understand internal behavior and discover features.
Important Caveats
- Minified code: Variable names are obfuscated (e.g.,
UnB,cT0) - Version-specific: Findings may change between versions
- Unofficial: Discovered features may be unsupported/unstable
- Token-intensive: Mitigated via subagent delegation (see Workflow Phase 0)
Quick Start
- Delegate exploration to Explore subagent:
Task tool (subagent_type: Explore)
Prompt: "Run ${CLAUDE_PLUGIN_ROOT}/scripts/find_installation.sh,
then search for [keyword] in cli.js. Report file paths and matching lines."
-
Analyze findings in main context (subagent returns summary)
-
Iterate with follow-up delegation if deeper investigation needed
Workflow
0. Delegate Context Gathering
Principle: Initial exploration consumes tokens in subagent context, preserving main context for analysis.
Call Task tool with:
subagent_type:Exploreprompt: Specify search target and expected output format
Example delegation:
Find Claude Code installation path using ${CLAUDE_PLUGIN_ROOT}/scripts/find_installation.sh.
Then search for patterns related to [feature] in cli.js.
Return: installation path, version, matching lines with context.
The subagent will:
- Execute shell scripts and grep commands
- Filter and summarize findings
- Return structured results to main context
Main agent then performs interpretation and decision-making.
1. Locate Source
Run scripts/find_installation.sh to find:
cli.jspath (minified JavaScript source, ~9.9MB)- Current version
- Binary location
Typical path: ~/.npm/_npx/*/node_modules/@anthropic-ai/claude-code/cli.js
2. Choose Investigation Type
| Goal | Approach |
|---|---|
| Specific feature | Search for known keywords |
| New version changes | Compare with known-features.md, check release notes |
| Hidden settings | Search for setting patterns |
| Beta features | Search for beta headers |
3. Search Strategies
For minified code, search string literals (not variable names).
Quick example:
grep -E "anthropic-beta|context-management" cli.js
See references/search-patterns.md for comprehensive patterns by category.
4. Analyze Findings
When you find relevant code:
- Note line numbers with
grep -n "pattern" cli.js - Extract surrounding context with
sed -n 'LINE-10,LINE+10p' cli.js - Trace related code by searching for adjacent strings
- Compare findings with
references/known-features.md
5. Document Discoveries
Update references/known-features.md with:
- New features found
- Changed defaults/thresholds
- New beta headers
- Corrected information
Common Investigations
| Task | Approach |
|---|---|
| Check feature enabled | grep -n "feature_name" cli.js -> examine conditional logic |
| Find default values | See references/search-patterns.md Settings section |
| Discover new commands | See references/search-patterns.md Commands section |
| Compare release notes | Search mentioned features -> compare with references/known-features.md |
Resources
- scripts/find_installation.sh: Locate Claude Code installation
- references/search-patterns.md: Comprehensive grep patterns by category
- references/known-features.md: Baseline of known features for comparison
Resource Map
| Resource | Path | Load When |
|---|---|---|
| Known features baseline | references/known-features.md | Comparing with new discoveries |
| Search pattern library | references/search-patterns.md | Investigating specific category |
| Installation finder | scripts/find_installation.sh | Starting investigation |
Tips
- Start narrow: Search specific terms before broad exploration
- Use line numbers:
-nflag helps locate code for context reading - Chain searches: Find one string, search nearby for related code
- Save findings: Update known-features.md to track discoveries
- Version awareness: Note version when documenting findings
Repository
