agentleFS
discord-phpdiscord-php/DiscordPHP/.agents/skills/legacy-command-client-keeper/SKILL.md

legacy-command-client-keeper

Skill1.1k starsChanged 35 days agoMITView on GitHub

Maintain the optional prefix-command layer — DiscordCommandClient, Command class, parsing, aliases, cooldowns, and help system. Use when touching message-based command handling.

Trending

More talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 2 mentionsMar 2026: 0 mentionsApr 2026: 1 mentionMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 4 mentionsSep 2026: 13 mentionsOct 2026: 9 mentionsNov 2026: 1 mention
Dec 2025Jun 2026Nov 2026
Mentions a month of the discord-php/DiscordPHP repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about discord-php/DiscordPHP

The biggest 5 of 52 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 52

Talked about on GitHub and Bluesky (52 times).

On GitHub · 50

45 more on GitHub

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 11 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    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
  1. Distinctive:

    Use this skill when work touches:

    line 11
  2. Distinctive:

    Keep prefix-command behavior as a clean optional layer:

    line 20
  3. Distinctive:

    default help command behavior

    line 59
  4. Very specific:

    If code does not clearly belong to one of those two, re-check whether it belongs in core Discord instead.

    line 71
  5. Distinctive:

    If changing parsing, preserve expectations around:

    line 101
  6. Distinctive:

    If help behavior changes, inspect both top-level help and per-command help.

    line 120
  7. Distinctive:

    Do not move cooldown logic into unrelated core message or user models.

    line 131
  8. Distinctive:

    Do not try to force one abstraction to power both unless you intend a broad architectural redesign.

    line 142
  9. Distinctive:

    If user-facing callback returns string, reply behavior should remain simple and unsurprising.

    line 150
  10. Distinctive:

    Stop if you see:

    line 161
  11. Distinctive:

    default help command still reflects command metadata

    line 176
  12. Distinctive:

    no leakage into interaction command layer unless explicitly intended

    line 177

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

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

Skill: legacy-command-client-keeper

Use this skill when work touches:

  • src/Discord/DiscordCommandClient.php
  • src/Discord/CommandClient/Command.php

This is optional-prefix-command skill. Load it when maintaining the message-command layer built on top of core Discord.

Goal

Keep prefix-command behavior as a clean optional layer:

  • built on top of Discord
  • driven by message events
  • owning its own parsing, aliases, subcommands, cooldowns, and help behavior
  • separate from application-command interaction flow

Read in this order

  1. src/Discord/DiscordCommandClient.php
  2. src/Discord/CommandClient/Command.php
  3. Example or guide material using command client, if public behavior changes
  4. Interaction command path only if change risks cross-layer leakage:
    • src/Discord/Helpers/RegisteredCommand.php
    • src/Discord/WebSockets/Events/InteractionCreate.php

Core contract

DiscordCommandClient extends Discord, but it does not replace core client architecture. It layers:

  • command-specific options
  • prefix detection
  • alias maps
  • command registry
  • default help command
  • message event routing into command callbacks

The command layer should stay optional and message-driven.

Main responsibilities by class

DiscordCommandClient

Owns:

  • command-client option resolution
  • wiring message event listeners during init
  • prefix and mention-prefix expansion
  • top-level command and alias registry
  • default help command behavior

CommandClient\Command

Owns:

  • one command's callback
  • subcommand tree
  • alias mapping for subcommands
  • help metadata
  • cooldown tracking and cooldown messaging

If code does not clearly belong to one of those two, re-check whether it belongs in core Discord instead.

Option rules

DiscordCommandClient uses OptionsResolver for its own layer. Preserve existing semantics around:

  • prefix
  • prefixes
  • name
  • description
  • defaultHelpCommand
  • discordOptions
  • caseInsensitiveCommands
  • internalRejectedPromiseHandler

Command-client options are not core runtime options. Keep them isolated unless a true cross-layer dependency exists.

Parsing rules

Message-command flow today:

  1. command client listens on init
  2. prefix strings get mention placeholders expanded
  3. on message event, ignore self messages
  4. checkForPrefix() strips prefix
  5. args parsed via str_getcsv(..., ' ', '\"', '\\\\')
  6. command name resolved through commands then aliases
  7. command callback invoked
  8. string return values become reply messages

If changing parsing, preserve expectations around:

  • mention prefixes
  • quoted arguments
  • alias lookup
  • case-insensitive mode

Help-system rules

The default help command is not incidental. It is part of command-client feature set.

Preserve:

  • per-command descriptions and long descriptions
  • usage text
  • alias display
  • subcommand display
  • embed-based help formatting

If help behavior changes, inspect both top-level help and per-command help.

Cooldown and subcommand rules

CommandClient\Command carries its own operational semantics:

  • cooldowns keyed by author id
  • subcommands recurse
  • alias lookup for subcommands
  • help visibility controlled by option metadata

Do not move cooldown logic into unrelated core message or user models.

Boundaries with interaction commands

This layer is not the same as application commands.

Keep these separate:

  • prefix commands use DiscordCommandClient + CommandClient\Command
  • application commands use Discord::listenCommand() + RegisteredCommand + interaction events

Do not try to force one abstraction to power both unless you intend a broad architectural redesign.

Shared naming concepts are fine. Shared execution path is not current repo design.

Error-handling rules

Internal rejected promises use internalRejectedPromiseHandler. Preserve that pattern rather than sprinkling silent catches or inconsistent logger behavior through callbacks.

If user-facing callback returns string, reply behavior should remain simple and unsurprising.

Existing patterns worth copying

  • top-level command registration through registerCommand()
  • alias registration separated from command registration
  • subcommand tree managed inside Command
  • command options resolved once, then carried as help/cooldown metadata

Smells

Stop if you see:

  • prefix-command concerns moving into Message, Channel, Discord, or interaction code
  • alias or cooldown state stored outside command layer
  • parsing changes that break quoted args or mention prefixes without explicit intent
  • help system logic duplicated in multiple places
  • interaction-command abstractions merged into prefix-command path

Checklist before commit

  • command-client options still resolve cleanly
  • prefix expansion and parsing still intentional
  • command and alias registry behavior still coherent
  • subcommand recursion still works
  • cooldown behavior still belongs to command objects
  • default help command still reflects command metadata
  • no leakage into interaction command layer unless explicitly intended

Bottom line

Legacy command client is convenience layer, not core runtime. Keep it self-contained, predictable, and clearly separate from slash-command interactions.

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.

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.