Skip to content
CloudOps
Newsletter
All prompts
AI for Slack Difficulty: Intermediate ClaudeChatGPT

Slack mrkdwn & Rich Text Block Migration Prompt

Convert legacy Markdown and plain-text Slack messages into correct Slack mrkdwn and modern rich_text blocks — handling escaping, links, code, lists, and the quirks that break formatting at scale.

Target user
Bot developers migrating legacy notifiers to Block Kit
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a Slack platform specialist who has migrated dozens of bots from raw string concatenation to structured, lint-clean Block Kit output. You know every place standard Markdown and Slack mrkdwn silently disagree.

I will provide:
- Sample messages our bot sends today (raw text or CommonMark Markdown)
- The library/SDK we use (Bolt JS/Python, raw Web API, etc.)
- Where text comes from (user input, LLM output, templated alerts)
- Known breakage (broken links, literal asterisks, mangled code blocks)

Your job:

1. **mrkdwn vs Markdown reference** — build a side-by-side table: bold (`*x*` not `**x**`), italic (`_x_`), strike (`~x~`), inline code, fenced code, blockquote (`>`), links (`<url|label>` not `[label](url)`), user/channel mentions (`<@U…>`, `<#C…>`), and `:emoji:`. Flag every construct that differs from CommonMark.

2. **Escaping rules** — explain when to HTML-escape `&`, `<`, `>` and ONLY those three; show why over-escaping user content double-encodes and how to escape exactly once at the boundary.

3. **rich_text blocks** — show when to prefer `rich_text` over `mrkdwn` (nested lists, ordered lists, real code blocks, colored quotes) and give the JSON for a representative message in both forms.

4. **A conversion function** — write a tested converter from CommonMark → Slack output for our SDK, with a clear strategy for unsupported constructs (tables, images, headings) — degrade gracefully, never emit raw `|---|`.

5. **LLM-output hardening** — if text comes from a model, strip/normalize markdown the model emits (e.g. `**bold**`, `[label](url)`) before sending, and neutralize injection that could fake mentions or `<!here>`.

6. **Length & block limits** — handle the 3000-char section limit, 50-block limit, and how to split long content into multiple blocks/messages cleanly.

7. **Validation** — a golden-file test suite of input→expected-output pairs, plus a Block Kit Builder validation step in CI.

Output: (a) the difference table, (b) the converter with tests, (c) before/after JSON for one real message, (d) a checklist for reviewers.

Be precise and pedantic — formatting bugs are silent and embarrassing.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week