feat: recommend the official Slack plugin to Claude Code users#615
Open
zimeg wants to merge 10 commits into
Open
feat: recommend the official Slack plugin to Claude Code users#615zimeg wants to merge 10 commits into
zimeg wants to merge 10 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #615 +/- ##
==========================================
+ Coverage 71.72% 71.73% +0.01%
==========================================
Files 226 227 +1
Lines 19182 19188 +6
==========================================
+ Hits 13758 13765 +7
+ Misses 4214 4213 -1
Partials 1210 1210 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
When the CLI runs inside Claude Code (detected via CLAUDECODE=1), emit a one-line <claude-code-hint /> marker to stderr recommending the official slack@claude-plugins-official plugin. Claude Code strips the marker before it reaches the model, dedupes it per plugin/session, and shows a one-time install prompt. It is a no-op in every other environment. The emitter lives beside the existing CLAUDECODE detection in internal/useragent. It is called from root.go's PersistentPreRunE (covers every normal subcommand) and from the custom help func (Cobra serves --help before PersistentPreRunE runs, so those paths need their own emit). See https://code.claude.com/docs/en/plugin-hints.
0eddb87 to
7c560ad
Compare
zimeg
commented
Jul 14, 2026
zimeg
left a comment
Member
Author
There was a problem hiding this comment.
📝 A note for reviewers before I fall into too much a rabbit hole.
| // users of Claude Code. | ||
| // | ||
| // https://code.claude.com/docs/en/plugin-hints | ||
| const claudeCodePluginHint = `<claude-code-hint v="1" type="plugin" value="slack@claude-plugins-official" />` |
Member
Author
There was a problem hiding this comment.
claude prompt but this matches spec!
Contributor
There was a problem hiding this comment.
Did you double check that the plugin was not already installed on your system?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
The CLI now recommends the official Slack plugin to Claude Code users. No change for anyone running the CLI outside Claude Code.
Summary
When the CLI runs inside Claude Code (detected via
CLAUDECODE=1), it emits a one-line<claude-code-hint />marker to stderr recommending the officialslack@claude-plugins-officialplugin. Claude Code strips the marker before the output reaches the model (so it never counts toward token usage), dedupes it per plugin and per session, and shows the user a one-time install prompt. Claude Code never installs anything automatically — the user always confirms.Protocol reference: https://code.claude.com/docs/en/plugin-hints
Design decisions worth calling out:
CLAUDECODEdetection (GetAIAgent) ininternal/useragent, since that package already owns "behavior conditioned on which AI agent is running us." A dedicatedinternal/plugins(orinternal/agents) package felt premature for a ~10-line, single-vendor feature — Codex/Gemini/etc. have no equivalent protocol today. If a second agent-conditioned behavior or a second vendor protocol lands, that's the trigger to extract.root.go'sPersistentPreRunEcovers every normal subcommand. Cobra serves--helpbeforePersistentPreRunEruns, so the custom help func (cmd/help/help.go) needs its own emit to coverslack --helpandslack <cmd> --help(two of the touchpoints the docs recommend).IO.WriteErr()so it stays out of stdout pipelines and out of the help text, and the protocol's one hard requirement (own line) is satisfied byFprintln.Preview
Emitted on stderr only when
CLAUDECODE=1:Nothing is emitted otherwise.
Testing
Unit tests:
internal/useragent/hint_test.go— emits on its own line whenCLAUDECODE=1; no-op when unset or set to another value.cmd/help/help_test.go— help func emits the hint on stderr (not stdout) inside Claude Code; nothing outside.Manual end-to-end against a built binary:
CLAUDECODE=1 slack version→ 1 hint on stderr, 0 on stdout ✅slack version(noCLAUDECODE) → 0 bytes on stderr ✅CLAUDECODE=1 slack --helpandslack auth --help→ 1 hint on stderr each, help text unaffected on stdout ✅slack --helpwithoutCLAUDECODE→ 0 ✅go build ./...,go test ./cmd/... ./internal/useragent/..., andgolangci-linton the touched packages all pass.Notes
claude-plugins-officialmarketplace; hints pointing elsewhere are silently dropped. Until aslackplugin is listed there, this marker is emitted but not shown. This needs to be coordinated with an Anthropic contact — flagging so it isn't a surprise.Requirements
🤖 Generated with Claude Code