Claude Code Slack Bot banner
mpociot mpociot

Claude Code Slack Bot

Data & AI community intermediate

Description

This is a TypeScript-based Slack bot that integrates with the Claude Code SDK to provide AI-powered coding assistance directly within Slack workspaces.

Installation

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

README

Claude Code Slack Bot

This is a TypeScript-based Slack bot that integrates with the Claude Code SDK to provide AI-powered coding assistance directly within Slack workspaces.

Project Overview

The bot allows users to interact with Claude Code through Slack, providing real-time coding assistance, file analysis, code reviews, and project management capabilities. It supports both direct messages and channel conversations, with sophisticated working directory management and task tracking.

Architecture

Core Components

  • src/index.ts - Application entry point and initialization
  • src/config.ts - Environment configuration and validation
  • src/slack-handler.ts - Main Slack event handling and message processing
  • src/claude-handler.ts - Claude Code SDK integration and session management
  • src/working-directory-manager.ts - Working directory configuration and resolution
  • src/file-handler.ts - File upload processing and content embedding
  • src/todo-manager.ts - Task list management and progress tracking
  • src/mcp-manager.ts - MCP server configuration and management
  • src/logger.ts - Structured logging utility
  • src/types.ts - TypeScript type definitions

Key Features

1. Working Directory Management

  • Base Directory Support: Configure a base directory (e.g., /Users/username/Code/) to use short project names
  • Channel Defaults: Each channel gets a default working directory when the bot is first added
  • Thread Overrides: Individual threads can override the channel default by mentioning the bot
  • Hierarchy: Thread-specific > Channel default > DM-specific
  • Smart Resolution: Supports both relative paths (cwd project-name) and absolute paths

2. Real-Time Task Tracking

  • Todo Lists: Displays Claude's planning process as formatted task lists in Slack
  • Progress Updates: Updates task status in real-time as Claude works
  • Priority Indicators: Visual priority levels (🔴 High, 🟡 Medium, 🟢 Low)
  • Status Reactions: Emoji reactions on original messages show overall progress
  • Live Updates: Single message updates instead of spam

3. File Upload Support

  • Multiple Formats: Images (JPG, PNG, GIF, WebP), text files, code files, documents
  • Content Embedding: Text files are embedded directly in prompts
  • Image Analysis: Images are saved for Claude to analyze using the Read tool
  • Size Limits: 50MB file size limit with automatic cleanup
  • Security: Secure download using Slack bot token authentication

4. Advanced Message Handling

  • Streaming Responses: Real-time message updates as Claude generates responses
  • Tool Formatting: Rich formatting for file edits, bash commands, and other tool usage
  • Status Indicators: Clear visual feedback (🤔 Thinking, ⚙️ Working, ✅ Completed)
  • Error Handling: Graceful error recovery with informative messages
  • Session Management: Conversation context maintained