Agent skill
slack-blockkit-ui
Render rich Block Kit messages in Slack from AI agent tool results. Use when building agents that display formatted responses with sections, images, and buttons.
Install this agent skill to your Project
npx add-skill https://github.com/rbarazi/agent-skills/tree/main/skills/slack-blockkit-ui
SKILL.md
Slack Block Kit UI Responses
Render rich, interactive Block Kit messages in Slack from AI agent tool results.
Problem Statement
Plain text responses limit how agents can present information. Block Kit enables rich formatting - headers, sections, images, buttons - making agent responses more useful and actionable.
When to Use
- Displaying structured data (weather, reports, dashboards) in Slack
- Adding interactive buttons to agent responses
- Rendering multi-section content with formatting
- Keywords: block kit, slack blocks, rich messages, interactive messages, slack ui
Quick Start
# MCP tool returns Block Kit as resource
WidgetTemplateService.hydrate_for_tool_result(
template: :weatherCurrent,
slack_blocks_template: :slackBlockKitWeatherCurrent,
data: { location: "Toronto", temperature: "-5°C" },
text: "Current weather in Toronto"
)
Architecture
Tool Call → MCP Server → Tool Result with slack://blocks/ resource
↓
SlackResourceExtractor detects blocks
↓
SlackTaskResponseService sends chat_postMessage with blocks
Resource Format
{
type: "resource",
resource: {
uri: "slack://blocks/weather/uuid",
mimeType: "application/vnd.slack.blocks+json",
text: '{ "blocks": [...] }'
}
}
Key Constants
# app/mcp_servers/base_mcp_server.rb
SLACK_BLOCKS_MIME_TYPE = "application/vnd.slack.blocks+json"
SLACK_BLOCKS_URI_PREFIX = "slack://blocks/"
Testing Strategy
RSpec.describe SlackResourceExtractor do
let(:message) { create(:message, metadata: block_kit_metadata) }
it "detects block kit resources" do
expect(described_class.has_blocks?(message)).to be true
end
it "extracts blocks array" do
result = described_class.extract_blocks(message)
expect(result[:blocks]).to be_an(Array)
end
end
Block Kit Limits
- Maximum 50 blocks per message
- Maximum 3000 characters per text field
- Maximum 10 elements per actions block
Common Pitfalls
- Text fallback required: Always provide
text:for notifications - Text type matters: Use
mrkdwnfor formatting,plain_textfor buttons - Image URLs: Must be HTTPS and publicly accessible
- Action IDs: Must be unique within the message
Reference Files
- extractor.md - SlackResourceExtractor for detecting/extracting blocks
- response-service.md - SlackTaskResponseService orchestration
- mrkdwn.md - Markdown to mrkdwn conversion
- templates.md - YAML Block Kit template patterns
- actions.md - Handling button interactions
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
test-auth-helpers
Implement authentication testing patterns with RSpec, FactoryBot, and test helpers for Rails applications. Use when writing controller specs, system tests, or request specs that require authenticated users and multi-tenant account context.
multi-tenant-accounts
Implement multi-tenant architecture using an Account model as the tenant boundary. Use when building SaaS applications, team-based apps, or any system where data must be isolated between organizations/accounts.
user-management
Implement user CRUD operations within an account with permission controls and feature flags. Use when building team member management, user administration, or account user settings in multi-tenant Rails applications.
oauth21-provider
Implement an RFC-compliant OAuth 2.1 authorization server in Rails applications. Use when building apps that need to authorize third-party clients (like MCP clients, API consumers, or external integrations) using industry-standard OAuth flows with PKCE, dynamic client registration, and token management.
password-reset-flow
Implement secure password reset with Rails 8's built-in token generation. Use when building "forgot password" functionality with email verification and time-limited reset tokens.
code-pattern-extraction
Extract reusable design and implementation patterns from codebases into Skills. Use when asked to analyze code for patterns, document architectural decisions, create transferrable implementation guides, or extract knowledge into Skills. Transforms working implementations into comprehensive, reusable Skills that can be applied to new projects.
Didn't find tool you were looking for?