Agent skill

Discord Php Interactions

by discord-php in discord-php/DiscordPHP

Build DiscordPHP slash commands and message components — global command trees with subcommands, user- AND guild-installable commands usable in DMs / group DMs / guild channels, Components V2…

MITAuto-check passedAgent Workflows

Install Discord Php Interactions

skills CLI
$ npx skills add discord-php/DiscordPHP --skill discord-php-interactions -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install discord-php/DiscordPHP discord-php-interactions --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/discord-php/DiscordPHP.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/discord-php-interactions .claude/skills/discord-php-interactions && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
discord-php-interactions
GitHub stars
1.1k
Token cost
~1.5k tokens
SKILL.md length
353 words
Files
1
Skills in repo
14
Repo updated
First seen
Licence
MIT

At a glance

Build DiscordPHP slash commands and message components — global command trees with subcommands, user- AND guild-installable commands usable in DMs / group DMs / guild channels, Components V2…

  • Changing any /command
  • SKILL.md covers Registering a global command…, Responding — and staying…, Components V2 and Routing component clicks — two…, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Tasks that involve Messaging and chat bots

What it does

Discord Php Interactions is an agent skill from discord-php/DiscordPHP. Build DiscordPHP slash commands and message components — global command trees with subcommands, user- AND guild-installable commands usable in DMs / group DMs / guild channels, Components V2 (Container / TextDisplay / ActionRow / Button / StringSelect), the two ways to route component clicks, and keeping every reply permission-safe. Use when adding or changing any /command, button, or select.

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering Messaging and chat bots and Hooks and plugins. It works with Discord and PHP. The repository describes itself as: An API to interact with the popular messaging app Discord. The licence is MIT.

When your agent uses it

  • Changing any /command
  • Tasks that involve Messaging and chat bots
  • Tasks that involve Hooks and plugins

Example prompts

  • “/discord-php-interactions”

What it can do on your machine

Read from SKILL.md and the folder at commit 580c66a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are php).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Discord Php Interactions loads about 1.5k tokens when it runs. Until then it costs about 106 tokens; SKILL.md has 353 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~106
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from discord-php/DiscordPHP at commit 580c66a, republished under its MIT licence (© discord-php). 353 words, ~1,544 tokens.

Download SKILL.mdSave it as .claude/skills/discord-php-interactions/SKILL.md (or your agent's skills folder).
name
discord-php-interactions
description
Build DiscordPHP slash commands and message components — global command trees with subcommands, user- AND guild-installable commands usable in DMs / group DMs / guild channels, Components V2 (Container / TextDisplay / ActionRow / Button / StringSelect), the two ways to route component clicks, and keeping every reply permission-safe. Use when adding or changing any `/command`, button, or select.

DiscordPHP Interactions Skill

Verified against team-reflex/discord-php dev-master (Discord API v10) while building DiscordPHP-Sabacc and reviewing DiscordPHP-MTG.

Registering a global command with subcommands

php
use Discord\Builders\CommandBuilder;
use Discord\Parts\Interactions\Command\{Command, Option, Choice};
use Discord\Parts\Interactions\Interaction;
use Discord\Parts\OAuth\Application;

$sub = fn (string $n, string $d) => (new Option($bot))->setName($n)->setDescription($d)->setType(Option::SUB_COMMAND);
$opt = fn (string $n, string $d, int $t, bool $req = false) => (new Option($bot))->setName($n)->setDescription($d)->setType($t)->setRequired($req);

$builder = CommandBuilder::new()
    ->setName('foo')->setType(Command::CHAT_INPUT)->setDescription('…')
    ->setContext([                                   // where it can be used
        Interaction::CONTEXT_TYPE_GUILD,             // 0
        Interaction::CONTEXT_TYPE_BOT_DM,            // 1
        Interaction::CONTEXT_TYPE_PRIVATE_CHANNEL,   // 2  (group DMs)
    ])
    ->addIntegrationType(Application::INTEGRATION_TYPE_GUILD_INSTALL) // 0
    ->addIntegrationType(Application::INTEGRATION_TYPE_USER_INSTALL)  // 1
    ->addOption(
        $sub('play', 'Start a game.')
            ->addOption($opt('opponent', 'Challenge a member.', Option::USER))
            ->addOption(
                (new Option($bot))->setName('difficulty')->setDescription('…')->setType(Option::STRING)
                    ->addChoice((new Choice($bot))->setName('Easy')->setValue('easy'))
            )
    )
    ->addOption($sub('wallet', 'Show your balance.'));

// Only create if missing (creating is a rate-limited write):
if ($commandRepo->get('name', 'foo') === null) {
    $builder->create($commandRepo)->save('foo command');
}
$bot->listenCommand('foo', fn (Interaction $i) => $handler->dispatch($i));

Option type constants: SUB_COMMAND=1, SUB_COMMAND_GROUP=2, STRING=3, INTEGER=4, BOOLEAN=5, USER=6, NUMBER=10. Parts are constructed new Option($discord) / new Choice($discord) (or $bot->getFactory()->part(...)).

Enabling User Install: also toggle User Install under Installation in the Developer Portal, or the INTEGRATION_TYPE_USER_INSTALL on the command is ignored.

Reading the invocation
php
$sub  = $interaction->data->options->first();
$name = $sub?->name;
$args = [];
foreach ($sub?->options ?? [] as $o) { $args[$o->name] = $o->value; }

Responding — and staying inside the caller's permissions

A user-installed command can run in a channel the app is not a member of. Only interaction-scoped responses work there, and they inherently respect what the invoking user can do. Use:

MethodUse for
$interaction->respondWithMessage($builder, ephemeral: true)first reply to a slash command
$interaction->updateMessage($builder)edit the message a button/select is on
$interaction->sendFollowUpMessage($builder, ephemeral: true)extra messages after the first
$interaction->acknowledgeWithResponse(true) then updateOriginalResponse(...)when the work takes >3s

Do not try to $channel->sendMessage(...) for gameplay output in a user-install context — front everything through the interaction. Constrain mentions with MessageBuilder::new()->setAllowedMentions(AllowedMentions::new()->setParse(['users'])) (or AllowedMentions::none()), never let role/@everyone pings through.

Components V2

Available builders (Discord\Builders\Components\*): Container, TextDisplay, Separator, Section, ActionRow, Button, StringSelect (+ Option), MediaGallery, Thumbnail, File. Compose:

php
$builder->addComponent(
    Container::new()
        ->addComponent(TextDisplay::new("## Board\n…"))
        ->addComponent(Separator::new())
);
$builder->addComponent(ActionRow::new()->addComponents([
    Button::new(Button::STYLE_PRIMARY, $customId)->setLabel('Draw'),
    Button::new(Button::STYLE_DANGER, $forfeitId)->setLabel('Forfeit'),
]));

Button styles: STYLE_PRIMARY=1, SECONDARY=2, SUCCESS=3, DANGER=4, LINK=5, PREMIUM=6.

Show full SKILL.md (161 more words)Show less

Routing component clicks — two approaches

A. Per-component listener (Button::setListener / SelectMenu::setListener): ->setListener(callable $cb, Discord $discord, bool $oneOff = false, ?float $timeout = null). Simple, but each render attaches a fresh INTERACTION_CREATE listener; with a long-lived interactive message you accumulate listeners. Good for one-shot buttons (MTG uses it with oneOff: true, timeout: 300).

B. Stable custom_ids + one dispatcher (Sabacc uses this): give components ids like "foo|<matchId>|draw" and route centrally:

php
$bot->on(Discord\WebSockets\Event::INTERACTION_CREATE, function (Interaction $i) use ($bot) {
    if ($i->type !== Interaction::TYPE_MESSAGE_COMPONENT) return;
    $id = (string) ($i->data->custom_id ?? '');
    if (! str_starts_with($id, 'foo|')) return;
    $bot->session(explode('|', $id)[1])?->handle($i);
});

No listener leak; survives re-renders. For a select, fold every choice into the option value ("handIndex:sign:magnitude") so one interaction carries the whole move and you need no follow-up prompt. $i->data->values[0] holds it.

Never put a secret in a custom_id — it is sent to Discord and visible in the client. Capture tokens in the server-side listener closure instead.

Validate the actor

Buttons are clickable by anyone who can see the message. In every handler check $match->seatOf($interaction->user->id) (or equivalent) and reply ephemerally "not your turn" / "you are not in this match" rather than assuming the clicker is authorised.

© discord-php, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/skills/discord-php-interactions of discord-php/DiscordPHP.

Open the folder on GitHubat commit 580c66a

Compare with similar skills

Discord Php Interactions next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Discord Php Interactions compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Discord Php Interactions this skilldiscord-php/DiscordPHP1.1k—~1.5kAutomated safety check: PassMIT
Chat SDKdatabuddy-analytics/Databuddy1.2k—~2.6kAutomated safety check: PassAGPL-3.0
Discord Bot Helpershepherdjerred/monorepo112—~4.3kAutomated safety check: PassGPL-3.0
Discord Bot Architectdavila7/claude-code-templates32k6 repos~2kAutomated safety check: PassMIT
Test Ocas Openclawpwrdrvr/openclaw-codex-app-server265—~4kAutomated safety check: PassMIT
Tlon Product Guidetloncorp/tlon-apps107—~11kAutomated safety check: PassMIT

Similar skills

  • Chat SDK

    databuddy-analytics/Databuddy

    Build multi-platform chat bots with Chat SDK (chat npm package).

    1.2k GitHub stars~2.6k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Discord Bot Helper

    shepherdjerred/monorepo

    Discord.js v14 for building Discord bots - slash commands, events, components, embeds, and permissions When user works with Discord bots, discord.js, slash commands, Discord API, or mentions…

    112 GitHub stars~4.3k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Discord Bot Architect

    davila7/claude-code-templates

    Specialized skill for building production-ready Discord bots.

    32k GitHub starsUsed in 6 repos~2k tokens
    Productivity & AutomationAuto-check passed
  • Test Ocas Openclaw

    pwrdrvr/openclaw-codex-app-server

    Regression test the OpenClaw Codex App Server plugin against a live local OpenClaw instance in Telegram or Discord.

    265 GitHub stars~4k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed
  • Tlon Product Guide

    tloncorp/tlon-apps

    Answer questions about Tlon, Urbit, Tlon Messenger, Tlonbot, and OpenClaw — what they are, how they work, and how to use them.

    107 GitHub stars~11k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Basercms5 Development

    baserproject/basercms

    baserCMS 5系(CakePHP 5.0.5系)+ jQuery プロジェクトの共通ルール(環境・ディレクトリ構成・命名規則・ログ/エラーハンドリング・コアハック禁止・サーバ制約)を定めた基底スキル。「baserCMS 5 で開発」「5系プロジェクトの構成・規約を確認」「htdocs/plugins 配下の配置」「CakeLog…

    190 GitHub stars~1.1k tokensUpdated 2 days ago
    Agent WorkflowsAuto-check: notes

More from discord-php/DiscordPHP

All 14 skills in this repo
  • Async Test And Doc Sync

    discord-php/DiscordPHP

    Maintain test and documentation alignment — PHPUnit tests, async testing patterns, PHPDoc contracts, guide pages, and documentation workflow.

    1.1k GitHub stars~3.4k tokensUpdated yesterday
    Auto-check: notes
  • Discord Php Bot Security

    discord-php/DiscordPHP

    Audit checklist for DiscordPHP bots and API libraries — stop the bot token leaking to third-party APIs or logs, keep secrets out of customids and exception messages, use constant-time comparison and…

    1.1k GitHub stars~1.2k tokensUpdated yesterday
    Auto-check: notes
  • Discord Php Extension

    discord-php/DiscordPHP

    Scaffold and maintain a DiscordPHP-based bot or an API-library-on-DiscordPHP (the DiscordPHP-MTG / DiscordPHP-NHA / DiscordPHP-Sabacc pattern) — client subclass, third-party HTTP layer, Parts…

    1.1k GitHub stars~1.7k tokensUpdated yesterday
    Auto-check passed
  • Helpers And Infra Keeper

    discord-php/DiscordPHP

    Work with DiscordPHP's infrastructure utilities — CacheWrapper, CacheConfig, BigInt, Multipart, Endpoint::bind URL templates, Collection base class, and domain Exceptions.

    1.1k GitHub stars~2.2k tokensUpdated yesterday
    Auto-check passed
  • Part Model Maintainer

    discord-php/DiscordPHP

    Maintain Part domain models — fillable attributes, mutators, typed nested data, save/fetch behavior, permission checks, PHPDoc, and repository bindings.

    1.1k GitHub stars~3.4k tokensUpdated yesterday
    Auto-check passed
  • Runtime Bootstrap Keeper

    discord-php/DiscordPHP

    Maintain Discord.php runtime bootstrapping, startup options, event loop, gateway connection, reconnection, member chunking, cache configuration, and process lifecycle.

    1.1k GitHub stars~4k tokensUpdated yesterday
    Auto-check passed

Works with

Categories

Questions about Discord Php Interactions

What does Discord Php Interactions do?

Build DiscordPHP slash commands and message components — global command trees with subcommands, user- AND guild-installable commands usable in DMs / group DMs / guild channels, Components V2…. Discord Php Interactions is an agent skill from discord-php/DiscordPHP. Build DiscordPHP slash commands and message components — global command trees with subcommands, user- AND guild-installable commands usable in DMs / group DMs / guild channels, Components V2 (Container / TextDisplay / ActionRow / Button / StringSelect), the two ways to route component clicks, and keeping every reply permission-safe.

When should I use Discord Php Interactions?

Discord Php Interactions fits situations like: changing any /command; tasks that involve Messaging and chat bots; tasks that involve Hooks and plugins.

How do I install Discord Php Interactions in Claude Code?

Run `npx skills add discord-php/DiscordPHP --skill discord-php-interactions -a claude-code`. Or copy the skill folder (.github/skills/discord-php-interactions in discord-php/DiscordPHP) into .claude/skills/discord-php-interactions in your project. Claude Code loads it when a task matches its description.

How do I install Discord Php Interactions in Codex?

Run `npx skills add discord-php/DiscordPHP --skill discord-php-interactions -a codex`. Or copy the skill folder (.github/skills/discord-php-interactions in discord-php/DiscordPHP) into .agents/skills/discord-php-interactions in your project. Codex loads it when a task matches its description.

Can I use Discord Php Interactions in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add discord-php/DiscordPHP --skill discord-php-interactions -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/discord-php-interactions, .gemini/skills/discord-php-interactions, .github/skills/discord-php-interactions and .opencode/skills/discord-php-interactions in your project.

What does Discord Php Interactions need to run?

SKILL.md names no scripts, command-line tools or credentials: Discord Php Interactions is instructions for the agent only.

Does Discord Php Interactions access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Discord Php Interactions safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Discord Php Interactions use?

Discord Php Interactions is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Discord Php Interactions use?

About 1.5k tokens (SKILL.md is roughly 6.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Discord Php Interactions?

Skills that share tags, products or a category with Discord Php Interactions: Chat SDK (databuddy-analytics/Databuddy, 1.2k stars), Discord Bot Helper (shepherdjerred/monorepo, 112 stars), Discord Bot Architect (davila7/claude-code-templates, 32k stars) and Test Ocas Openclaw (pwrdrvr/openclaw-codex-app-server, 265 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Discord Php Interactions?

discord-php (a GitHub organization) maintains it in discord-php/DiscordPHP, which has 1,080 GitHub stars. The repository holds 14 skills in this directory. The repository was last updated on October 6, 2026.

Source: discord-php/DiscordPHP on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.