# Claude Code CLI - Quick Reference

## What This Skill Does

Claude Code blocks `--dangerously-skip-permissions` when running as root. This skill:
1. Guides you through OAuth authentication (if needed)
2. Creates a dedicated `claude-code` user
3. Copies your root credentials to the new user
4. Lets you run Claude CLI without permission prompts

## Quick Start

```bash
# If already authenticated as root (common in Zo environments)
bash Skills/claude-code-cli/scripts/setup-user.sh

# Run Claude with skip permissions
sudo -u claude-code claude --dangerously-skip-permissions -p "hello"
```

## OAuth Flow (if needed)

See `SKILL.md` Step 1 for full details with tmux commands:
1. Start tmux session: `tmux new-session -d -s claude_auth 'claude'`
2. Send `/login` command
3. Open OAuth URL in browser
4. Paste auth code back into tmux session
5. Verify credentials saved to `~/.claude/.credentials.json`

## Useful Aliases

Source the init script for handy shortcuts:
```bash
source Skills/claude-code-cli/scripts/init.sh

# Run Claude in safe mode
claude-prompt "write a python fibonacci function"

# Interactive mode without permissions
claude-safe
```

## Troubleshooting

**Credentials not found?**
- Check: `ls -la ~/.claude/.credentials.json`
- If missing, run OAuth flow (SKILL.md Step 1)
- Then re-run: `bash Skills/claude-code-cli/scripts/setup-user.sh`

**Permission denied?**
- Verify user exists: `id claude-code`
- Check ownership: `ls -ld /home/claude-code/.claude`
- Fix: `chown -R claude-code:claude-code /home/claude-code/.claude`

**OAuth login failing?**
- Make sure you opened the correct URL in browser
- Check tmux output: `tmux capture-pane -t claude_auth -p -S -50`
- Kill stuck session: `tmux kill-session -t claude_auth` and retry

## Files

- `SKILL.md` - Full documentation
- `scripts/setup-user.sh` - User setup & credential copy
- `scripts/init.sh` - Helpful aliases
- `README.md` - This quick reference