From slack-go-sdk
Foundation skill for Slack Go SDK. Use when setting up a new Slack bot, initializing the API client, choosing between Web API vs Socket Mode vs Events API, implementing error handling patterns, or establishing testing strategies for Slack applications.
How this skill is triggered — by the user, by Claude, or both
Slash command
/slack-go-sdk:slack-client-fundamentalsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Initialize the Slack API client with your bot token:
Initialize the Slack API client with your bot token:
import "github.com/slack-go/slack"
api := slack.New("xoxb-your-bot-token")
Enable debug mode for development:
api := slack.New(
"xoxb-your-bot-token",
slack.OptionDebug(true),
)
Use for direct API calls where you initiate the action:
Use when your app runs behind a firewall and can't receive HTTP requests:
Use when you have a publicly accessible endpoint:
Always handle errors from API calls:
_, _, err := api.PostMessage(channelID, slack.MsgOptionText(text, false))
if err != nil {
// Handle specific error types
if rateLimitedError, ok := err.(*slack.RateLimitedError); ok {
// Wait and retry
time.Sleep(rateLimitedError.RetryAfter)
}
return fmt.Errorf("failed to post message: %w", err)
}
Use context for cancellation and timeouts:
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
// Pass context to API methods that support it
slack-bot/
├── cmd/
│ └── bot/
│ └── main.go # Entry point
├── internal/
│ ├── handlers/
│ │ ├── messages.go # Message handlers
│ │ ├── events.go # Event handlers
│ │ └── commands.go # Slash command handlers
│ ├── slack/
│ │ ├── client.go # Slack client wrapper
│ │ └── middleware.go # Authentication, rate limiting
│ └── config/
│ └── config.go # Configuration management
├── pkg/
│ └── models/ # Shared data models
├── go.mod
└── go.sum
See testing-patterns.md for comprehensive testing guidance including:
For advanced configuration including custom HTTP clients, retry strategies, and rate limiting:
Based on your use case, explore these skills:
slack-web-api skill for messaging, channels, users, filesslack-realtime-events skill for Socket Mode or Events APIslack-auth-security skill for multi-workspace authenticationnpx claudepluginhub linehaul-ai/linehaulai-claude-marketplace --plugin slack-go-sdkBuilds Slack apps with the Bolt framework in Python, JavaScript, or Java. Covers Block Kit UIs, slash commands, event handling, OAuth, and Workflow Builder integration.
Guides developers through creating a Slack app or agent using Bolt for JS or Python — prerequisites, sandbox setup, auth, project scaffolding, and local dev.