Enrich Message
Enrich a draft message with code references, ticket links, and factual data. Outputs copy-pasteable markdown.
Preferences
Before starting, use the Read tool to read ~/.claude/skills/enrich-message/preferences.md. If the file does not exist, treat as "no preferences set" and use defaults.
Context
On startup, use Bash to detect: current git branch, remotes, repo root, and recent commits (last 5). Skip any that fail.
Command routing
Check $ARGUMENTS:
help→ display help then stopconfig→ interactive setup then stopreset→ delete preferences, confirm, stop- anything else (including empty) → run the skill
Help
Enrich Message — Enriches draft messages with code references, tickets, and facts
Usage:
/enrich-message Enrich draft from conversation context
/enrich-message <url> Enrich with a specific thread URL pre-loaded
/enrich-message --brief Keep enrichment concise
/enrich-message --no-linear Skip Linear ticket search
/enrich-message config Set preferences
/enrich-message reset Clear preferences
/enrich-message help This help
Examples:
/enrich-message Paste your draft + context in chat, then run
/enrich-message https://github.com/org/repo/pull/123#discussion_r456
Pre-fetch this PR discussion thread
Current preferences:
(from preferences.md or defaults)
Config
Use AskUserQuestion to collect:
- Q1: Default GitHub org — e.g.,
A-Teams-Network(used to resolve short PR refs) - Q2: Writing style — Professional / Casual / Match original tone
- Q3: Reference depth — Minimal (links only) / Standard (links + brief context) / Deep (links + code snippets + explanation)
Save to ~/.claude/skills/enrich-message/preferences.md.
Reset
Delete ~/.claude/skills/enrich-message/preferences.md and confirm: "Preferences cleared. Using defaults."
First-time detection
If no preferences file exists, show:
First time using /enrich-message? Run
/enrich-message configto set defaults, or just continue with sensible defaults.
Then proceed normally.
Workflow
Step 1: Parse inputs
Scan the current conversation for:
- Draft text — the user's draft response/comment (may be pasted as text or visible in a screenshot)
- Context URL(s) — GitHub PR comment links, Slack thread URLs, or any reference links
- Screenshots — read any images the user shared for additional context (comment threads, code diffs)
- Explicit instructions — any guidance like "add code references for X" or "mention the ticket for Y"
If $ARGUMENTS contains a URL, treat it as the primary context URL.
If inputs are ambiguous, ask:
I see your draft. What's the context? (paste a URL or describe the thread)
Step 2: Fetch thread context
Based on the context URL type:
GitHub PR comment (github.com/.../pull/N#discussion_rNNN):
- Extract owner, repo, PR number, and comment ID from the URL
- Run
gh api repos/{owner}/{repo}/pulls/{pr}/commentsto get the full comment thread - Run
gh pr view {pr} --repo {owner}/{repo} --json title,body,files,headRefNamefor PR context - Identify the specific file and lines under discussion
GitHub PR review (github.com/.../pull/N#pullrequestreview-NNN):
- Run
gh api repos/{owner}/{repo}/pulls/{pr}/reviews/{review_id}/commentsfor review comments - Run
gh pr viewfor PR context
GitHub issue (github.com/.../issues/N):
- Run
gh issue view {n} --repo {owner}/{repo} --json title,body,comments
Slack thread (if URL provided):
- Note: Slack MCP not available — ask the user to paste the thread content
No URL / screenshot only:
- Extract context from the screenshot content
- Use visible file paths, function names, and discussion text as search seeds
Step 3: Analyze the topic
From the draft and context, identify:
- Key claims — what technical assertions does the draft make? (e.g., "we concatenate files on frontend")
- Technical concepts — function names, component names, patterns, architecture decisions mentioned
- Missing references — where the draft says something factual but doesn't link to evidence
- Search seeds — keywords, file paths, function names to search for in the codebase
Step 4: Search codebase
For each search seed identified:
- Use
Grepto find relevant code across the repo (function definitions, variable names, patterns) - Use
Readto examine matched files for surrounding context - Note file paths and line numbers for each reference found
Build code references as GitHub permalink URLs:
- Format:
https://github.com/{owner}/{repo}/blob/{branch}/{path}#L{line} - Use the current branch or
mainas appropriate - If the code is from a PR branch, use that branch's ref
Step 5: Search Linear (unless --no-linear)
Search Linear for tickets related to the discussion topic:
- Use
mcp__claude_ai_Linear__list_issueswith keywords from the topic - For relevant matches, get details with
mcp__claude_ai_Linear__get_issue - Note ticket identifiers (e.g., AIS-123) and URLs for linking
Step 6: Search GitHub for related work
Look for additional context:
gh pr list --repo {owner}/{repo} --search "{keywords}" --state all --limit 5— find related PRsgh search commits "{keywords}" --repo {owner}/{repo} --limit 5— find related commits- Check other branches if the discussion mentions work-in-progress or upcoming changes
Step 7: Compose enriched message
Rewrite the draft with enrichments:
- Preserve the author's intent — keep the core message and tone intact
- Add inline code references — link to specific files/lines:
[filename.ts#L42](permalink) - Add ticket references — mention Linear tickets:
[AIS-123](url)where relevant - Add PR/commit references — link related PRs:
[PR #123](url)or commits - Improve clarity — fix grammar, tighten phrasing, but don't over-formalize unless configured
- Format for the platform:
- GitHub comments: use GitHub-flavored markdown,
<details>blocks for long code snippets - Slack: use simpler markdown (bold, links, code blocks)
- Default: GitHub markdown
- GitHub comments: use GitHub-flavored markdown,
Writing style rules:
- Match the formality of the original draft unless preferences say otherwise
- Keep it concise —
--briefmeans links only, no extra explanation - Every factual claim should have a reference (code link, ticket, PR)
- Use relative references where natural ("as implemented in
meetings-tab.tsx") with the link on the filename
Step 8: Present output
Always copy to clipboard — write the enriched message to /tmp/enriched-message.md using the Write tool, then run pbcopy < /tmp/enriched-message.md via Bash. This ensures the user can directly Cmd+V without losing markdown formatting.
After copying, confirm briefly:
Copied to clipboard. {N} code references, {N} Linear tickets, {N} PR links.
Sources: {list of repos/branches checked}
If any references couldn't be found, mention:
Could not find code references for: {list}
Principles
- Factual, not fabricated — only reference code, tickets, and links that actually exist. Never invent file paths or line numbers. If a reference can't be found, say so.
- Preserve the author's voice — enrich, don't rewrite. The output should sound like the user, just better-sourced.
- Links must be valid — every
[text](url)must point to a real, accessible URL. Use GitHub permalinks with actual commit SHAs or branch names. - Read-only — never post, comment, or modify anything. The user decides when and where to paste.
- Platform-aware formatting — GitHub comments support full GFM; Slack needs simpler markdown. Format accordingly.