csharpfritz/discord-minecraft/discord-net-worker-service
Claude Code and agent skill by csharpfritz/discord-minecraft
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Pattern for hosting Discord.NET bot inside a .NET generic host BackgroundService
Install
npx vskill@latest install csharpfritz/discord-minecraft/discord-net-worker-serviceSKILL.md
Context
When building a Discord bot as part of a larger .NET service architecture (Aspire, microservices), the bot needs to integrate with the generic host lifecycle rather than running standalone.
Patterns
- Register
DiscordSocketConfigandDiscordSocketClientas singletons in DI - Create a
BackgroundServicethat receives the client via constructor injection - In
ExecuteAsync: wire events →LoginAsync→StartAsync→Task.Delay(Infinite, token)→StopAsync - Bridge Discord.NET's
LogSeveritytoMicrosoft.Extensions.Logging.LogLevelvia theclient.Logevent - Register slash commands in the
client.Readyevent (gateway is fully connected at that point) - Handle slash commands via
client.SlashCommandExecutedevent - Bot token from
IConfiguration["Discord:BotToken"]— works with user secrets and env vars - Wire channel events via
client.ChannelCreated,client.ChannelDestroyed,client.ChannelUpdated— detect category vs text channel withis ICategoryChannel - Inject
IConnectionMultiplexer(from Aspire'sAddRedisClient) to getISubscriberfor Redis pub/sub - Use
RedisChannel.Literal(channelName)for publish — avoid pattern-matching overhead - Filter
ChannelUpdatedevents to only publish when meaningful properties change (name, position) — Discord fires this event for many property changes
Examples
Anti-Patterns
- Do NOT create
DiscordSocketClientper-request or as transient — it manages a persistent WebSocket - Do NOT register slash commands outside the
Readyevent — the client isn't connected yet - Do NOT use
while (!token.IsCancellationRequested) { await Task.Delay(...) }—Task.Delay(Infinite)is cleaner and avoids unnecessary wake-ups - Do NOT use guild-specific commands for dev convenience without documenting the tradeoff (instant registration vs. global's 1-hour propagation)
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.ai-team/skills/discord-net-worker-service/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/csharpfritz/discord-minecraft/discord-net-worker-service)