Agent skill

Discord Php Extension

by discord-php in 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…

MITAuto-check passed

Install Discord Php Extension

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

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

GitHub CLI
$ gh skill install discord-php/DiscordPHP discord-php-extension --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-extension .claude/skills/discord-php-extension && 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-extension
GitHub stars
1.1k
Token cost
~1.7k tokens
SKILL.md length
484 words
Files
1
Skills in repo
14
Repo updated
First seen
Licence
MIT

At a glance

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…

  • Creating a new extension repo
  • SKILL.md covers Repository layout, The client subclass, Boot: the dual init guard and Persistence: a tiny JSON state…, plus 4 more sections
  • Calls git and composer
  • Working across the existing ones

What it does

Discord Php Extension is an agent skill from 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, repositories, JSON state store, the init/application-init boot guard, composer path-repo wiring, and the CRLF/diff gotcha. Use when creating a new extension repo or working across the existing ones.

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

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

  • Creating a new extension repo
  • Working across the existing ones

Example prompts

  • “/discord-php-extension”

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

    Shell commands in SKILL.md call:

    • git
    • composer

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

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    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 Extension loads about 1.7k tokens when it runs. Until then it costs about 103 tokens; SKILL.md has 484 words of instructions outside code blocks.

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

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). 484 words, ~1,707 tokens.

Download SKILL.mdSave it as .claude/skills/discord-php-extension/SKILL.md (or your agent's skills folder).
name
discord-php-extension
description
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, repositories, JSON state store, the init/application-init boot guard, composer path-repo wiring, and the CRLF/diff gotcha. Use when creating a new extension repo or working across the existing ones.

DiscordPHP Extension / Bot Skill

Distilled from the discord-php/DiscordPHP-{MTG,NHA,Sabacc} extensions, which all follow the same shape: a MessageCommandClient subclass that also speaks to some third-party REST API and/or persists per-user state.

Repository layout

src/<Ns>/
  <Ns>.php              MessageCommandClient subclass; wires the HTTP client,
                        the Client part, and any services (Store, Shop, engine)
  Client.php            (only if you add repositories) extends
                        Discord\Parts\User\Client, adds entries to $repositories
  Http/
    Http.php            implements HttpInterface, `use HttpTrait`; points BASE_URL
                        at the third-party API
    Endpoint.php        implements EndpointInterface, `use EndpointTrait`; the
                        route table as `const`s with `:param` placeholders
    Request.php         extends Discord\Http\Request; overrides getUrl() to
                        prepend Http::BASE_URL
  Repository/           AbstractRepository + one per API resource (optional)
  Parts/               one Part subclass per API object; $fillable + get*Attribute()
  <Ns>Trait.php         pure presentation/helpers (no API, no I/O)
bot.php                boot + slash-command registration + component routing
tests/                 pure-logic tests; no live gateway
composer.json, .php-cs-fixer.dist.php, pint.json, phpunit.xml, env.example

Keep game/business logic in a namespace that imports nothing from Discord\ so it is unit-testable in isolation (see Sabacc\Pazaak).

The client subclass

php
class Foo extends \Discord\MessageCommandClient
{
    protected Http $foo_http;

    public function __construct(array $options = [])
    {
        parent::__construct($options);
        $this->foo_http = new Http('', $this->loop, $options['logger'] ?? new NullLogger(), new React($this->loop, $options['socket_options'] ?? []));
        // If you added repositories:
        $this->client = $this->factory->part(Client::class, (array) $this->client);
    }
}
  • Never pass the Discord bot token to a third-party API client. MTG passed 'Bot '.$this->token into its Http and leaked the token on every request — pass '' and only add an Authorization header when a value is actually set.
  • Default the Http logger arg to new NullLogger(), not null (the trait type-hints LoggerInterface).
  • $options['socket_options'] → new React($this->loop, ...) lets callers set dns etc.

Boot: the dual init guard

Discord fires both init and application-init; the command tree needs the application to be ready. Guard so your setup runs exactly once, after both:

php
$ready = $appReady = false;
$boot = function () use (&$ready, &$appReady, $bot, ...) {
    if (! $ready || ! $appReady) return;
    $bot->application->commands->freshen()->then($registerCommands);
    $bot->listenCommand('foo', fn (Interaction $i) => $commands->dispatch($i));
    // component routing, presence, ...
};
$bot->once('init', function () use (&$ready, $boot) { $ready = true; $boot(); });
$bot->once('application-init', function () use (&$appReady, $boot) { $appReady = true; $boot(); });

Common client options: 'intents' => Intents::getDefaultIntents(), 'disableVoiceClient' => true (unless you need voice — it still opens the gateway regardless), 'storeMessages' => true only if you read from the message cache.

Persistence: a tiny JSON state store

For per-user wallets / identities / settings, a flat JSON file is enough (see NHA\StateStore, Sabacc\Economy\Store):

  • Load lazily on first access; keep everything in memory.
  • Atomic writes: file_put_contents($path.'.'.getmypid().'.tmp', json_encode(...)) then @rename($tmp, $path). Sweep stale *.tmp on load.
  • gitignore the state file: /var/* + !/var/.gitkeep.
  • Do not persist live match/session state across restarts unless you need to — keep it in memory keyed by message id.

composer.json

jsonc
"require": {
    "php": "^8.3",
    "team-reflex/discord-php": "dev-master",
    "discord-php/http": "dev-master as 10.1.7"   // needed: team-reflex/discord-php
},                                               // dev-master requires http ^10.1.7,
"minimum-stability": "dev", "prefer-stable": true,
"repositories": [                                 // local dev against sibling checkouts
    { "type": "path", "url": "../DiscordPHP",      "options": { "symlink": true } },
    { "type": "path", "url": "../DiscordPHP-Http", "options": { "symlink": true } }
]

Run COMPOSER_ROOT_VERSION=dev-main composer install (Composer cannot detect the root version through the path repos otherwise). composer.lock is gitignored in these repos.

Style

.php-cs-fixer.dist.php uses ['@auto' => true, 'phpdoc_align' => [...vertical...], 'phpdoc_indent' => true]. pint.json is {"preset": "psr12", "rules": {"declare_strict_types": true}}. Every file starts with declare(strict_types=1); and the project header comment.

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

The CRLF / diff gotcha

These repos have core.autocrlf=true and no .gitattributes, so php-cs-fixer writes CRLF on disk and Git normalises to LF on git add. A raw git diff after running composer cs shows every line changed. Always inspect the real change set with git diff --cached (after git add) or git diff --cached --stat, not git diff.

Part conventions (additive PHPDoc)

In the core DiscordPHP repo, PHPDoc changes are additive only — add @property / @param tags, never reword existing prose (it mirrors Discord's official docs). Extension repos are freer, but still lead with a one-paragraph class docblock saying what the class is and what it is NOT responsible for.

When a class extends a DiscordPHP part (or any class), narrow each override's return type to the most specific type it can truly return. PHP return types are covariant, so Part can become Channel when a Thread is impossible. Make every path honour it: no return parent::…() with the broader type, and no hydrating through a TYPES map that holds types outside it. Inherited methods that can never work in the subclass's context should return reject(new \BadMethodCallException(…)) rather than fail at Discord. The core repo's .agents/skills/part-model-maintainer has the full pattern.

© 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-extension of discord-php/DiscordPHP.

Open the folder on GitHubat commit 580c66a

Compare with similar skills

Discord Php Extension 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 Extension compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Discord Php Extension this skilldiscord-php/DiscordPHP1.1k—~1.7kAutomated safety check: PassMIT
Agent Browser CLIvercel-labs/agent-browser44k24 repos~864Automated safety check: PassApache-2.0
Configuring Horizoncoollabsio/coolify63k4 repos~898Automated safety check: PassMIT
Tailwindcss Developmentanonaddy/anonaddy4.9k10 repos~865Automated safety check: PassMIT
Fortify Developmentcoollabsio/coolify63k4 repos~1.9kAutomated safety check: PassMIT
MCP Developmentcoollabsio/coolify63k1 repos~949Automated safety check: PassMIT

Similar skills

  • Agent Browser CLI

    vercel-labs/agent-browser

    Official

    Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking…

    44k GitHub starsUsed in 24 repos~864 tokens
    Productivity & AutomationAuto-check passed
  • Configuring Horizon

    coollabsio/coolify

    A skill your agent uses whenever the user mentions Horizon by name in a Laravel context.

    63k GitHub starsUsed in 4 repos~898 tokens
    Backend & APIsAuto-check passed
  • Tailwindcss Development

    anonaddy/anonaddy

    Always invoke when the user's message includes 'tailwind' in any form.

    4.9k GitHub starsUsed in 10 repos~865 tokens
    Frontend & DesignAuto-check passed
  • Fortify Development

    coollabsio/coolify

    ACTIVATE when the user works on authentication in Laravel. An agent skill from coollabsio/coolify.

    63k GitHub starsUsed in 4 repos~1.9k tokens
    Backend & APIsAuto-check passed
  • MCP Development

    coollabsio/coolify

    A skill your agent uses for Laravel MCP development. An agent skill from coollabsio/coolify.

    63k GitHub starsUsed in 1 repo~949 tokens
    Frontend & DesignAuto-check passed
  • Electron App Automation

    vercel-labs/agent-browser

    Official

    Automates Electron desktop apps such as VS Code, Slack or Discord by connecting agent-browser to their Chrome DevTools Protocol port.

    44k GitHub starsUsed in 5 repos~1.7k tokens
    Productivity & AutomationAuto-check passed

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 2 days ago
    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 2 days ago
    Auto-check: notes
  • Discord Php Interactions

    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…

    1.1k GitHub stars~1.5k tokensUpdated 2 days ago
    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 2 days ago
    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 2 days ago
    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 2 days ago
    Auto-check passed

Works with

Questions about Discord Php Extension

What does Discord Php Extension do?

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…. Discord Php Extension is an agent skill from 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, repositories, JSON state store, the init/application-init boot guard, composer path-repo wiring, and the CRLF/diff gotcha.

When should I use Discord Php Extension?

Discord Php Extension fits situations like: creating a new extension repo; working across the existing ones.

How do I install Discord Php Extension in Claude Code?

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

How do I install Discord Php Extension in Codex?

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

Can I use Discord Php Extension 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-extension -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-extension, .gemini/skills/discord-php-extension, .github/skills/discord-php-extension and .opencode/skills/discord-php-extension in your project.

What does Discord Php Extension need to run?

Going by SKILL.md and its folder, Discord Php Extension needs the command-line tools its instructions call (git and composer).

Does Discord Php Extension access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Discord Php Extension 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 Extension use?

Discord Php Extension 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 Extension use?

About 1.7k tokens (SKILL.md is roughly 6.8k 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 Extension?

Skills that share tags, products or a category with Discord Php Extension: Agent Browser CLI (vercel-labs/agent-browser, 44k stars), Configuring Horizon (coollabsio/coolify, 63k stars), Tailwindcss Development (anonaddy/anonaddy, 4.9k stars) and Fortify Development (coollabsio/coolify, 63k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Discord Php Extension?

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.