paste

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/paste — Clean content for any destination

/paste — 为任意目标平台清理内容

Cleans terminal output (ANSI, box-drawing, prompt artifacts, etc.) and reformats per destination rules. Reads clipboard by default, writes back to clipboard + previews in chat.
清理终端输出(ANSI代码、方框绘制字符、提示符痕迹等),并根据目标平台规则重新格式化。默认读取剪贴板内容,处理后写回剪贴板并在聊天中展示预览。

Step 1 — Get the content

步骤1 — 获取内容

In order:
  1. If the user included content in the prompt (pasted, or referenced from earlier in the conversation), use that.
  2. Else, read clipboard:
    pbpaste
  3. If both empty, ask the user what to paste.
优先级顺序:
  1. 如果用户在提示中包含了内容(粘贴的内容,或对话中之前提及的内容),则使用该内容。
  2. 否则,读取剪贴板内容:
    pbpaste
  3. 如果两者均为空,询问用户需要处理的内容。

Step 2 — Parse destination

步骤2 — 解析目标平台

InvocationDestination
/paste
plain (default)
/paste plain
plain
/paste slack
slack
/paste notion
notion
/paste twitter
or
/paste x
twitter
/paste linkedin
or
/paste li
linkedin
/paste email
email (plain)
/paste email rich
or
/paste email html
email (rich/HTML)
/paste github
or
/paste gh
github
/paste markdown
or
/paste md
markdown render
/paste html
render to HTML file + open in browser
If ambiguous, ask. Per-destination rules live in
references/destinations.md
.
触发指令目标平台
/paste
plain(默认)
/paste plain
plain(纯文本)
/paste slack
Slack
/paste notion
Notion
/paste twitter
/paste x
Twitter/X
/paste linkedin
/paste li
LinkedIn
/paste email
邮件(纯文本)
/paste email rich
/paste email html
邮件(富文本/HTML)
/paste github
/paste gh
GitHub
/paste markdown
/paste md
Markdown渲染
/paste html
渲染为HTML文件并在浏览器中打开
如果目标平台不明确,询问用户。各平台专属规则存于
references/destinations.md

Step 3 — Scan for secrets

步骤3 — 扫描敏感信息

Before any cleaning or copying, scan against patterns in
references/secret-patterns.md
.
If any match:
  1. Stop. Don't copy yet.
  2. Report what was detected with the value masked (first 4 + last 4 chars only — e.g.
    sk-12...wxyz
    ).
  3. Ask: "Spotted [type] in the content. Continue, redact (replace with
    [REDACTED]
    ), or abort?"
  4. Default to abort if no clear answer.
在进行任何清理或复制操作前,根据
references/secret-patterns.md
中的规则扫描内容。
如果检测到敏感信息:
  1. 立即停止,暂不执行复制操作。
  2. 报告检测到的敏感信息类型,并对值进行掩码处理(仅保留前4位和后4位字符,例如:
    sk-12...wxyz
    )。
  3. 询问用户:"在内容中检测到[敏感信息类型]。是否继续、脱敏(替换为
    [REDACTED]
    )或终止操作?"
  4. 如果用户未给出明确答复,默认执行终止操作

Step 4 — Universal cleaning

步骤4 — 通用清理

Strip from the content:
  • ANSI escape codes
    \x1b\[[0-9;]*[a-zA-Z]
    and related (color codes, cursor movement, screen control)
  • Box-drawing chars
    ╭ ─ ╮ │ ╰ ╯ ╞ ╡ ╤ ╧ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼ ━ ┃ ┏ ┓ ┗ ┛
    etc. Replace with simpler equivalents (
    -
    ,
    |
    ) or remove entirely depending on context.
  • Terminal prompt artifacts — leading
    $ 
    ,
    > 
    ,
    ,
    % 
    ,
    # 
    (when first non-whitespace on a line that looks like a shell prompt)
  • Carriage returns (
    \r
    ) — replace with
    \n
    or delete
  • Trailing whitespace per line
  • Excess blank lines — collapse 3+ consecutive blank lines to 2
从内容中移除以下元素:
  • ANSI转义码
    \x1b\[[0-9;]*[a-zA-Z]
    及相关代码(颜色代码、光标移动指令、屏幕控制指令)
  • 方框绘制字符
    ╭ ─ ╮ │ ╰ ╯ ╞ ╡ ╤ ╧ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼ ━ ┃ ┏ ┓ ┗ ┛
    等。根据上下文替换为更简单的等效字符(如
    -
    |
    )或直接移除。
  • 终端提示符痕迹 — 行首的
    $ 
    > 
    % 
    # 
    (当这些字符是行中首个非空白字符且看起来像Shell提示符时)
  • 回车符 (
    \r
    ) — 替换为
    \n
    或直接删除
  • 行尾空白字符
  • 过多空行 — 将3行及以上连续空行合并为2行

Step 5 — Apply destination rules

步骤5 — 应用目标平台规则

Read
references/destinations.md
and apply the relevant transform.
读取
references/destinations.md
并应用对应的转换规则。

Step 6 — Output

步骤6 — 输出

DestinationOutput behavior
plain / slack / notion / twitter / linkedin / email / github(a) Show preview in a code fence in chat. (b) Copy clean version to clipboard via
pbcopy
.
email richRender to HTML, write to
/tmp/paste-<timestamp>.html
,
open
it in browser. Skip clipboard (the user copies from browser to preserve rich text).
markdownRender the cleaned markdown directly in chat (Claude Code renders it). Also copy raw markdown to clipboard. Offer: "Open as HTML too?" — if yes, write and open.
htmlRender to HTML, write to
/tmp/paste-<timestamp>.html
,
open
it. Skip clipboard.
After output, report a one-line summary of what was cleaned (e.g., "Stripped 12 ANSI codes, 4 box-drawing chars, 1 prompt artifact. Character count: 248 / 280 (X).").
目标平台输出行为
plain / slack / notion / twitter / linkedin / email / github(a) 在聊天中以代码块形式展示预览。(b) 通过
pbcopy
将清理后的内容复制到剪贴板。
email rich渲染为HTML,写入
/tmp/paste-<timestamp>.html
,并在浏览器中打开。跳过剪贴板操作(用户需从浏览器中复制以保留富文本格式)。
markdown在聊天中直接渲染清理后的Markdown(Claude Code支持渲染)。同时将原始Markdown复制到剪贴板。询问用户:"是否也以HTML形式打开?" — 如果用户同意,则生成并打开HTML文件。
html渲染为HTML,写入
/tmp/paste-<timestamp>.html
并打开。跳过剪贴板操作。
输出完成后,输出一行清理总结(例如:"已剥离12个ANSI代码、4个方框绘制字符、1个提示符痕迹。字符数:248 / 280(X平台)。")。

Length warnings

长度警告

Twitter and LinkedIn have practical limits. the user said "let me trim" — don't refuse or auto-truncate.
  • Twitter/X: warn if >280 chars. Note the overage.
  • LinkedIn: warn if >400 chars (comfort line, not hard limit).
  • Other destinations: no length warning.
Twitter和LinkedIn有实际长度限制。如果用户表示"let me trim"(让我修剪),请勿拒绝或自动截断。
  • Twitter/X:如果字符数>280,发出警告并说明超出的字符数。
  • LinkedIn:如果字符数>400,发出警告(此为舒适阈值,非硬性限制)。
  • 其他目标平台:不进行长度警告。

URL handling for social destinations

社交平台的URL处理规则

If the content has URLs and destination is twitter or linkedin:
  • Surface the URLs separately (don't include them in the body)
  • Remind the user: links go in a first comment (LinkedIn) or reply (X), not the body
  • See
    makerskills:jab-hook
    and
    ~/.claude/memory/feedback_social_link_placement.md
如果内容包含URL且目标平台为twitterlinkedin
  • 将URL单独列出(不包含在正文中)
  • 提醒用户:链接应放在第一条评论(LinkedIn)或回复(X平台)中,而非正文内
  • 参考
    makerskills:jab-hook
    ~/.claude/memory/feedback_social_link_placement.md

Examples

示例

/paste slack
→ Reads clipboard, strips ANSI, converts
**bold**
to
*bold*
, copies to clipboard, shows preview.
/paste twitter
[pasted error log]
→ Uses pasted content (ignores clipboard), strips everything, warns at 412/280 chars, copies, asks if the user wants to trim or pick a different destination.
/paste html
[pasted markdown table]
→ Renders table as HTML, opens in browser. the user selects + copies into Notion/email with formatting preserved.
/paste
[pasted output with sk-anthropic-key in it]
→ Stops. "Spotted what looks like an Anthropic API key:
sk-an...3kf9
. Continue, redact, or abort?"
/paste slack
→ 读取剪贴板内容,剥离ANSI代码,将
**bold**
转换为
*bold*
,复制到剪贴板并展示预览。
/paste twitter
[pasted error log]
→ 使用粘贴的内容(忽略剪贴板),剥离所有无关格式,因字符数412/280发出警告,复制内容并询问用户是否需要修剪或更换目标平台。
/paste html
[pasted markdown table]
→ 将表格渲染为HTML并在浏览器中打开。用户可选择复制内容到Notion/邮件中,保留格式。
/paste
[pasted output with sk-anthropic-key in it]
→ 停止操作。提示:"检测到疑似Anthropic API密钥:
sk-an...3kf9
。是否继续、脱敏或终止操作?"

Composes with

可组合使用的工具

  • jab-hook
    — clean output for pasting into Typefully drafts when the MCP path doesn't fit; also enforces the link-placement rule for X/LinkedIn destinations
  • social-fetch
    — clean a fetched post before quoting it in a draft or newsletter
  • second-brain
    paste
    output can be captured cleanly into
    raw/note-<slug>.md
    for future compilation
  • watch-video
    — transcript / summary output often flows through
    paste
    for platform-specific reformatting
  • jab-hook
    — 当MCP路径不适用时,清理输出内容以粘贴到Typefully草稿中;同时为X/LinkedIn平台执行链接放置规则
  • social-fetch
    — 在草稿或通讯中引用抓取的帖子前,先清理帖子内容
  • second-brain
    paste
    的输出可被干净地捕获到
    raw/note-<slug>.md
    中,供后续整理使用
  • watch-video
    — 转录/总结输出通常会通过
    paste
    进行平台专属格式转换

Notes on quality

质量说明

  • Secret detection runs first, always. Before any formatting or destination logic,
    paste
    scans for
    sk-*
    ,
    AKIA*
    ,
    xoxb-*
    , JWT-shaped strings, and long-hex tokens. Prompts before proceeding on any hit. Better to false-positive occasionally than to leak a real key.
  • Destination-aware transforms, not one-size-fits-all. Slack wants
    *bold*
    ; LinkedIn wants unicode-styled bold; email wants HTML. Same input, 9 different valid outputs. The destination flag is not optional.
  • ANSI codes get stripped for every destination. Terminal escapes (
    \033[31m
    etc.) render as garbage everywhere except the source terminal.
  • Character limits are enforced, not warnings. X at 280, LinkedIn at 3000, Twitter at 25000 — paste refuses to copy over-limit output and offers a trim strategy.
  • Links go in first comments for social destinations — not the body. Enforced when destination is
    twitter
    or
    linkedin
    . Documented in
    ~/.claude/memory/feedback_social_link_placement.md
    .
  • HTML destination opens in a browser tab, not the clipboard. Formatted tables + code blocks need a rendered surface to select-and-copy from with formatting preserved. Copying raw HTML to the clipboard produces garbage in Notion/email.
  • 敏感信息检测始终优先执行。在任何格式化或目标平台逻辑执行前,
    paste
    会扫描
    sk-*
    AKIA*
    xoxb-*
    、JWT格式字符串和长十六进制令牌。一旦检测到匹配项,会先提示用户再继续操作。宁可偶尔误报,也绝不泄露真实密钥。
  • 针对目标平台的专属转换,而非一刀切。Slack需要
    *bold*
    格式;LinkedIn需要Unicode样式的粗体;邮件需要HTML格式。同一输入可生成9种不同的有效输出。目标平台标识并非可选参数。
  • 所有目标平台都会剥离ANSI代码。终端转义码(如
    \033[31m
    等)除了在源终端外,在其他所有地方都会显示为乱码。
  • 字符限制为强制规则,而非单纯警告。X平台限制280字符,LinkedIn限制3000字符,Twitter限制25000字符 —
    paste
    会拒绝复制超出限制的内容,并提供修剪策略。
  • 社交平台的链接需放在第一条评论中 — 而非正文内。当目标平台为
    twitter
    linkedin
    时强制执行此规则。规则文档存于
    ~/.claude/memory/feedback_social_link_placement.md
  • HTML目标平台会在浏览器标签页中打开,而非写入剪贴板。格式化后的表格和代码块需要渲染界面才能保留格式进行选择和复制。将原始HTML复制到剪贴板会在Notion/邮件中显示为乱码。