p:: AI

npm install -g @anthropic-ai/claude-code
claude
  • shift + tab twice to cycle to Plan Mode

Claude-Flow

GitHub - ruvnet/claude-flow: Claude-Flow v2.0.0 Alpha represents a revolutionary leap in AI-powered development orchestration. Built from the ground up with enterprise-grade architecture, advanced swarm intelligence, and seamless Claude Code integration.

npx claude-flow@alpha init
# Quick AI coordination (recommended for most tasks)
npx claude-flow@alpha swarm "build me a REST API"
 
# launch the full hive-mind system (for complex projects)
npx claude-flow@alpha hive-mind wizard
npx claude-flow@alpha hive-mind spawn "build enterprise system"

Sub agents

Sub agents - Anthropic

  • Create and use specialized AI sub agents in Claude Code for task-specific workflows and improved context management.
    • Has a specific purpose and expertise area
    • Uses its own context window separate from the main conversation
    • Can be configured with specific tools it’s allowed to use
    • Includes a custom system prompt that guides its behavior
/agents

code-reviewer

Expert code review specialist. Proactively reviews code for quality, security, and maintainability. Use immediately after writing or modifying code.

debugger

Debugging specialist for errors, test failures, and unexpected behavior. Use proactively when encountering any issues.

data-scientist

Data analysis expert for SQL queries, BigQuery operations, and data insights. Use proactively for data analysis tasks and queries.

Hooks

Hooks reference - Anthropic

vim ~/.claude/settings.json
{
  "model": "opus",
  "hooks": {
    "Notification": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "say 'Awaiting your input'"
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "say 'User prompt submitted'"
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "say 'Stopping'"
          }
        ]
      }
    ],
    "SubagentStop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "say 'Subagent stopping'"
          }
        ]
      }
    ]
  }
}

ccusage

bunx ccusage
 
# Real-time usage dashboard
bunx ccusage blocks --live

Set up Claude Code

Terminal bell notifications

Enable sound alerts when tasks complete:

claude config set --global preferredNotifChannel terminal_bell

iTerm 2 system notifications

For iTerm 2 alerts when tasks complete:

  1. Open iTerm 2 Preferences
  2. Navigate to Profiles → Terminal
  3. Enable “Silence bell” and Filter Alerts → “Send escape sequence-generated alerts”
  4. Set your preferred notification delay

Handling large inputs

When working with extensive code or long instructions:

  • Avoid direct pasting: Claude Code may struggle with very long pasted content
  • Use file-based workflows: Write content to a file and ask Claude to read it

Claude Code Best Practices

Use custom slash commands

vim .claude/commands/fix-github-issue.md
Please analyze and fix the GitHub issue: $ARGUMENTS.
 
Follow these steps:
 
1. Use `gh issue view` to get the issue details
2. Understand the problem described in the issue
3. Search the codebase for relevant files
4. Implement the necessary changes to fix the issue
5. Write and run tests to verify the fix
6. Ensure code passes linting and type checking
7. Create a descriptive commit message
8. Push and create a PR
 
Remember to use the GitHub CLI (`gh`) for all GitHub-related tasks.
/fix-github-issue 1234

Safe YOLO mode

claude --dangerously-skip-permissions

bypass all permission checks and let Claude work uninterrupted until completion