Skip to content
Skill

Create plugin

Guides an agent to write Marko PHP plugins that intercept public methods with Before

Create plugin is an open-source agent skill for developer tools. It is available on Claude Code.

Scripts
None
Platforms
Claude Code
GitHub stars
416
Last commit
License
MIT
Listing updated

Similar skills

About Create plugin

This skill walks an agent through building a Marko plugin, a class that wraps a public method on another class so behavior can change without subclassing or replacing the class. It covers the two supported interception points, Before and After, and explains how return values control whether the original method runs, receives replaced arguments, or is short-circuited. It also describes how to receive the intercepted instance through a Subject parameter and how sortOrder sets the execution sequence among plugins.

The workflow has the agent identify a public, non-final target method, copy the plugin class and test templates from the skill's assets folder, fill in the host module's namespace from its composer.json autoload mapping, and place the file under src/Plugins. The skill says plugins are discovered automatically, so no module registration is needed. It finishes with a verification step that relies on LSP diagnostics and a find_plugins_targeting MCP tool.

The skill expects a Marko PHP project and a host module to put the plugin in. It points to a separate skill for full class replacement with Preferences and another for event listeners.

When your agent uses it

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.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 3 files (11 KB) on GitHub on 2 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the marko-skills plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add marko-php/marko
/plugin install marko-skills@marko

Or copy only this skill to ~/.claude/skills/create-plugin:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/marko-php/marko.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/create-plugin &&
cp -R "$tmp/packages/claude-plugins/plugins/marko-skills/skills/create-plugin" ~/.claude/skills/create-plugin &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/create-plugin inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/create-plugin to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/marko-php/marko.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/create-plugin &&
cp -R "$tmp/packages/claude-plugins/plugins/marko-skills/skills/create-plugin" ~/.agents/skills/create-plugin &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/create-plugin inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/create-plugin to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/marko-php/marko.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/create-plugin &&
cp -R "$tmp/packages/claude-plugins/plugins/marko-skills/skills/create-plugin" ~/.cursor/skills/create-plugin &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/create-plugin inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/marko-php/marko.git --path packages/claude-plugins/plugins/marko-skills/skills/create-plugin

Or copy the folder to ~/.gemini/skills/create-plugin yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/create-plugin:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/marko-php/marko.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/create-plugin &&
cp -R "$tmp/packages/claude-plugins/plugins/marko-skills/skills/create-plugin" ~/.copilot/skills/create-plugin &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/create-plugin inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/marko-php/marko.git

Then copy marko/packages/claude-plugins/plugins/marko-skills/skills/create-plugin into your agent's skills folder as create-plugin. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Before and After hooks
Explains the two interception points and how each one affects the target method call.
Return value semantics
Describes how null, array and other return values from a Before hook change argument passing or short-circuit the call.
Subject parameter access
Shows how to receive the intercepted instance and avoid recursive calls on it.
Plugin execution ordering
Covers the sortOrder attribute argument and how it sequences plugins.
Template-based scaffolding
Provides plugin class and test templates with placeholders for vendor, module and target class.
Namespace and placement rules
Guides matching the host module's psr-4 namespace and placing the file under src/Plugins.

Good for

  • Add a plugin that logs calls to a repository's save method
  • Modify the return value of a service method before it reaches callers
  • Short-circuit a method with a cached result inside a Marko module
  • Write Before plugin that validates arguments passed to a class method
  • Create a plugin test covering pass-through and argument modification

Create plugin FAQ

What does the skill need before Create plugin can be used?

It assumes a Marko PHP project with an existing host module, and the target class's method must be public and the class not final.

Does the skill require registering the plugin?

No. The skill states that plugins under a module's src directory are auto-discovered and must not be registered in module.php.

Can Create plugin replace a whole class?

No. The skill directs total replacement to a separate Preference skill, since plugins only intercept methods.

What tools does Create plugin use to verify the plugin?

It asks the agent to resolve LSP diagnostics from marko-lsp and then call the find_plugins_targeting MCP tool to confirm discovery.

How do I install Create plugin in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/create-plugin to use it in all your projects, or to .claude/skills/create-plugin in one project. Or install the marko-skills plugin, which includes it: /plugin marketplace add marko-php/marko, then /plugin install marko-skills@marko.

Does Create plugin run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Create plugin?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

What are the best alternatives to Create plugin?

The closest alternatives to Create plugin are Writing plugins, Create module, Minecraft plugin development, Writing hooks and Plugin creator.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from marko-php/marko

  1. Guides an agent through cutting a Marko release: audit PR labels, pick a version, then run

    • Open source
    • 416 GitHub stars
    • Developer tools
  2. Scaffolds a new Marko module as a Composer package with src, Pest tests and config

    • Open source
    • 416 GitHub stars
    • Developer tools