Agent skill

Code Style

by Automattic in Automattic/wordpress-activitypub

PHP coding standards and WordPress patterns for ActivityPub plugin.

MITAuto-check passedDevelopment

Install Code Style

skills CLI
$ npx skills add Automattic/wordpress-activitypub --skill code-style -a claude-code

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

GitHub CLI
$ gh skill install Automattic/wordpress-activitypub code-style --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/Automattic/wordpress-activitypub.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/code-style .claude/skills/code-style && 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
code-style
GitHub stars
582
Token cost
~2.2k tokens
SKILL.md length
509 words
Files
1
Skills in repo
7
Repo updated
First seen
Licence
MIT

At a glance

PHP coding standards and WordPress patterns for ActivityPub plugin.

  • Writing PHP code
  • SKILL.md covers Quick Reference, Comprehensive Standards, Directory Structure and ActivityPub Architectural…, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Creating classes

What it does

Code Style is an agent skill from Automattic/wordpress-activitypub. PHP coding standards and WordPress patterns for ActivityPub plugin. Use when writing PHP code, creating classes, implementing WordPress hooks, or structuring plugin files.

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 Development, covering Code quality. It works with WordPress and PHP. The repository describes itself as: The ActivityPub plugin connects your WordPress site to the Fediverse. Your site becomes a profile people can follow from Mastodon, and every post you publish is automatically… The licence is MIT.

When your agent uses it

  • Writing PHP code
  • Creating classes
  • Implementing WordPress hooks
  • Structuring plugin files

Example prompts

  • “/code-style”

What it can do on your machine

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

    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

Code Style loads about 2.2k tokens when it runs. Until then it costs about 46 tokens; SKILL.md has 509 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~46
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 Automattic/wordpress-activitypub at commit 72d53bc, republished under its MIT licence (© Automattic). 509 words, ~2,228 tokens.

Download SKILL.mdSave it as .claude/skills/code-style/SKILL.md (or your agent's skills folder).
name
code-style
description
PHP coding standards and WordPress patterns for ActivityPub plugin. Use when writing PHP code, creating classes, implementing WordPress hooks, or structuring plugin files.

ActivityPub PHP Conventions

Plugin-specific conventions and architectural patterns for the ActivityPub plugin.

First rule: reuse before writing. Prefer WordPress core functions, then existing plugin helpers (includes/functions*.php, Sanitize, src/shared/), over any new implementation — and never swap a core-function-based check for bespoke logic. See "Reuse Core Functionality First" in docs/php-coding-standards.md.

Quick Reference

File Naming
class-{name}.php         # Regular classes.
trait-{name}.php         # Traits.
interface-{name}.php     # Interfaces.
Namespace Pattern
php
namespace Activitypub;
namespace Activitypub\Transformer;
namespace Activitypub\Collection;
namespace Activitypub\Handler;
namespace Activitypub\Activity;
namespace Activitypub\Rest;
Text Domain

Always use 'activitypub' for translations:

php
\__( 'Text', 'activitypub' );
\_e( 'Text', 'activitypub' );
WordPress Global Functions

When in a namespace, always escape WordPress functions with backslash: \get_option(), \add_action(), etc.

Imports and Class References

Two symmetric rules, both enforced in review:

php
// Plugin classes: import with `use`, never reference inline.
use Activitypub\Collection\Outbox;

Outbox::add( $activity );          // ✅
\Activitypub\Collection\Outbox::add( $activity ); // ❌ no inline namespaces

// Global (WordPress/PHP) classes: reference inline with a backslash, never import.
$query = new \WP_Query( $args );   // ✅
class Command extends \WP_CLI_Command {} // ✅
use WP_Query;                      // ❌ no `use` for global classes
Comments
  • /* */ for multi-line comments, // for single-line — not stacked // lines.
  • Place each comment at the line it documents, not as one block above a block of code. Detail is fine; split it per statement.
  • Explain the non-obvious mechanic that makes a line necessary, never the bug or ticket behind it. A line that speaks for itself gets no comment.
Plugin Idioms
  • No try/catch or try/finally. Hook a filter around a call as add_filter → call → remove_filter, and report failures through return values (WP_Error, false).
  • "C2S" stays out of identifiers, file names and code comments; the official name is "ActivityPub API", and "client" is fine for the consuming side.
  • Anything that leaves the server (REST responses, deliveries) is rendered with $activity->to_array( false, false ): no per-item @context, no bto/bcc. Storage keeps to_array( true, true ) for the round trip.
  • A few duplicated lines at two call sites beat a new helper; a whole duplicated method body across sibling classes does not.

Comprehensive Standards

See docs/php-coding-standards.md for complete WordPress coding standards.

See docs/php-class-structure.md for detailed directory organization.

Directory Structure

includes/
├── class-*.php              # Core classes.
├── activity/                # Activity type classes.
├── collection/              # Collection classes.
├── handler/                 # Activity handlers.
├── rest/                    # REST API endpoints.
├── transformer/             # Content transformers.
└── wp-admin/                # Admin functionality.

integration/                 # Third-party integrations (root level).

ActivityPub Architectural Patterns

Transformers

Convert WordPress content into ActivityPub objects.

When to use: Converting posts, comments, users, or custom content types into ActivityPub format.

Base class: includes/transformer/class-base.php

Pattern:

php
namespace Activitypub\Transformer;

class Custom extends Base {
    /**
     * Transform object to ActivityPub format.
     *
     * @return array The ActivityPub representation.
     */
    public function transform() {
        $object = parent::transform();
        // Custom transformation logic.
        return $object;
    }
}

Examples:

  • includes/transformer/class-post.php - Post transformation.
  • includes/transformer/class-comment.php - Comment transformation.
  • includes/transformer/class-user.php - User/actor transformation.
Show full SKILL.md (210 more words)Show less
Handlers

Process incoming ActivityPub activities from remote servers.

When to use: Processing incoming Follow, Like, Create, Delete, Update, etc. activities.

Pattern: Each handler processes one activity type from the inbox.

Examples:

  • includes/handler/class-follow.php - Process Follow activities.
  • includes/handler/class-create.php - Process Create activities.
  • includes/handler/class-delete.php - Process Delete activities.
  • includes/handler/class-like.php - Process Like activities.
Collections

Implement ActivityPub collections (Followers, Following, etc.).

When to use: Exposing lists of actors, activities, or objects via ActivityPub.

Examples:

  • includes/collection/class-followers.php - Followers collection.
  • includes/collection/class-following.php - Following collection.
REST API Controllers

Expose ActivityPub endpoints.

Namespace: ACTIVITYPUB_REST_NAMESPACE

Examples:

  • includes/rest/class-actors-controller.php - Actor endpoint.
  • includes/rest/class-inbox-controller.php - Inbox endpoint.
  • includes/rest/class-outbox-controller.php - Outbox endpoint.
  • includes/rest/class-followers-controller.php - Followers collection endpoint.

Plugin-Specific Helper Functions

php
// Get remote actor metadata.
$metadata = get_remote_metadata_by_actor( $actor_url );

// Convert ActivityPub object to URI string.
$uri = object_to_uri( $object );

// Enrich content with callbacks.
$content = enrich_content_data( $content, $pattern, $callback );

// Resolve WebFinger handle to actor URL.
$resource = Webfinger::resolve( $handle );

// Check whether a post is disabled for ActivityPub (the federation pipeline gate).
$disabled = is_post_disabled( $post );

Real Codebase Examples

Core Classes:

  • includes/class-activitypub.php - Main plugin initialization.
  • includes/class-dispatcher.php - Activity dispatching to followers.
  • includes/class-scheduler.php - WP-Cron integration for async tasks.
  • includes/class-signature.php - HTTP Signatures for federation.

Activity Types:

  • includes/activity/class-activity.php - Activity class (Create, Follow, Undo, etc. are built from this).
  • includes/activity/class-base-object.php - Base object class.
  • includes/activity/extended-object/ - Extended object types (e.g. Event).

Integrations (see Integration Patterns):

  • integration/class-buddypress.php - BuddyPress integration.
  • integration/class-jetpack.php - Jetpack integration.
  • integration/class-opengraph.php - OpenGraph integration.

Common Initialization Patterns

Static Initialization
php
class Feature {
    /**
     * Initialize the class.
     */
    public static function init() {
        \add_action( 'init', array( self::class, 'register' ) );
        \add_filter( 'activitypub_the_content', array( self::class, 'filter' ) );
    }
}
Singleton Pattern
php
class Manager {
    private static $instance = null;

    public static function get_instance() {
        if ( null === self::$instance ) {
            self::$instance = new self();
        }
        return self::$instance;
    }

    private function __construct() {
        $this->init();
    }
}

Custom Hook Patterns

Actions:

php
\do_action( 'activitypub_handled_create', $activity, $user_ids, $success, $result );
\do_action( 'activitypub_followers_pre_remove_follower', $follower, $user_id, $actor );

Filters:

php
$array   = \apply_filters( 'activitypub_activity_object_array', $array, $class, $id, $object );
$content = \apply_filters( 'activitypub_the_content', $content, $post );
$types   = \apply_filters( 'activitypub_actor_types', $types );

Version Numbers

Always use 'unreleased' for version strings in new code. The release script automatically replaces these with the actual version number during the release process.

PHPDoc tags:

php
/**
 * New function description.
 *
 * @since unreleased
 */
function new_feature() {}

/**
 * Old function.
 *
 * @deprecated unreleased Use new_feature() instead.
 */
function old_feature() {}

Deprecation functions:

php
\_deprecated_function( __METHOD__, 'unreleased', 'New_Class::new_method' );
\_deprecated_argument( __METHOD__, 'unreleased', \esc_html__( 'Message', 'activitypub' ) );
\_doing_it_wrong( __METHOD__, \esc_html__( 'Message', 'activitypub' ), 'unreleased' );

Never hardcode version numbers like '5.1.0' — always use 'unreleased'.

© Automattic, 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/code-style of Automattic/wordpress-activitypub.

Open the folder on GitHubat commit 72d53bc

Compare with similar skills

Code Style 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.

Code Style compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Code Style this skillAutomattic/wordpress-activitypub582—~2.2kAutomated safety check: PassMIT
WooCommerce Code Reviewwoocommerce/woocommerce11k3 repos~1.1kAutomated safety check: PassCustom licence
WooCommerce Backend Conventionswoocommerce/woocommerce11k1 repos~614Automated safety check: PassCustom licence
Skill Doli Code ReviewDolibarr/dolibarr7.7k1 repos~1.1kAutomated safety check: PassMIT
Wp Interactivity APIAutomattic/agent-skills2113 repos~1.5kAutomated safety check: PassNone
WooCommerce Dev Cyclewoocommerce/woocommerce11k3 repos~431Automated safety check: PassCustom licence

Similar skills

  • 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
  • WooCommerce Backend Conventions

    woocommerce/woocommerce

    Guides agents writing or changing WooCommerce backend PHP so new classes, hooks and unit tests follow the project's conventions.

    11k GitHub starsUsed in 1 repo~614 tokens
    DevelopmentAuto-check passed
  • Skill Doli Code Review

    Dolibarr/dolibarr

    Reviews Dolibarr PHP code for compliance with coding standards and security best practices, and fixes identified issues.

    7.7k GitHub starsUsed in 1 repo~1.1k tokens
    DevelopmentAuto-check passed
  • Wp Interactivity API

    Automattic/agent-skills

    A skill your agent uses when building or debugging WordPress Interactivity API features (data-wp- directives, @wordpress/interactivity store/state/actions, block viewScriptModule integration…

    211 GitHub starsUsed in 3 repos~1.5k tokens
    DevelopmentAuto-check passed
  • WooCommerce Dev Cycle

    woocommerce/woocommerce

    Workflow for WooCommerce development: run PHP and JavaScript tests, lint and fix code style on the current branch, and follow guides for i18n and markdown.

    11k GitHub starsUsed in 3 repos~431 tokens
    DevelopmentAuto-check passed
  • Wp Playground

    Automattic/agent-skills

    A skill your agent uses for WordPress Playground workflows: fast disposable WP instances in the browser or locally via @wp-playground/cli (server, run-blueprint, build-snapshot), auto-mounting…

    211 GitHub starsUsed in 2 repos~1.2k tokens
    DevelopmentAuto-check passed

More from Automattic/wordpress-activitypub

  • Dev

    Automattic/wordpress-activitypub

    Development workflows for WordPress ActivityPub plugin including wp-env setup, testing commands, linting, and build processes.

    582 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Federation

    Automattic/wordpress-activitypub

    ActivityPub protocol specification and federation concepts. An agent skill from Automattic/wordpress-activitypub.

    582 GitHub stars~2.5k tokensUpdated today
    Auto-check passed
  • Gitattributes

    Automattic/wordpress-activitypub

    A skill your agent uses when auditing or updating .gitattributes export-ignore coverage so dev-only files (lint configs, CI, tests, docs, build tooling) don't ship in the WordPress.org plugin zip.

    582 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Integrations

    Automattic/wordpress-activitypub

    Third-party WordPress plugin integration patterns. An agent skill from Automattic/wordpress-activitypub.

    582 GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Release

    Automattic/wordpress-activitypub

    Version management and release processes using Jetpack Changelogger.

    582 GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • PR

    Automattic/wordpress-activitypub

    INVOKE THIS SKILL before creating any PR to ensure compliance with branch naming, changelog requirements, and reviewer assignment.

    582 GitHub stars~927 tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Code Style

What does Code Style do?

PHP coding standards and WordPress patterns for ActivityPub plugin. Code Style is an agent skill from Automattic/wordpress-activitypub. PHP coding standards and WordPress patterns for ActivityPub plugin.

When should I use Code Style?

Code Style fits situations like: writing PHP code; creating classes; implementing WordPress hooks; structuring plugin files.

How do I install Code Style in Claude Code?

Run `npx skills add Automattic/wordpress-activitypub --skill code-style -a claude-code`. Or copy the skill folder (.agents/skills/code-style in Automattic/wordpress-activitypub) into .claude/skills/code-style in your project. Claude Code loads it when a task matches its description.

How do I install Code Style in Codex?

Run `npx skills add Automattic/wordpress-activitypub --skill code-style -a codex`. Or copy the skill folder (.agents/skills/code-style in Automattic/wordpress-activitypub) into .agents/skills/code-style in your project. Codex loads it when a task matches its description.

Can I use Code Style 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 Automattic/wordpress-activitypub --skill code-style -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/code-style, .gemini/skills/code-style, .github/skills/code-style and .opencode/skills/code-style in your project.

What does Code Style need to run?

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

Does Code Style 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 Code Style 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 Code Style use?

Code Style 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 Code Style 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 Code Style?

Skills that share tags, products or a category with Code Style: WooCommerce Code Review (woocommerce/woocommerce, 11k stars), WooCommerce Backend Conventions (woocommerce/woocommerce, 11k stars), Skill Doli Code Review (Dolibarr/dolibarr, 7.7k stars) and Wp Interactivity API (Automattic/agent-skills, 211 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Code Style?

Automattic (a GitHub organization) maintains it in Automattic/wordpress-activitypub, which has 582 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 7, 2026.

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