Agent skill

Repository Cache Keeper

by discord-php in discord-php/DiscordPHP

Maintain Repository classes — REST endpoints, route vars, cache coherence, typed collections, and persistence boundaries.

MITAuto-check passedBackend & APIs

Install Repository Cache Keeper

skills CLI
$ npx skills add discord-php/DiscordPHP --skill repository-cache-keeper -a claude-code

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

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

At a glance

Maintain Repository classes — REST endpoints, route vars, cache coherence, typed collections, and persistence boundaries.

  • Works in 6 steps: src/Discord/Repository/AbstractRepository… → src/Discord/Repository/AbstractRepository… → src/Discord/Parts/PartTrait.php sections… → …
  • Changing repository CRUD
  • SKILL.md covers Goal, Read in this order, Core contract and Meaning of common properties, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Repository Cache Keeper is an agent skill from discord-php/DiscordPHP. Maintain Repository classes — REST endpoints, route vars, cache coherence, typed collections, and persistence boundaries. Use when changing repository CRUD, cache behavior, or endpoint bindings.

Its SKILL.md is about 2.2k 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 Backend & APIs, covering REST APIs. 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 repository CRUD
  • Endpoint bindings

Example prompts

  • “/repository-cache-keeper”

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. src/Discord/Repository/AbstractRepository.php
  2. src/Discord/Repository/AbstractRepositoryTrait.php
  3. src/Discord/Parts/PartTrait.php sections for getRepositoryAttributes(), getCreatableAttributes(), getUpdatableAttributes()
  4. src/Discord/Helpers/CacheWrapper.php and cache config code if cache behavior matters
  5. Representative repos
  6. The owning part for the repository you are touching

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.

    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

Repository Cache Keeper loads about 2.2k tokens when it runs. Until then it costs about 55 tokens; SKILL.md has 1,061 words of instructions outside code blocks.

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

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). 1,061 words, ~2,228 tokens.

Download SKILL.mdSave it as .claude/skills/repository-cache-keeper/SKILL.md (or your agent's skills folder).
name
repository-cache-keeper
description
Maintain Repository classes — REST endpoints, route vars, cache coherence, typed collections, and persistence boundaries. Use when changing repository CRUD, cache behavior, or endpoint bindings.

Skill: repository-cache-keeper

Use this skill when work touches src/Discord/Repository/**/*.

This is cache-and-REST boundary skill. Load it when a change affects how parts are collected, fetched, persisted, cached, or routed to endpoints.

Goal

Keep repositories as:

  • typed collections
  • route-aware REST wrappers
  • cache coordinators
  • owning persistence boundary for a part family

Not as service dumping ground.

Read in this order

  1. src/Discord/Repository/AbstractRepository.php
  2. src/Discord/Repository/AbstractRepositoryTrait.php
  3. src/Discord/Parts/PartTrait.php sections for getRepositoryAttributes(), getCreatableAttributes(), getUpdatableAttributes()
  4. src/Discord/Helpers/CacheWrapper.php and cache config code if cache behavior matters
  5. Representative repos:
    • src/Discord/Repository/GuildRepository.php
    • src/Discord/Repository/Guild/ChannelRepository.php
    • src/Discord/Repository/Channel/MessageRepository.php
    • src/Discord/Repository/Interaction/GlobalCommandRepository.php
    • src/Discord/Repository/Guild/GuildCommandRepository.php
  6. The owning part for the repository you are touching

Core contract

Every repository centers on same shape:

  • extends AbstractRepository
  • sets $class to the concrete part family
  • usually sets $endpoints
  • may override $discrim
  • receives $vars route context from parent part or caller
  • stores typed items in collection semantics
  • persists through HTTP
  • mirrors authoritative state into cache

If a method no longer feels like typed collection + route-aware persistence, it probably belongs elsewhere.

Meaning of common properties

$class

Concrete part family allowed in this repository. If wrong, hydration, type checks, and cache writes all become unsafe.

$endpoints

Route templates keyed by operation name. Typical keys:

  • all
  • get
  • create
  • update
  • delete

Not every repository supports every operation. Missing endpoint is an intentional capability statement.

$vars

Route-binding context. This is how nested repos know where they live:

  • guild repositories get guild_id
  • channel repositories get channel_id
  • some repos also need application_id, message_id, or other parent route pieces

When repo behavior looks wrong, inspect parent part getRepositoryAttributes() first.

$discrim

Collection key field, usually id. Only change when payload family genuinely keys on a different field.

$cache

Per-repository cache wrapper. It is not optional frosting. Repo methods should keep it coherent with in-memory items.

Core methods and what they mean

create(array|object $attributes = [], bool $created = false)

Builds local typed part using repository context plus attributes. No REST call. No remote persistence. Use it for drafts or hydration helpers.

save(Part $part, ?string $reason = null)

Generic persistence path:

  • POST when $part->created is false
  • PATCH when $part->created is true
  • uses part-provided repository attributes and creatable/updatable attributes
  • updates cache with returned part

Part-level save() may wrap or redirect this when semantics demand it.

delete($part, ?string $reason = null)

Remote delete plus cache removal. Accepts part or identifier. Keep typed return contract.

fetch(string $id, bool $fresh = false)

Resolve from memory, then cache, then REST unless forced fresh. This is one of main async entry points. Keep it Promise-based.

fresh(Part $part, array $queryparams = [])

Refresh a known created part from REST and update cache.

freshen(array $queryparams = [])

Bulk refresh repository contents from REST. This is repo-wide sync tool, not a one-item fetch.

How cache and collection semantics fit together

Repositories are hybrid objects:

  • collection-like for iteration, filtering, get(), find(), first(), last()
  • async cache-aware for cacheGet(), cachePull(), fetch(), freshen()

That dual nature is intentional. Do not flatten repository into only async map or only plain collection.

Important behavior to preserve
  • in-memory items can hold real parts, WeakReference, or null placeholders
  • cache wrapper may outlive in-memory strong references
  • repo methods often try memory first, then cache, then REST
  • successful REST mutations should refresh cache state immediately

Endpoint routing rules

Use Endpoint and bound vars

Repository methods should bind route vars through Endpoint/Endpoint::bind(), not manual string interpolation spread across code.

Parent context comes from parts

If child repository starts losing route info, fix parent part getRepositoryAttributes() or repo constructor normalization, not random callers.

Constructor normalization is acceptable

If a repo needs to clean or enrich vars for route correctness, constructor override is fine. Example patterns already exist:

  • MessageRepository unsets thread_id for thread message routing
  • GuildCommandRepository injects bot application id

When to add domain-specific repository methods

Add repo-specific methods when operation is broader than generic CRUD and naturally belongs to collection/route boundary.

Good examples:

  • leaving a guild from GuildRepository
  • previewing a guild from GuildRepository
  • creating guild channels from ChannelRepository

Bad examples:

  • permission-heavy semantic operation better expressed as $part->save() or $part->someAction()
  • userland convenience that only repackages one line and adds no domain meaning
Show full SKILL.md (403 more words)Show less

Ownership boundary: part vs repository

Part owns
  • semantic meaning of operation
  • permission checks
  • special-case routing based on object meaning
  • public high-level API surface
Repository owns
  • endpoint selection
  • request method and payload dispatch
  • cache persistence
  • typed hydration from HTTP response

If code needs to know "is this current member or generic member", "is this webhook message or normal message", or "does bot need manage_messages here", that usually belongs on part side first.

New repository playbook

  1. Choose concrete part family and set $class
  2. Set $endpoints
  3. Decide $discrim
  4. Verify parent route vars required
  5. Verify parent part getRepositoryAttributes()
  6. Add domain-specific methods only if generic CRUD not enough
  7. Inspect gateway events that should populate this repo
  8. Add docblock @method helpers if family uses them

Existing patterns worth copying

Thin specialization

Some repos are intentionally small:

  • GlobalCommandRepository
  • MessageRepository

That is okay. Not every repo needs custom methods.

Constructor route correction

If nested route shape is tricky, normalize vars in constructor instead of forcing every caller to know internals.

Cache-first reads

Methods like fetch() and get() preserve performance by preferring in-memory/cache before REST. Keep that bias unless correctness requires bypass.

Gateway interaction rules

Repositories are often updated from gateway events, not only from their own REST methods. When changing repository keying or cache semantics, inspect matching event handlers. If repository expectations change but event cache writes do not, the repo will look "randomly stale".

Common families to cross-check:

  • guild/channel/message/thread create/update/delete events
  • interaction entitlements or command-related caches
  • member/user/presence caches

Smells

Stop if you see:

  • raw REST payloads returned where typed part should be returned
  • new route vars threaded manually through many call sites
  • repo mutating part semantics that belong in part save()
  • cache not updated after successful REST mutation
  • in-memory items updated but cache wrapper ignored, or reverse
  • parent part and repo disagree on route context
  • generic service/helper class added to do what repository already does

Checklist before commit

  • $class, $endpoints, $discrim, $vars still describe repo correctly
  • parent getRepositoryAttributes() still supplies needed route vars
  • create/save/delete/fetch semantics remain typed and Promise-based
  • cache and in-memory items stay aligned
  • any special methods belong here semantically
  • related gateway event handlers still populate repo coherently
  • docs/tests updated if public behavior changed

Bottom line

Repository code in this repo should feel boring in right way: typed, route-aware, cache-coherent, and predictable. If a repository starts making domain decisions or returning untyped transport data, pull it back to its real job.

© 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 .agents/skills/repository-cache-keeper of discord-php/DiscordPHP.

Open the folder on GitHubat commit 580c66a

Compare with similar skills

Repository Cache Keeper 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.

Repository Cache Keeper compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Repository Cache Keeper this skilldiscord-php/DiscordPHP1.1k—~2.2kAutomated safety check: PassMIT
Laravel SpecialistJeffallan/claude-skills12k1 repos~2.1kAutomated safety check: PassMIT
Latchkeyimbue-ai/latchkey130—~1.3kAutomated safety check: PassMIT
B24phpsdk Maintainerbitrix24/b24phpsdk102—~10kAutomated safety check: NotesMIT
DiscordOpenHands/extensions158—~1.1kAutomated safety check: PassMIT
WooCommerce Store API Routeswoocommerce/woocommerce11k—~932Automated safety check: PassCustom licence

Similar skills

  • Laravel Specialist

    Jeffallan/claude-skills

    Builds Laravel 10+ applications with Eloquent models, Sanctum authentication, Horizon queues, API resources and Livewire components, tested with Pest or PHPUnit.

    12k GitHub starsUsed in 1 repo~2.1k tokens
    Backend & APIsAuto-check passed
  • Latchkey

    imbue-ai/latchkey

    Interact with third-party or self-hosted services (Slack, Google Workspace, Dropbox, GitHub, Linear, Coolify...) using their HTTP APIs on the user's behalf.

    130 GitHub stars~1.3k tokensUpdated 5 days ago
    Backend & APIsAuto-check passed
  • B24phpsdk Maintainer

    bitrix24/b24phpsdk

    A skill your agent uses whenever working with GitHub issues in the bitrix24/b24phpsdk repository: creating new issues, reading existing ones, planning implementation from an issue, referencing an…

    102 GitHub stars~10k tokensUpdated 8 days ago
    Backend & APIsAuto-check: notes
  • Discord

    OpenHands/extensions

    Build and automate Discord integrations (bots, webhooks, slash commands, and REST API workflows).

    158 GitHub stars~1.1k tokensUpdated today
    Backend & APIsAuto-check passed
  • WooCommerce Store API Routes

    woocommerce/woocommerce

    Guidelines for adding or changing routes in the WooCommerce Store API under /wc/store/v1, covering authentication, REST design, schemas and variations.

    11k GitHub stars~932 tokensUpdated today
    Backend & APIsAuto-check passed
  • Discord Client

    z80dev/lemon

    Interact with Discord via a bot: read channels, send messages, list guilds/channels, upload files, manage threads.

    132 GitHub stars~771 tokensUpdated today
    Backend & APIsAuto-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 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 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 2 days ago
    Auto-check passed
  • 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

Works with

Categories

Questions about Repository Cache Keeper

What does Repository Cache Keeper do?

Maintain Repository classes — REST endpoints, route vars, cache coherence, typed collections, and persistence boundaries. Repository Cache Keeper is an agent skill from discord-php/DiscordPHP. Maintain Repository classes — REST endpoints, route vars, cache coherence, typed collections, and persistence boundaries.

When should I use Repository Cache Keeper?

Repository Cache Keeper fits situations like: changing repository CRUD; endpoint bindings.

How do I install Repository Cache Keeper in Claude Code?

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

How do I install Repository Cache Keeper in Codex?

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

Can I use Repository Cache Keeper 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 repository-cache-keeper -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/repository-cache-keeper, .gemini/skills/repository-cache-keeper, .github/skills/repository-cache-keeper and .opencode/skills/repository-cache-keeper in your project.

What does Repository Cache Keeper need to run?

SKILL.md names no scripts, command-line tools or credentials: Repository Cache Keeper is instructions for the agent only.

Does Repository Cache Keeper 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 Repository Cache Keeper 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 Repository Cache Keeper use?

Repository Cache Keeper 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 Repository Cache Keeper use?

About 2.2k tokens (SKILL.md is roughly 8.9k 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 Repository Cache Keeper?

Skills that share tags, products or a category with Repository Cache Keeper: Laravel Specialist (Jeffallan/claude-skills, 12k stars), Latchkey (imbue-ai/latchkey, 130 stars), B24phpsdk Maintainer (bitrix24/b24phpsdk, 102 stars) and Discord (OpenHands/extensions, 158 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Repository Cache Keeper?

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.