wp-hooks
Skill1 starsChanged 7 months agoMITView on GitHub
This skill should be used when the user asks to "document hooks", "generate a hooks reference", "list hooks", "show custom hooks", "generate hook docs", or mentions "hook documentation", "what hooks exist", "do_action", "apply_filters". Scans PHP source for do_action() and apply_filters() calls and produces detailed documentation with parameters, examples, and usage context.
In this repository13 other files it gives its agents.
- gutenberg-layoutSkill
- php-cleanupSkill
- verificationSkill
- woocommerceSkill
- wordpress-databaseSkill
- wordpress-engineerSkill
- wordpress-i18nSkill
- wordpress-patternsSkill
- wordpress-performanceSkill
- wordpress-securitySkill
- wordpress-standardsSkill
- wp-debuggingSkill
- wp-testingSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Run the hook scanner to get a fresh inventory:
- Very specific: line 29
If scan-hooks.sh is not available at that path, check the plugin's scripts directory:
- Distinctive: line 34
If neither is available, scan manually:
- Very specific: line 35
Search all .php files (excluding vendor/, node_modules/, wp-admin/, wp-includes/) for do_action( and apply_filters( calls
- Very specific: line 40
Read docs/hooks-reference.md if it exists.
- Distinctive: line 57
Use realistic parameter names matching the hook's arguments
- Very specific: line 65
Write docs/hooks-reference.md with this structure:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
WordPress Hook Documentation Skill
You are documenting custom WordPress hooks for this project. This is the deep pass — thorough documentation with parameters, examples, and context, beyond what the auto-scanner produces.
Workflow
Step 1: Run the Scanner
Run the hook scanner to get a fresh inventory:
SCAN_HOOKS_VERBOSE=1 bash "$CLAUDE_PROJECT_DIR/.claude/hooks/scan-hooks.sh" "$CLAUDE_PROJECT_DIR"If scan-hooks.sh is not available at that path, check the plugin's scripts directory:
SCAN_HOOKS_VERBOSE=1 bash "${CLAUDE_PLUGIN_ROOT}/scripts/scan-hooks.sh" "$CLAUDE_PROJECT_DIR"If neither is available, scan manually:
- Search all
.phpfiles (excludingvendor/,node_modules/,wp-admin/,wp-includes/) fordo_action(andapply_filters(calls - Skip WordPress core hooks (prefixed
wp_,admin_,the_, etc.)
Step 2: Read Existing Reference
Read docs/hooks-reference.md if it exists. Note any manually-written descriptions — these must be preserved.
Step 3: Deep Analysis
For each custom hook found, read the surrounding code to determine:
- Parameters — names, types, and purpose. Check:
- PHPDoc
@paramtags on the enclosing function - Variable types from usage context
- WordPress conventions (e.g.,
$post_idis alwaysint)
- PHPDoc
- Purpose — what the hook enables. Read:
- The enclosing function's PHPDoc
@sinceand description - What happens before/after the hook fires
- Whether it's a lifecycle event, data modification point, or extension point
- The enclosing function's PHPDoc
- Example usage — write a working
add_action()oradd_filter()snippet:- Use realistic parameter names matching the hook's arguments
- Include proper callback signature with type hints
- Show a practical use case, not just a skeleton
- Version — extract
@sinceif available from the enclosing docblock
Step 4: Generate Documentation
Write docs/hooks-reference.md with this structure:
# Custom Hooks Reference
<!-- Auto-generated by wp-hooks skill — manual edits are preserved -->
<!-- Last documented: YYYY-MM-DD HH:MM:SS -->
## Overview
Brief description of the hook architecture in this plugin/theme.
## Actions
### `prefix_hook_name`
**Type:** Action
**Since:** 1.0.0
**File:** `path/to/file.php:42` (function `function_name`)
Description of what this action does and when it fires.
**Parameters:**
| Parameter | Type | Description |
|-----------|------|-------------|
| `$arg1` | `string` | Description of arg1 |
| `$arg2` | `int` | Description of arg2 |
**Example:**
\```php
add_action( 'prefix_hook_name', function( string $arg1, int $arg2 ): void {
// Your code here
}, 10, 2 );
\```
---
## Filters
### `prefix_filter_name`
**Type:** Filter
**Since:** 1.0.0
**File:** `path/to/file.php:87` (function `function_name`)
Description of what this filter modifies.
**Parameters:**
| Parameter | Type | Description |
|-----------|------|-------------|
| `$value` | `array` | The value being filtered |
| `$context` | `string` | Additional context |
**Default:** Description of the unfiltered default value.
**Example:**
\```php
add_filter( 'prefix_filter_name', function( array $value, string $context ): array {
// Modify and return $value
return $value;
}, 10, 2 );
\```Rules
- Preserve manual edits — if a description already exists and was written by a human (not
<!-- TODO: describe -->), keep it - Filters must document the return — always describe what the unfiltered default value is and what the filter is expected to return
- Actions should describe timing — when in the lifecycle does this fire?
- Group logically — if hooks belong to a subsystem (e.g., "checkout", "import"), add subheadings
- Skip core hooks — only document project-specific hooks, not
wp_enqueue_scriptsorinit - Flag dynamic hooks — if a hook name is built from variables (e.g.,
"prefix_{$type}_loaded"), document the pattern and possible values - Include the hook count — end with a summary line: "N custom hooks (X actions, Y filters)"
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

