Skip to content

Instantly share code, notes, and snippets.

@shootdaj
Created March 3, 2026 04:49
Show Gist options
  • Select an option

  • Save shootdaj/48ed5a91c0443dc7cef83d1aae593231 to your computer and use it in GitHub Desktop.

Select an option

Save shootdaj/48ed5a91c0443dc7cef83d1aae593231 to your computer and use it in GitHub Desktop.
Claude Code Setup Script — Plugins, MCPs, permissions, Agent Expert system
#!/bin/bash
set -euo pipefail
# ============================================================================
# Claude Code Setup Script
# Replicates Anshul's Claude Code configuration for a friend
# Run: bash claude-code-setup.sh
# ============================================================================
CLAUDE_DIR="$HOME/.claude"
BLUE='\033[0;34m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
info() { echo -e "${BLUE}[INFO]${NC} $1"; }
done_() { echo -e "${GREEN}[DONE]${NC} $1"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
echo ""
echo "========================================"
echo " Claude Code Setup (Anshul's Config)"
echo "========================================"
echo ""
# --- Pre-checks ---
if ! command -v claude &> /dev/null; then
warn "Claude Code CLI not found. Install it first:"
echo " npm install -g @anthropic-ai/claude-code"
echo ""
read -p "Continue anyway? (y/n) " -n 1 -r
echo
[[ ! $REPLY =~ ^[Yy]$ ]] && exit 1
fi
mkdir -p "$CLAUDE_DIR"
# ============================================================================
# 1. SETTINGS.JSON — Permissions, hooks structure, plugins
# ============================================================================
info "Writing settings.json..."
cat > "$CLAUDE_DIR/settings.json" << 'SETTINGS_EOF'
{
"cleanupPeriodDays": 9999,
"permissions": {
"allow": [
"WebSearch",
"WebFetch",
"mcp__playwright__playwright_navigate",
"mcp__playwright__playwright_screenshot",
"mcp__playwright__playwright_click",
"mcp__playwright__playwright_fill",
"mcp__playwright__playwright_select",
"mcp__playwright__playwright_hover",
"mcp__playwright__playwright_press_key",
"mcp__playwright__playwright_evaluate",
"mcp__playwright__playwright_console_logs",
"mcp__playwright__playwright_get_visible_text",
"mcp__playwright__playwright_get_visible_html",
"mcp__playwright__playwright_go_back",
"mcp__playwright__playwright_go_forward",
"Bash(git status)",
"Bash(git log:*)",
"Bash(git diff:*)",
"Bash(git branch:*)",
"Bash(ls:*)",
"Bash(pwd)",
"Bash(npm list:*)",
"Bash(npm run --help)",
"Bash(node --version)",
"Bash(python --version)",
"Bash(which:*)"
],
"defaultMode": "default"
},
"enabledPlugins": {},
"sessionRetentionDays": 100000
}
SETTINGS_EOF
done_ "settings.json created"
# ============================================================================
# 2. CLAUDE.MD — Global instructions
# ============================================================================
info "Writing CLAUDE.md (global instructions)..."
cat > "$CLAUDE_DIR/CLAUDE.md" << 'CLAUDEMD_EOF'
# Global Claude Instructions
## Repository Creation
When creating new repositories, always create them on GitHub first using `gh repo create`, then clone locally. Do not use `git init` for new projects.
## Uncertainty Protocol
When not 100% sure about steps, commands, or implementation details, search the web first before proceeding. Do not guess or rely on potentially outdated knowledge.
## Library Selection
Never use or consider libraries with zero or very low GitHub stars. Libraries need demonstrated community traction before adoption.
## Follow Instructions
Always follow user instructions exactly. Don't let minor issues (tool failures, missing integrations, etc.) derail you from the task. Find alternative ways to accomplish the goal rather than abandoning it or asking for permission to do something different.
## File Deletion
NEVER use `rm` to permanently delete files. Always move files to Trash instead:
```bash
mv /path/to/file ~/.Trash/
```
This allows recovery if deletion was a mistake.
## Browser Automation
Use `agent-browser` for web automation. Run `agent-browser --help` for all commands.
Core workflow:
1. `agent-browser open <url>` - Navigate to page
2. `agent-browser snapshot -i` - Get interactive elements with refs (@e1, @e2)
3. `agent-browser click @e1` / `fill @e2 "text"` - Interact using refs
4. Re-snapshot after page changes
### When to use agent-browser (default choice):
- Basic navigation, clicking, form filling
- Long autonomous sessions (uses 82% less context than Playwright MCP)
- Simple verification tasks
- When context budget is tight
### When to use Playwright MCP instead:
- Network interception or request mocking needed
- PDF generation or full-page screenshots
- Multi-tab or multi-browser-context workflows
- Complex waits for dynamic/lazy-loaded content
- Advanced features not in agent-browser
CLAUDEMD_EOF
done_ "CLAUDE.md created"
# ============================================================================
# 3. AGENT EXPERT HOOK — Auto-learning system
# ============================================================================
info "Writing agent-expert-hook.json..."
cat > "$CLAUDE_DIR/agent-expert-hook.json" << 'HOOK_EOF'
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "prompt",
"prompt": "You just modified code. Remember to update the relevant expertise file in experts/ with:\n- New patterns or file locations discovered\n- Gotchas or edge cases encountered\n- Update the Change Log section\n\nThis is part of the Agent Expert learning system."
}
]
}
]
}
}
HOOK_EOF
done_ "Agent Expert hook created"
# ============================================================================
# 4. INSTALL PLUGINS
# ============================================================================
info "Installing plugins..."
echo " This installs official plugins and key extras."
echo ""
if command -v claude &> /dev/null; then
# Install all official marketplace plugins (they can be enabled/disabled later)
OFFICIAL_PLUGINS=(
"agent-sdk-dev"
"atlassian"
"code-review"
"commit-commands"
"context7"
"explanatory-output-style"
"feature-dev"
"figma"
"firebase"
"frontend-design"
"github"
"greptile"
"learning-output-style"
"notion"
"playwright"
"plugin-dev"
"pr-review-toolkit"
"sentry"
"serena"
"supabase"
"vercel"
"swift-lsp"
)
for plugin in "${OFFICIAL_PLUGINS[@]}"; do
info " Installing $plugin..."
claude plugin install "$plugin" 2>/dev/null || warn " Could not install $plugin (may need auth or manual install)"
done
# Claude HUD (third-party)
info " Installing claude-hud..."
claude plugin install claude-hud 2>/dev/null || warn " Could not install claude-hud (try: claude plugin install claude-hud)"
echo ""
info "Enabling recommended plugins..."
claude plugin enable notion 2>/dev/null || true
claude plugin enable vercel 2>/dev/null || true
claude plugin enable swift-lsp 2>/dev/null || true
claude plugin enable claude-hud 2>/dev/null || true
done_ "Plugins installed"
else
warn "Claude CLI not found — skipping plugin install."
echo " After installing Claude Code, run these manually:"
echo ""
echo " claude plugin install notion"
echo " claude plugin install vercel"
echo " claude plugin install swift-lsp"
echo " claude plugin install claude-hud"
echo ""
echo " Then enable them:"
echo " claude plugin enable notion"
echo " claude plugin enable vercel"
echo " claude plugin enable swift-lsp"
echo " claude plugin enable claude-hud"
echo ""
fi
# ============================================================================
# 5. INSTALL GSD (Get Shit Done) — Project management framework
# ============================================================================
info "Installing GSD (Get Shit Done) framework..."
echo " GSD adds structured project management with agents, phases, and workflows."
echo ""
if command -v claude &> /dev/null; then
# GSD installs itself when you run the init command in Claude Code
# The recommended way is to run it from within a Claude session
warn "GSD self-installs from within Claude Code."
echo " To install, start a Claude Code session and run:"
echo ""
echo ' Tell Claude: "Install GSD (Get Shit Done) framework"'
echo " Or visit: https://github.com/coleam00/get-shit-done"
echo ""
else
warn "Install GSD after setting up Claude Code:"
echo " Visit: https://github.com/coleam00/get-shit-done"
echo ""
fi
# ============================================================================
# 6. INSTALL agent-browser
# ============================================================================
info "Checking for agent-browser..."
if command -v agent-browser &> /dev/null; then
done_ "agent-browser already installed"
else
warn "agent-browser not found."
echo " Install it with:"
echo " npm install -g agent-browser"
echo ""
fi
# ============================================================================
# 7. EXPERT TEMPLATE
# ============================================================================
info "Creating experts/ template for Agent Expert system..."
mkdir -p experts
if [ ! -f experts/_template.md ]; then
cat > experts/_template.md << 'EXPERT_EOF'
# {Domain} Expertise
> Last updated: {date}
## Overview
Brief description of this domain.
## Key Files
- `path/to/important/file` — what it does
## Patterns & Conventions
- Pattern 1
- Pattern 2
## Gotchas & Edge Cases
- Gotcha 1
## Architecture Notes
How things fit together.
## Change Log
| Date | Change | Files |
|------|--------|-------|
EXPERT_EOF
done_ "Expert template created at experts/_template.md"
else
done_ "Expert template already exists"
fi
# ============================================================================
# SUMMARY
# ============================================================================
echo ""
echo "========================================"
echo " Setup Complete!"
echo "========================================"
echo ""
echo "What was configured:"
echo " 1. settings.json — Permissions whitelist, extended retention"
echo " 2. CLAUDE.md — Global instructions (safe defaults, web search, etc.)"
echo " 3. Agent Expert — Auto-learning hook for expertise files"
echo " 4. Plugins — Official plugins + claude-hud"
echo " 5. experts/ — Template for domain expertise tracking"
echo ""
echo "Still need manual setup:"
echo " - GSD framework — Run inside Claude: visit github.com/coleam00/get-shit-done"
echo " - agent-browser — npm install -g agent-browser"
echo " - MCP auth — Notion, Vercel, etc. need individual auth"
echo " - Playwright MCP — npx @anthropic-ai/claude-code mcp add playwright"
echo ""
echo "Tip: Start Claude Code and type /gsd:help to see all GSD commands"
echo " after installing the GSD framework."
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment