How to Do Slack Bot Creation on Claude Code

In this article

Claude Code is the fastest way to scaffold and wire up a Slack bot from scratch. Give it a plain-English prompt describing your bot's commands and you'll have a working Node.js (or Python) skeleton, proper Slack API plumbing, and event-handler boilerplate in one session. The catch: Slack bot projects generate a lot of back-and-forth with Claude, which burns through your Claude Code usage limits faster than you'd expect.

  • A complete Slack bot scaffold (app manifest, handlers, ngrok tunnel setup) typically takes 3-6 Claude Code exchanges.
  • Claude Code usage resets on a 5-hour rolling window (Anthropic docs).
  • Running out of tokens mid-build means a hard stop until the window resets -- a frustrating 5-hour lockout right when you're wrapping up a PR.

What you need before you start

Before firing up Claude Code, have these ready so the session stays focused:

  • A Slack workspace where you have permission to install apps (a free dev workspace works).
  • A Slack App created at api.slack.com/apps -- you'll need the Bot Token and Signing Secret.
  • Node.js 18+ or Python 3.10+ installed locally.
  • A tunneling tool (ngrok or Cloudflare Tunnel) so Slack can reach your local server during development.

How to scaffold the Slack bot with Claude Code

Step 1: open Claude Code in your project directory

Navigate to an empty project folder and launch Claude Code. A focused, well-scoped prompt saves tokens and avoids unnecessary back-and-forth.

Step 2: write a precise scaffolding prompt

The more specific your first message, the fewer follow-up rounds you need. A good template:

Create a Slack bot in Node.js using @slack/bolt.
- Respond to the slash command /standup with a modal asking for today's update
- Post the collected response to #standup channel
- Use dotenv for SLACK_BOT_TOKEN and SLACK_SIGNING_SECRET
- Include a package.json with start and dev scripts

Claude Code will generate the full file tree: app.js, .env.example, package.json, and handler modules. For more on getting the most from slash-command style prompts, see the guide on how to use Claude Code slash commands.

Step 3: configure your Slack app manifest

Ask Claude Code to generate a Slack app manifest (manifest.yaml) matching your bot's scopes and event subscriptions. Claude can output the exact YAML you paste into the App Manifest editor in the Slack dashboard -- no manual scope hunting required.

Step 4: wire up environment variables and run

Copy .env.example to .env and fill in your tokens. Then start the dev server and your tunnel:

npm run dev
ngrok http 3000

Paste the ngrok HTTPS URL into your Slack app's Event Subscriptions and Slash Commands Request URLs. Claude Code can walk you through this step-by-step if you're new to Slack's verification handshake.

Step 5: iterating on features

Use the /clear slash command in Claude Code between major feature additions to reset context and conserve tokens. If you're adding OAuth user installs, Claude Code can generate the full OAuth 2.0 redirect flow -- similar to the patterns covered in the OAuth2 login flow guide.

Common Slack bot patterns Claude Code handles well

  • Slash commands: /remind, /poll, /standup -- Claude Code generates the Bolt handler and the Slack API payload in one shot.
  • Interactive modals and Block Kit: describe your form fields in plain English and Claude Code outputs the JSON Block Kit structure and the view_submission handler.
  • Event subscriptions: reacting to messages, mentions, and reactions -- just specify the event type and the logic.
  • Webhooks and scheduled messages: Claude Code can scaffold a cron job that posts daily digests using the chat.scheduleMessage API.
  • API integrations: connecting your bot to external APIs (Jira, GitHub, Linear) follows the same patterns as the API integration workflow.
  • Deployment: ask Claude Code to generate a Dockerfile or a Railway/Render config when you're ready to ship. The Dockerfile creation guide covers this in detail.

How token usage adds up during Slack bot development

Slack bot projects are iterative by nature. You test a command, something breaks, you ask Claude Code to debug, you add another handler, and so on. Each exchange consumes tokens. According to Anthropic's usage documentation, Claude Code usage is shared with your overall Claude plan limits and resets on a rolling 5-hour window.

The problem: you don't know how close you are to the limit until you hit it. Getting cut off at 80% through scaffolding a Slack bot -- or worse, mid-debug on a broken event handler -- is exactly the kind of friction that kills momentum.

To monitor your usage in real time, you can run the /usage command inside Claude Code, check claude.ai/settings/usage, or use Usagebar -- a macOS menu bar app that shows your live Claude Code usage with smart alerts at 50%, 75%, and 90% so you never hit a surprise lockout mid-build.

Staying in flow: tips to avoid a mid-build lockout

  • Front-load the hard work. Ask Claude Code to generate the full bot skeleton in one detailed prompt rather than piece-by-piece. Fewer round trips, fewer tokens spent.
  • Use /clear between phases. Clearing context between scaffolding, debugging, and deployment reduces token overhead from long conversation histories.
  • Check usage before long sessions. Knowing you have 40% left before a 5-hour window reset lets you decide whether to push through or wait.
  • Monitor limits passively. Tools like Usagebar sit in your macOS menu bar and surface 50/75/90% alerts without requiring you to context-switch away from your terminal. Credentials are stored securely in macOS Keychain. It's free for students, and pay-what-you-want for everyone else.

The Slack bolt framework itself has solid official documentation -- Claude Code works best when paired with it, not as a replacement for understanding the underlying API.

Key takeaways

  1. Start with a detailed, scoped prompt to minimize back-and-forth token spend.
  2. Use Claude Code to generate the Slack app manifest, Bolt handlers, Block Kit JSON, and environment scaffold in one session.
  3. Use /clear between major feature phases to keep context lean.
  4. Track your rolling 5-hour usage window proactively -- Claude Code projects can exhaust limits faster than expected.
  5. Deploy with a Claude Code-generated Dockerfile or platform config when local development is complete.

Sources

Never Get Locked Out Mid-Task Again

Never hit your usage limits unexpectedly. Usagebar lives in your menu bar and shows your 5-hour and weekly limits at a glance.

Get Usagebar

$9 — one-time, lifetime updates