From wpcs-standards
Use when writing, reviewing, or fixing WordPress PHP, JavaScript, CSS, or HTML to follow the official WordPress Coding Standards (WPCS): naming conventions, spacing and formatting, Yoda conditions, brace style, security (escaping, sanitization, nonces, $wpdb->prepare), internationalization (i18n), and PHPDoc/JSDoc inline documentation. Also use before submitting a plugin or theme to the WordPress.org directory, or when configuring phpcs with the WordPress ruleset.
How this skill is triggered — by the user, by Claude, or both
Slash command
/wpcs-standards:wpcs-standardsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Apply the official WordPress Coding Standards when producing or reviewing WordPress PHP,
Apply the official WordPress Coding Standards when producing or reviewing WordPress PHP,
JavaScript, CSS, or HTML. Match existing conventions in the project first; where a project has
no local override, follow the standards below. These are the same rules the WordPress phpcs
ruleset enforces.
This skill is self-contained: the rules and examples here and in references/ are enough to
write and review compliant code. Do not web-fetch the WordPress handbook pages linked at the
bottom unless the user explicitly asks for the current upstream wording — the links are for
attribution and human reference only.
phpcs with the WordPress standard.references/.phpcs (see Verify below) instead of eyeballing.Full detail and examples are in references/php-coding-standards.md. The rules that matter most:
lower_snake_case; class names are
Capitalized_Words_With_Underscores; constants are UPPER_SNAKE_CASE. Class files are named
class-{name}.php.if ( true === $ready ) { and do_thing( $a, $b ). Space
after every comma and around operators.if ( 'publish' === $status ), not
if ( $status === 'publish' ).array( ... ) for the core standard, with a trailing comma on the
last item of a multi-line array.?> in pure-PHP files.Detail in references/php-coding-standards.md.
esc_html(), esc_attr(),
esc_url(), esc_textarea(), wp_kses_post(), and the esc_*__() i18n variants.wp_unslash() then sanitize_text_field(), absint(),
sanitize_email(), sanitize_key(), etc. Never trust $_GET, $_POST, $_REQUEST,
$_SERVER.current_user_can() and verify a nonce with
check_admin_referer() / wp_verify_nonce().$wpdb->prepare(); never interpolate
input into a query string.__(), esc_html__(), _e(), esc_html_e(), _n(), _x().printf/sprintf with placeholders for interpolated strings, and add
/* translators: ... */ comments to explain placeholders.See references/markup-css-js.md. Highlights: JS follows a WordPress-flavored jQuery/ESLint
style (tabs, spaces inside parens, ===, single quotes); CSS uses tabs, one selector per line,
lowercase hex, and ordered properties; HTML must be valid and, for anything user-facing, meet
the accessibility guidance (semantic elements, labels, and WCAG 2.0 AA per the handbook).
See references/inline-documentation.md. Document files, classes, functions/methods, hooks,
and constants with properly formatted DocBlocks: a summary, @since, typed @param and
@return for PHP (PHPDoc) and JS (JSDoc), and @param entries that match the signature exactly.
When a runnable environment is available, check with PHP_CodeSniffer instead of relying on inspection:
composer global require squizlabs/php_codesniffer wp-coding-standards/wpcs \
dealerdirect/phpcodesniffer-composer-installer
phpcs --standard=WordPress path/to/code
phpcbf --standard=WordPress path/to/code # auto-fix what can be fixed
WordPress-Core covers formatting and naming, WordPress-Extra adds best-practice and
security-adjacent sniffs, and WordPress-Docs checks inline documentation.
Derived from the WordPress Coding Standards Handbook (https://developer.wordpress.org/coding-standards/) and WordPress/wpcs-docs, licensed GPL-2.0-or-later. These links are provided for provenance and human reference, not as a prompt to fetch.
npx claudepluginhub dennis-n-dean/wp-agent-skills-marketplace --plugin wpcs-standardsGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Enforces test-driven development: write failing test first, then minimal code to pass. Use when implementing features or bugfixes.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.