Agent skill

Create Plugin

by marko-php in marko-php/marko

Create a Marko plugin — a class that intercepts methods on another class to modify behavior without subclassing.

MITAuto-check passed

Install Create Plugin

skills CLI
$ npx skills add marko-php/marko --skill create-plugin -a claude-code

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

GitHub CLI
$ gh skill install marko-php/marko create-plugin --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/marko-php/marko.git skills-src && mkdir -p .claude/skills && cp -r skills-src/packages/claude-plugins/plugins/marko-skills/skills/create-plugin .claude/skills/create-plugin && 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
create-plugin
GitHub stars
397
Token cost
~1.8k tokens
SKILL.md length
787 words
Files
3 (incl. assets)
Skills in repo
3
Repo updated
First seen
Licence
MIT

At a glance

Create a Marko plugin — a class that intercepts methods on another class to modify behavior without subclassing.

  • Works in 6 steps: Identify the target → Copy the plugin class template → Implement the interceptor methods → …
  • The user wants to add a plugin
  • SKILL.md covers When to use, Plugin model — two timings only, Runbook and Constraints, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Create Plugin is an agent skill from marko-php/marko. Create a Marko plugin — a class that intercepts methods on another class to modify behavior without subclassing. Use this skill whenever the user wants to add a plugin, intercept a method, or extend a class's behavior. Concrete triggers: "add a plugin for the OrderService", "intercept the save method on User", "extend the behavior of X without changing it", "modify Y's return value before it's returned", "I need a plugin", "create a Before/After plugin". Plugins use the [Plugin], [Before], [After] attributes.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including assets.

It works with PHP. The repository describes itself as: The modular PHP framework. The licence is MIT.

When your agent uses it

  • The user wants to add a plugin
  • Intercept a method
  • Extend a classs behavior

Example prompts

  • “s behavior. Concrete triggers:”
  • “intercept the save method on User”
  • “extend the behavior of X without changing it”
  • “/create-plugin”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Identify the target
  2. Copy the plugin class template
  3. Implement the interceptor methods
  4. Copy the test template
  5. Verify placement
  6. LSP and MCP verification gate

What it can do on your machine

Read from SKILL.md and the folder at commit 0a400a7. 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

    Links to these hosts (documentation or services it may open):

    • marko.build
    • github.com

    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

Create Plugin loads about 1.8k tokens when it runs. Until then it costs about 134 tokens; SKILL.md has 787 words of instructions outside code blocks.

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

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 marko-php/marko at commit 0a400a7, republished under its MIT licence (© marko-php). 787 words, ~1,803 tokens.

Download SKILL.mdSave it as .claude/skills/create-plugin/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
create-plugin
description
Create a Marko plugin — a class that intercepts methods on another class to modify behavior without subclassing. **Use this skill whenever the user wants to add a plugin, intercept a method, or extend a class's behavior.** Concrete triggers: "add a plugin for the OrderService", "intercept the save method on User", "extend the behavior of X without changing it", "modify Y's return value before it's returned", "I need a plugin", "create a Before/After plugin". Plugins use the #[Plugin], #[Before], #[After] attributes.

Create a Marko Plugin

This skill is the canonical specification for a Marko plugin. Do not inspect existing plugins in this project to infer structure — siblings may have drifted from spec. Copy the templates from assets/ verbatim, substitute placeholders, and stop.

A plugin is a class that intercepts the input or output of a public method on any other class — without replacing that class. Plugins are Marko's fine-grained extensibility primitive. They are auto-discovered from any module's src/ directory; no manual registration is needed.

When to use

Use a plugin when the user wants to modify arguments to, or the result from, a public method on a class without rewriting or subclassing it. Common cases:

  • Enrich a return value
  • Validate or transform inputs before the method runs
  • Short-circuit (cache hit, guard, redirect)
  • Log or observe calls
  • Chain transformations across modules

For total replacement of a class, use a Preference instead — that is a separate skill (marko-create-preference). Plugins and Preferences are complementary; only Preferences swap entire implementations.

Plugin model — two timings only

Marko supports exactly two plugin types. A third type that wraps the call is intentionally absent — anything it could do is expressed as a Before (short-circuit) or After (result transformation), keeping the call stack debuggable.

AttributeWhenWhat it does
#[Before]Before the target methodModify args, short-circuit, or pass through
#[After]After the target methodReceive and modify the return value
Before return semantics
Return valueEffect
nullPass-through — original method runs with original args
arrayReplace arguments — original method runs with these args
Any other non-null valueShort-circuit — original method is NOT called
After return semantics

After plugins receive $result (the return value of the original method or a prior After plugin) as their first parameter, followed by the (possibly modified) original arguments. Each After plugin's return value feeds the next After plugin in sort order — always return the (possibly modified) result.

sortOrder

sortOrder is defined on the method-level attribute, not the class. Lower numbers run first; negatives are valid; default is 0.

php
#[Before(sortOrder: -10)]   // runs before plugins at default 0
#[After(sortOrder: 100)]    // runs after lower-priority Afters

Runbook

Step 1 — Identify the target

Determine which class and public method to intercept. Plugins cannot intercept protected or private methods, and the target class must not be final.

Step 2 — Copy the plugin class template

Copy assets/PluginClass.php.tmpl verbatim. Substitute:

PlaceholderValue
{{Vendor}}The host module's namespace vendor segment, StudlyCase (e.g. App, Acme)
{{Name}}The host module's name segment, StudlyCase (e.g., Blog)
{{TargetClass}}Unqualified class name (e.g., PostRepository)

{{Vendor}}\{{Name}} is inherited from the module that hosts the plugin — read it, do not re-derive it. A plugin lives inside an existing module, so its namespace must match that module exactly. Read the host module's composer.json autoload.psr-4 key and use its prefix verbatim:

  • App-local module (app/{name}/) → namespace App\{Name} (the vendor segment is always the literal App, never the project directory name).
  • Distributable module (modules/{vendor}/{name}/) → namespace {Vendor}\{Name} from that module's psr-4.
  • Framework monorepo package (packages/{name}/, root contains packages/core/) → namespace Marko\{Name}.

Never use Marko as the vendor outside the framework monorepo. Do not infer the vendor from the project's root composer.json name: a skeleton-derived project still carries marko/skeleton there. The host module's own psr-4 mapping is the source of truth.

Place the file at src/Plugins/{{TargetClass}}Plugin.php inside the module.

Add the correct use statement for the fully-qualified target class.

Remove any #[Before] or #[After] methods that are not needed for this plugin — the template shows both for illustration.

Show full SKILL.md (229 more words)Show less
Step 3 — Implement the interceptor methods

Name each plugin method identically to the target method it intercepts (or use the method: argument on the attribute to override when names would collide).

Apply the correct return semantics from the table above.

Step 4 — Copy the test template

Copy assets/PluginTest.php.tmpl verbatim. Substitute the same placeholders.

Adjust test cases to reflect the actual behavior being intercepted (pass-through, argument modification, short-circuit, result enrichment).

Step 5 — Verify placement
  • The plugin class lives anywhere under src/ — src/Plugins/ is conventional.
  • Do not register it in module.php — discovery is automatic.
Step 6 — LSP and MCP verification gate

After writing files, expect LSP diagnostics from marko-lsp. Resolve all diagnostics before declaring the plugin complete — diagnostics are the verification gate. Then call the find_plugins_targeting MCP tool with the target class to confirm the new plugin is discovered.

Constraints

  • Targeted methods must be public on the target class
  • Target class must not be final (Marko avoids final for this reason)
  • Plugin classes should be readonly when they have no mutable state
  • Constructor property promotion always
  • declare(strict_types=1) always
  • No magic methods
  • No traits

What this skill does not cover

  • Creating a new module to host the plugin — see marko-create-module
  • Replacing an entire class — that is a Preference, not a Plugin (use marko-create-preference)
  • Listening to events — that is #[Observer], a different mechanism

See also

© marko-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

SKILL.md and 2 other files (assets) in packages/claude-plugins/plugins/marko-skills/skills/create-plugin of marko-php/marko.

  • SKILL.md
  • assets/PluginClass.php.tmpl
  • assets/PluginTest.php.tmpl

Open the folder on GitHubat commit 0a400a7

Compare with similar skills

Create Plugin 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.

Create Plugin compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Create Plugin this skillmarko-php/marko397—~1.8kAutomated safety check: PassMIT
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
WooCommerce Code Reviewwoocommerce/woocommerce11k3 repos~1.1kAutomated safety check: PassCustom licence

Similar skills

  • 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
  • WooCommerce Code Review

    woocommerce/woocommerce

    Reviews WooCommerce code changes against the project's standards, flagging backend PHP architecture, naming, documentation, data integrity and testing violations.

    11k GitHub starsUsed in 3 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Sync Translations

    symfony/symfony

    Synchronize translation catalogs across maintained Symfony branches: find messages that newer branches added to the English catalogs but that are still missing from the oldest maintained branch…

    31k GitHub stars~1.9k tokensUpdated today
    Writing & ContentAuto-check passed

More from marko-php/marko

  • Create Module

    marko-php/marko

    Scaffold a new Marko module — a self-contained Composer package with composer.json, namespaced src/, and Pest tests.

    397 GitHub stars~2.2k tokensUpdated yesterday
    Auto-check passed
  • Release

    marko-php/marko

    Cut a new Marko release. An agent skill from marko-php/marko.

    397 GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Create Plugin

What does Create Plugin do?

Create a Marko plugin — a class that intercepts methods on another class to modify behavior without subclassing. Create Plugin is an agent skill from marko-php/marko. Create a Marko plugin — a class that intercepts methods on another class to modify behavior without subclassing.

When should I use Create Plugin?

Create Plugin fits situations like: the user wants to add a plugin; intercept a method; extend a classs behavior.

How do I install Create Plugin in Claude Code?

Run `npx skills add marko-php/marko --skill create-plugin -a claude-code`. Or copy the skill folder (packages/claude-plugins/plugins/marko-skills/skills/create-plugin in marko-php/marko) into .claude/skills/create-plugin in your project. Claude Code loads it when a task matches its description.

How do I install Create Plugin in Codex?

Run `npx skills add marko-php/marko --skill create-plugin -a codex`. Or copy the skill folder (packages/claude-plugins/plugins/marko-skills/skills/create-plugin in marko-php/marko) into .agents/skills/create-plugin in your project. Codex loads it when a task matches its description.

Can I use Create Plugin 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 marko-php/marko --skill create-plugin -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/create-plugin, .gemini/skills/create-plugin, .github/skills/create-plugin and .opencode/skills/create-plugin in your project.

What does Create Plugin need to run?

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

Does Create Plugin access the network?

SKILL.md names 2 domains. As links in the text: marko.build and github.com. This is read from the text; nothing was executed.

Is Create Plugin 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 Create Plugin use?

Create Plugin 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 Create Plugin use?

About 1.8k tokens (SKILL.md is roughly 7.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 Create Plugin?

Skills that share tags, products or a category with Create Plugin: Configuring Horizon (coollabsio/coolify, 63k stars), Tailwindcss Development (anonaddy/anonaddy, 4.9k stars), Fortify Development (coollabsio/coolify, 63k stars) and MCP 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 Create Plugin?

marko-php (a GitHub organization) maintains it in marko-php/marko, which has 397 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on October 6, 2026.

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