fredchu

Discord Claude Code Bot — Communication skill for Claude Code

Communication community

A lightweight Discord bot that bridges Discord threads to Claude Code CLI sessions.

How to install Discord Claude Code Bot

This entry records only its repository, not the path inside it, so there is no exact command to give. Open fredchu/discord-claude-code-bot and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Discord Claude Code Bot does

A lightweight Discord bot that bridges Discord threads to Claude Code CLI sessions.

Alternatives in Communication

  • Lark Coding Agent Bridge — Bot that bridges Feishu/Lark messenger with a local Claude Code or Codex CLI 2.4k ★
  • Claude Skill Social Post — A Claude Code skill by Hao (駱君昊) that learns your Facebook voice and auto-posts to FB / IG / Threads / X with 625 ★
  • Openab — A lightweight, secure, cloud-native ACP harness that bridges Discord and any ACP-compatible coding CLI 321 ★

README

discord-claude-code-bot

A lightweight Discord bot that bridges Discord threads to [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI sessions. Single file, ~1000 lines of TypeScript. Mention the bot in a thread, and it spawns a Claude Code process that persists across messages via `--resume`.

Features

  • Thread sessions — each Discord thread maps to a Claude Code session with automatic --resume
  • Thread context — fetches recent messages so Claude understands the conversation
  • Streaming preview — real-time response preview with tool-use status line while Claude is working
  • Interactive buttons — AskUserQuestion permission prompts rendered as Discord buttons
  • File attachments — send images, code, PDFs, or any file — auto-downloaded and passed to Claude Code's Read tool
  • Code fence splitting — long responses split into Discord-safe chunks without breaking code blocks
  • Resume local sessions — /resume-local picks up a terminal CC session from Discord (mobile use case); /handback returns it
  • SQLite storage — crash-safe session persistence with WAL mode (auto-migrates from legacy JSON)
  • Slash commands — /new, /model, /cd, /stop, /sessions, /resume-local, /handback, /help
  • Model switching — swap between opus, sonnet, haiku per thread
  • AI disclosure — first reply in each session includes an AI disclosure message

Quick Start

git clone https://github.com/fredchu/discord-claude-code-bot.git
cd discord-claude-code-bot
cp .env.example .env   # fill in your values
npm install
npm start

Prerequisites

  • Node.js 22+ (uses --env-file flag)
  • Claude Code CLI installed and authenticated
  • A Discord bot token (Discord Developer Portal)
  • A C++ compiler toolchain for building better-sqlite3 (Xcode CLT on macOS, build-essential on Linux)

Discord Bot Setup

  1. Create