slack-directory
Skill10 starsChanged 7 months agoMITView on GitHub
Look up Slack users by name with fuzzy matching. Caches discoveries for instant future lookups.
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 13 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
When someone says "DM Sarah about the budget" or "add Mike to the channel," you need a Slack user ID — not a name.
- Distinctive: line 47
Before calling the API, check if you already have the mapping cached (in TOOLS.md, a JSON file, or wherever you store local state):
- Distinctive: line 61
If not cached, run the lookup:
- Distinctive: line 103
After finding someone new, add them to your local cache for next time.
- Distinctive: line 117
If your agent platform already manages Slack tokens for you, the token may already be available.
- Distinctive: line 119
Create a Slack App at api.slack.com/apps
- Very specific: line 120
Add Bot Token Scopes: users:read, users:read.email (optional)
- Distinctive: line 183
Check cache for name
- Distinctive: line 184
If not found → Run lookup
- Distinctive: line 185
If single match → Cache it, send DM
- Distinctive: line 186
If multiple → Ask "Which [name]?"
- Distinctive: line 187
If none → Ask for clarification
- Distinctive: line 193
Run lookup, display full profile info (name, email, title if available)
- Distinctive: line 216
If your agent uses Slack, it will eventually need to look up users.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Slack Directory Lookup
Why This Skill Exists
The Problem:
When someone says "DM Sarah about the budget" or "add Mike to the channel," you need a Slack user ID — not a name. Slack's API requires IDs for all user operations, but humans think in names.
The Solution:
This skill lets you search Slack users by partial name (first, last, display name, or username), handles multiple matches gracefully, and builds a local cache so you never look up the same person twice.
Real-world example:
"Hey, message the new hire about onboarding"
→ "What's their name?"
→ "Jamie something... started last week"
→ Run lookup for "Jamie" → Find Jamie Chen (U09ABC123)
→ Cache the mapping → Send the message
When to Use This Skill
| Situation | Use This Skill |
| Need to DM someone by name | ✅ Yes |
| Need to @mention someone | ✅ Yes |
| Adding users to channels | ✅ Yes |
| Building a people directory | ✅ Yes |
| You already have the Slack ID | ❌ No (just use it) |
How It Works
Step 1: Check Your Cache First
Before calling the API, check if you already have the mapping cached (in TOOLS.md, a JSON file, or wherever you store local state):
### People Directory
| Name | Slack ID | Notes |
|------|----------|-------|
| Sarah Chen | U09ABC123 | Engineering |
| Mike Brown | U07XYZ789 | Sales lead |Why cache? Slack API calls cost time and rate limits. Most workspaces have the same 20-50 people you interact with regularly. Cache them once, use forever.
Step 2: Fuzzy Search via API
If not cached, run the lookup:
./lookup.sh "jamie"The script searches across:
real_name(e.g., "Jamie Chen")display_name(e.g., "Jamie C")username(e.g., "jamie.chen")
Case-insensitive, partial match.
Step 3: Handle Results
Single match → Use it and cache it:
✅ Single match found:
| Jamie Chen | U09ABC123 | jamie.chen@company.com |Multiple matches → Clarify with the user:
⚠️ Multiple matches for 'jamie' (2 found):
1. Jamie Chen (U09ABC123) - jamie.chen@company.com
2. Jamie Rodriguez (U08DEF456) - jamie.r@company.com
Which one did you mean?No matches → Help troubleshoot:
❌ No matches found for 'jamie'
Suggestions:
- Check spelling
- Try first or last name only
- They may not be in this workspaceStep 4: Update Cache
After finding someone new, add them to your local cache for next time.
Setup
Requirements
- Slack Bot Token with
users:readscope - jq installed for JSON parsing
- curl for API calls
Getting Your Bot Token
If your agent platform already manages Slack tokens for you, the token may already be available. Otherwise:
- Create a Slack App at api.slack.com/apps
- Add Bot Token Scopes:
users:read,users:read.email(optional) - Install to workspace
- Copy the Bot User OAuth Token (
xoxb-...)
Token Storage Options
The included lookup.sh expects the token in an environment variable or secrets manager. Edit the TOKEN CONFIGURATION block near the top of the script for your setup:
# Option 1: Environment variable
TOKEN="${SLACK_BOT_TOKEN}"
# Option 2: GCP Secret Manager
TOKEN=$(gcloud secrets versions access latest --secret="slack-bot-token" --project=YOUR_PROJECT)
# Option 3: AWS Secrets Manager
TOKEN=$(aws secretsmanager get-secret-value --secret-id slack-bot-token --query SecretString --output text)
# Option 4: File (less secure, but simple)
TOKEN=$(cat ~/.slack-token)API Details
Endpoint: https://slack.com/api/users.list
Auth: Authorization: Bearer xoxb-...
Rate limit: Tier 2 (~20 requests/minute) — safe for occasional lookups
Useful User Object Fields
| Field | Description | Example |
id | Slack user ID (what you need) | U09ABC123 |
name | Username/handle | jamie.chen |
real_name | Full name | Jamie Chen |
profile.display_name | Custom display name | Jamie |
profile.email | Email (if visible) | jamie@co.com |
deleted | Deactivated account? | false |
is_bot | Bot account? | false |
Manual API Call (if script unavailable)
TOKEN="xoxb-your-token"
# List all active users
curl -s -H "Authorization: Bearer $TOKEN" \
"https://slack.com/api/users.list" | \
jq '.members[] | select(.deleted == false and .is_bot == false) | {id, name, real_name}'
# Filter for a name
curl -s -H "Authorization: Bearer $TOKEN" \
"https://slack.com/api/users.list" | \
jq --arg q "jamie" '.members[] | select(.deleted == false) | select((.real_name // "" | ascii_downcase | contains($q)))'Common Patterns
"DM [name] about [topic]"
- Check cache for name
- If not found → Run lookup
- If single match → Cache it, send DM
- If multiple → Ask "Which [name]?"
- If none → Ask for clarification
"Add [name] to #channel"
Same flow, then use the ID with conversations.invite
"Who is [name]?"
Run lookup, display full profile info (name, email, title if available)
Building Initial Directory
For new workspaces, you can bulk-cache everyone:
curl -s -H "Authorization: Bearer $TOKEN" \
"https://slack.com/api/users.list" | \
jq -r '.members[] | select(.deleted == false and .is_bot == false) | "| \(.real_name) | \(.id) | |"'This outputs a markdown table you can paste into your cache file.
Why This Belongs in Tier 2 (Communication)
This skill is foundational to Slack communication:
- Tier 1 is infrastructure (secrets, auth, basic setup)
- Tier 2 is communication (email, calendar, Slack, messaging)
- Tier 3+ is business operations
If your agent uses Slack, it will eventually need to look up users. This skill solves that cleanly, with caching to make it fast and reliable over time.
Files Included
slack-directory/
├── SKILL.md # This documentation
└── lookup.sh # Bash script for fuzzy user searchIn this repository23 other files it gives its agents.
- data-lake-starterSkill
- google-workspaceSkill
- mcp-guideSkill
- secrets-managerSkill
- semantic-layer-auditSkill
- gmailSkill
- google-calendarSkill
- google-chatSkill
- slackSkill
- google-docsSkill
- google-driveSkill
- google-sheetsSkill
- google-tasksSkill
- brand-identitySkill
- creative-matrixSkill
- google-adsSkill
- nano-bananaSkill
- autoresearchSkill
- long-running-agentSkill
- morning-briefingSkill
- playbook-discoverySkill
- revenue-forecasterSkill
- patent-figureSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

