skills/code-standards-checker/SKILL.md
Automatically check code against PHPCS, ESLint, WordPress Coding Standards, or Drupal Coding Standards when user asks about code style, standards compliance, or best practices. Invoke when user mentions "coding standards", "code style", "linting", "PHPCS", "ESLint", or asks if code follows conventions.
npx skillsauth add kanopi/cms-cultivator code-standards-checkerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Automatically check code against coding standards and style guides.
Consistent code style makes collaboration seamless and reduces cognitive load.
Activate this skill when the user:
Before running standards checks, consider:
Automatic detection:
User-specified:
--fix commandsUser asks about standards
↓
Detect platform (Drupal/WordPress/Generic)
↓
Determine scope (file/changes/project)
↓
Check for existing config (.phpcs.xml, .eslintrc)
↓
Run appropriate tool
↓
Report violations
↓
Auto-fix? → Provide --fix commands if requested
Check for indicators:
Drupal:
# Check for Drupal
test -f web/core/lib/Drupal.php && echo "Drupal project"
test -f docroot/core/lib/Drupal.php && echo "Drupal project"
WordPress:
# Check for WordPress
test -f wp-config.php && echo "WordPress project"
test -f web/wp-config.php && echo "WordPress project"
JavaScript/Frontend:
# Check for Node project
test -f package.json && echo "Node project"
For projects with Kanopi DDEV add-ons:
Drupal/WordPress:
# Run all code quality checks
ddev composer code-check
# Individual checks
ddev composer phpstan # Static analysis
ddev composer phpcs # Coding standards
ddev composer rector-check # Modernization check
Themes with Node:
# ESLint for JavaScript
ddev theme-npm run lint
# or
ddev exec npm run lint
Check if PHPCS is available:
test -f vendor/bin/phpcs && echo "PHPCS found"
Run PHPCS:
# Drupal
vendor/bin/phpcs --standard=Drupal,DrupalPractice web/modules/custom
# WordPress
vendor/bin/phpcs --standard=WordPress wp-content/themes/custom-theme
vendor/bin/phpcs --standard=WordPress wp-content/plugins/custom-plugin
Common Issues to Report:
Check if ESLint is available:
test -f node_modules/.bin/eslint && echo "ESLint found"
Run ESLint:
npx eslint src/**/*.js
npx eslint themes/custom/js/**/*.js
Common Issues to Report:
If user shows code without running tools:
PHP Analysis Checklist:
JavaScript Analysis Checklist:
var (use const or let)Format:
## Code Standards Check Results
**Project Type**: Drupal 10
**Standard**: Drupal Coding Standards + DrupalPractice
### Summary
- ✅ 45 files checked
- ⚠️ 12 warnings
- ❌ 3 errors
### Errors (Must Fix)
1. **Missing type hint** - `src/Controller/MyController.php:23`
```php
public function process($data) { // Missing type hint
Fix: Add type hint public function process(array $data): void {
src/Service/UserService.php:45
db_query("SELECT * FROM users WHERE id = " . $id);
Fix: Use placeholders db_query("SELECT * FROM users WHERE id = :id", [':id' => $id]);src/Form/MyForm.php:67
Run this to auto-fix formatting issues:
ddev composer code-fix
# or manually
vendor/bin/phpcbf --standard=Drupal web/modules/custom
## Integration with CMS Cultivator
This skill complements the `/quality-standards` slash command:
- **This Skill**: Automatically triggered during conversation
- "Is this code up to standards?"
- "Does this follow Drupal conventions?"
- Quick checks on code snippets
- **`/quality-standards` Command**: Explicit full project scan
- Comprehensive standards check
- CI/CD integration
- Full project analysis
## Platform-Specific Standards
### Drupal Coding Standards
**Key Conventions**:
- 2-space indentation
- Opening brace on same line
- Type hints required (PHP 7.4+)
- Drupal-specific naming (snake_case for functions, PascalCase for classes)
- Services over procedural code
- Dependency injection preferred
**Example Good Code**:
```php
<?php
namespace Drupal\mymodule\Controller;
use Drupal\Core\Controller\ControllerBase;
/**
* Provides route responses for the My Module module.
*/
class MyModuleController extends ControllerBase {
/**
* Returns a render array for the page.
*
* @return array
* A render array.
*/
public function content(): array {
return [
'#markup' => $this->t('Hello World'),
];
}
}
Key Conventions:
if ( true === $condition ))Example Good Code:
<?php
/**
* Display user dashboard widget.
*
* @param int $user_id User ID.
* @return void
*/
function my_theme_display_dashboard( $user_id ) {
if ( ! is_user_logged_in() ) {
return;
}
$user_data = get_userdata( $user_id );
if ( ! $user_data ) {
return;
}
echo '<div class="dashboard">';
echo '<h2>' . esc_html( $user_data->display_name ) . '</h2>';
echo '</div>';
}
Modern JavaScript Best Practices:
// Good: const/let, arrow functions, template literals
const getUserName = (user) => {
return `${user.firstName} ${user.lastName}`;
};
// Bad: var, function keyword, concatenation
var getUserName = function(user) {
return user.firstName + ' ' + user.lastName;
};
SQL Injection
XSS Vulnerabilities
Missing Access Checks
Example 1: Quick snippet check
User: "Is this WordPress code following standards?"
[Shows code with tabs and proper escaping]
Skill: "Let me check that against WordPress Coding Standards...
✅ Proper tab indentation
✅ Output properly escaped with esc_html()
✅ Correct brace placement
⚠️ Missing docblock - should document the function
Overall: Good! Just add a docblock."
Example 2: Project-wide check
User: "Does my custom module follow Drupal standards?"
Skill: "I'll run PHPCS on your custom module...
[Runs ddev composer phpcs or vendor/bin/phpcs]
Found 3 errors and 12 warnings across 8 files.
Most common issues:
- Missing type hints (5 occurrences)
- Lines too long (7 occurrences)
Would you like me to show the specific issues or run the auto-fixer?"
tools
Strategist-focused site audit for discovery and pre-discovery. Given a site URL and optional qualitative research data, navigates the site via CoWork, audits against all 21 UX Laws from lawsofux.com, reviews content hierarchy, synthesises qualitative data, runs Lighthouse, and produces two deliverables — a Project Knowledge Summary (Markdown for Claude Desktop Projects) and a polished, iterable HTML Artifact for client sharing. Use when a strategist, UX lead, or PM asks for a discovery audit, UX laws audit, content hierarchy review, pre-discovery site review, "audit this site for strategy", "strategist audit", "UX audit", or pastes a site URL with discovery context. Not for developer audits — use accessibility-audit, performance-audit, or live-site-audit for those.
development
Provide story point estimation guidance with hour calculations for software development tasks. Uses Fibonacci sequence (1, 2, 3, 5, 8, 13, 21, 34+) and converts story points to hours. Includes platform-specific adjustments and velocity calculations.
tools
Perform a full QA review of a Teamwork task by reading the task and all its comments for context, extracting the multi-dev URL, generating dynamic validation steps tailored to the task type, and using CoWork browser automation to execute those steps on the multi-dev environment. Produces a structured validation report with pass/fail per step, screenshots, internal notes, and a client-facing summary — all shown in chat. Use this skill whenever the user asks to QA, test, validate, or review a Teamwork task or multi-dev environment — even if they just say "can you QA this?" or paste a Teamwork link. Also triggers for phrases like "run QA on", "check the multi-dev", "validate this task", "test the dev link", or "review the ticket". Works across Drupal/CMS updates, WordPress/plugin updates, bug fixes, new feature development, and general web development tasks.
tools
Generate a client-facing project heartbeat / status update message for a Kanopi project, ready to be posted as a Teamwork message. Use this skill whenever the user asks to write, draft, generate, or send a project update, heartbeat, status update, or progress report to a client. Also triggers when the user says things like "time for a project update", "draft the heartbeat", "write up the update for [project]", or "it's been two weeks, let's send an update". Always use this skill — even if the user doesn't say "heartbeat" — whenever the intent is to summarise recent project activity for a client audience.