Agent skill
wp-activation
Handle WordPress plugin activation and deactivation hooks.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/wp-activation
SKILL.md
WP Activation Handler
Instructions
When implementing activation/deactivation logic:
- Activation hook:
register_activation_hook(__FILE__, $callback) - Deactivation hook:
register_deactivation_hook(__FILE__, $callback) - Set default options on activation
- Flush rewrite rules if needed
- Clean up on deactivation
Activation Pattern
register_activation_hook(retrologin_plugin_file(), 'retrologin_activate');
function retrologin_activate(): void {
// Set default options
$defaults = [
'color' => '#ff6b9d',
'font' => 'Press Start 2P',
'enabled' => true,
];
if (! get_option('retrologin_settings')) {
add_option('retrologin_settings', $defaults);
}
// Flush rewrite rules if needed
flush_rewrite_rules();
}
Deactivation Pattern
register_deactivation_hook(retrologin_plugin_file(), 'retrologin_deactivate');
function retrologin_deactivate(): void {
// Clear scheduled events
wp_clear_scheduled_hook('retrologin_daily_task');
// Optionally: Remove options
// delete_option('retrologin_settings');
}
Uninstaller Pattern
// In uninstall.php
if (! defined('WP_UNINSTALL_PLUGIN')) {
exit;
}
// Clean up all plugin data
delete_option('retrologin_settings');
delete_transient('retrologin_cache');
// Clean up user meta if any
delete_metadata('user', '', '_retrologin_preferences', '', true);
Guidelines
- Keep callbacks in
inc/directory - Don't output anything in activation
- Handle multi-site activation if needed
- Test activation on fresh install
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?