alanef/plugin-fullworks-support-diagnostics-project
Overview
This skill codifies professional WordPress plugin development best practices using a namespaced, Composer-based project layout, wp-env testing, WPCS compliance, and a clear plugin architecture. It documents the root-level dev tool setup and the nested plugin directory pattern so teams can develop, test, and build production-ready plugins. Use it to ensure consistent code style, security practices, and maintainable architecture across plugin projects.
How this skill works
The skill inspects and enforces a specific project structure: dev tools (phpcs, phpunit, phpstan) live at the root while the distributable plugin lives in a subdirectory with its own composer.json and namespaced src/ classes. It describes the canonical main plugin file, class initialization, hook usage, i18n, REST endpoints, database and options handling, and secure input/output patterns. It also prescribes running automated checks (WPCS, PHPStan, PHPUnit) and using wp-env for integration testing and build scripts for packaging.
When to use it
- Starting a new WordPress plugin project that needs a reproducible developer workflow
- Standardizing plugin architecture across a team or organization
- Implementing automated testing and static analysis for a plugin
- Preparing a plugin for production release with a reproducible build
- Auditing or refactoring an existing plugin to meet security and coding standards
Best practices
- Keep development tools at project root and plugin code in a nested directory with its own composer.json
- Use PSR-4 namespaced classes in src/, single class per file matching filename
- Follow WPCS style: tabs for indent, PHPDoc everywhere, Yoda conditions, and prefixed functions/hooks
- Sanitize all input and escape all output; verify nonces and check capabilities before privileged actions
- Use $wpdb->prepare() for queries, transients/object cache for performance, and lazy loading where appropriate
- Run phpcs/phpstan/phpunit via composer scripts and test in wp-env across supported PHP versions
Example use cases
- Scaffold a new plugin with namespaced Core, Admin, REST components and Composer autoloading
- Add integration tests that run inside wp-env to validate REST endpoints and admin pages
- Refactor a legacy plugin to use modern hooks, capability checks, prepared SQL, and WPCS compliance
- Create a CI pipeline that runs composer check, phpstan, and composer test before merging
- Build a production zip via composer build that installs only production dependencies
FAQ
Use @wordpress/env: start wp-env, set WP_PHPUNIT__TESTS_CONFIG to the test config, then run composer test or wp-env run tests-cli to execute PHPUnit integration tests.
Where should composer autoloaders live?
Keep dev tool composer.json at the project root and a separate composer.json inside the plugin subdirectory for distribution. Both can provide autoloaders: root for tests/tools, plugin for runtime classes.