agentleFS
abdullahkhawerabdullahkhawer/devops-skills/skills/slack-cli/SKILL.md

slack-cli

Skill8 starsChanged 6 months agoApache-2.0View on GitHub

Perform Slack operations using the Slack CLI for app management and the Slack Web API (curl) for messaging, channel, and user operations.

  • Installs packages
  • Sends data out

We split this skill into the rules it gives an agent

10 rules. 0 are common, 6 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Update the Slack workspace name below before using this skill:

    line 17
  2. Distinctive:

    If not already authenticated, ask the user to complete these steps manually.

    line 30
  3. Very specific:

    Always pass --team <your-team-name> on every command.

    line 40
  4. Very specific:

    Every Slack API response includes an ok field.

    line 127
  5. Distinctive:

    NEVER target any Slack workspace other than the one configured above.

    line 136
  6. Very specific:

    NEVER print, display, log, or store the contents of ~/.slack/token or any credential value.

    line 137
  7. Distinctive:

    NEVER post a message without first confirming the exact channel and message text with the user.

    line 138
  8. Distinctive:

    NEVER run destructive operations (archive, delete, deactivate) without explicit user instruction.

    line 139
  9. Distinctive:

    If a channel or user ID is unknown, always look it up first using the list commands above.

    line 140
  10. Very specific:

    If ~/.slack/token does not exist, inform the user and stop.

    line 141

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Slack CLI Skill

This skill uses two tools depending on the operation:

Use caseTool
App management (install, deploy, auth)slack CLI
Messaging, channels, users, searchSlack Web API via curl

Configuration

Update the Slack workspace name below before using this skill:

SettingValue
Slack Workspace<your-workspace>.slack.com
Slack Team Name (for CLI)<your-team-name>

Tool 1 — Slack CLI (app management only)

Prerequisites (one-time setup by user)

If not already authenticated, ask the user to complete these steps manually. Do not perform these steps yourself.

brew install slack-cli                # install if needed
slack login                           # authenticate
slack auth list                       # confirm your workspace is listed

Commands

Always pass --team <your-team-name> on every command.

CommandDescription
slack auth listList authenticated workspaces
slack auth whoamiShow current authenticated user
slack app list --team <your-team-name>List apps in the workspace
slack app install --team <your-team-name>Install app to workspace
slack app uninstall --team <your-team-name>Uninstall app (requires explicit user approval)
slack deploy --team <your-team-name>Deploy app to Slack Platform
slack trigger list --team <your-team-name>List triggers for an app

Tool 2 — Slack Web API via curl (messaging, channels, users)

Prerequisites (one-time setup by user)

To get started, create a Slack app at api.slack.com/apps. On the OAuth & Permissions page, add the required scopes, then install the app to your workspace. After installation, your user token (starting with xoxp-) will appear on the same page. Save it to ~/.slack/token. Never print or display the token value. Do not perform these steps yourself.

Required token scopes: channels:read, channels:history, groups:read, groups:history, users:read

echo "xoxp-..." > ~/.slack/token && chmod 600 ~/.slack/token

Base URL

https://slack.com/api/<method>

Common API Methods

List channels

curl -s -H "Authorization: Bearer $(cat ~/.slack/token)" \
  "https://slack.com/api/conversations.list?limit=200&exclude_archived=true&types=public_channel,private_channel" \
  | jq '.channels[] | {id, name}'

Get channel ID by name (replace general with channel name)

curl -s -H "Authorization: Bearer $(cat ~/.slack/token)" \
  "https://slack.com/api/conversations.list?limit=200&exclude_archived=true&types=public_channel,private_channel" \
  | jq -r '.channels[] | select(.name == "general") | .id'

Read latest messages from a channel

curl -s -H "Authorization: Bearer $(cat ~/.slack/token)" \
  "https://slack.com/api/conversations.history?channel=<CHANNEL_ID>&limit=10" \
  | jq '.messages[] | {ts, user, text}'

Search messages (requires search:read scope)

curl -s -H "Authorization: Bearer $(cat ~/.slack/token)" \
  "https://slack.com/api/search.messages?query=<search+term>&count=10" \
  | jq '.messages.matches[] | {channel: .channel.name, user: .username, text, ts}'

Post a message (confirm channel and text with user before running)

curl -s -X POST -H "Authorization: Bearer $(cat ~/.slack/token)" \
  -H "Content-Type: application/json" \
  --data '{"channel": "<CHANNEL_ID>", "text": "<MESSAGE>"}' \
  "https://slack.com/api/chat.postMessage" \
  | jq '{ok, ts, error}'

List users

curl -s -H "Authorization: Bearer $(cat ~/.slack/token)" \
  "https://slack.com/api/users.list" \
  | jq '.members[] | select(.deleted == false) | {id, name, real_name: .profile.real_name}'

Look up user by name

curl -s -H "Authorization: Bearer $(cat ~/.slack/token)" \
  "https://slack.com/api/users.list" \
  | jq -r '.members[] | select(.name == "<username>") | .id'

Checking API responses

Every Slack API response includes an ok field. Always check it:

| jq 'if .ok then . else error(.error) end'

Rules

  • NEVER target any Slack workspace other than the one configured above.
  • NEVER print, display, log, or store the contents of ~/.slack/token or any credential value.
  • NEVER post a message without first confirming the exact channel and message text with the user.
  • NEVER run destructive operations (archive, delete, deactivate) without explicit user instruction.
  • If a channel or user ID is unknown, always look it up first using the list commands above.
  • If ~/.slack/token does not exist, inform the user and stop. Do not attempt to find or guess the token.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.