Guide to migrate existing WordPress development workflow to OpenCode WordPress.
OpenCode WordPress provides structured skills, agents, commands, and hooks for WordPress development. This guide helps migrate from:
- Manual WordPress development
- Other AI-assisted tools
- Existing OpenCode configurations
- Traditional WordPress workflows
Migrate from manual coding to OpenCode WordPress.
- No structured guidance
- Inconsistent patterns
- Manual code review
- No automated validation
- Ad-hoc security checks
- Structured skills guidance
- Consistent patterns from skills
- Automated agent review
- Hook validation on commit
- Security enforcement via rules
- Install OpenCode WordPress
git clone https://github.com/promoweb/opencode-wordpress.git
cd opencode-wordpress
./install.sh- Open Existing Project
cd your-wordpress-project
opencode- Review Current Code
# Full review
/wp-review
# Theme review
opencode agent theme-reviewer
# Plugin review
opencode agent plugin-reviewer- Apply Fixes
# Auto-fix issues
/wp-build-fix --auto
# Manual fix with guidance
opencode skill wordpress-security
# Follow skill recommendations- Enforce Standards
# Commit with validation
git commit -m "Apply OpenCode WordPress standards"
# Hooks will validateMigrate from other AI-assisted development tools.
| Feature | Other AI Tools | OpenCode WordPress |
|---|---|---|
| Guidance | Generic advice | Specialized WordPress skills |
| Review | Manual prompts | Automated agents |
| Validation | None | Pre-commit hooks |
| Standards | Generic coding | WordPress-specific rules |
| Examples | Limited | Complete examples |
-
Install OpenCode WordPress (same as above)
-
Replace Generic Patterns with WordPress Patterns
# Invoke WordPress skill
opencode skill wordpress-plugin-development
# Use WordPress-specific guidance instead of generic advice- Use WordPress-Specific Agents
# Instead of generic review
opencode agent wordpress-reviewer
# Theme-specific
opencode agent theme-reviewer
# Plugin-specific
opencode agent plugin-reviewer- Enable WordPress Hooks
# Hooks enforce WordPress standards
npm install ~/.config/opencode/hooks- Follow WordPress Rules
Rules automatically enforce WordPress coding standards, security, and patterns.
Migrate existing OpenCode configuration to include WordPress components.
# Backup current configuration
cp -r ~/.config/opencode ~/.config/opencode.backupOption A: Full merge (WordPress + existing)
# Install WordPress components
cd opencode-wordpress
./install.sh --mergeOption B: Partial merge (selective)
# Copy specific components
cp -r skills/* ~/.config/opencode/skills/
cp -r agents/* ~/.config/opencode/agents/
cp -r rules/wordpress ~/.config/opencode/rules/
# Keep existing commands/hooks or merge// ~/.config/opencode/.opencode/opencode.json
{
"existingConfig": "...",
"skillsDir": "~/.config/opencode/skills",
"agentsDir": "~/.config/opencode/agents",
"rulesDir": "~/.config/opencode/rules",
"commandsDir": "~/.config/opencode/.opencode/commands",
"hooksDir": "~/.config/opencode/hooks",
"wordpress": {
"enabled": true
}
}# Test skills load
opencode skills list
# Test WordPress skill
opencode skill wordpress-theme-development
# Test agent
opencode agent wordpress-reviewerMigrate entire team to OpenCode WordPress.
- Create Team Repository
# Clone OpenCode WordPress
git clone https://github.com/promoweb/opencode-wordpress.git
# Add to team's tooling repository
cd team-tools
git submodule add https://github.com/promoweb/opencode-wordpress.git- Create Team Installation Script
# team-install.sh
#!/bin/bash
# Team-specific installation
cd opencode-wordpress
./install.sh --team-config=/path/to/team/config.json- Document Team Workflow
# Team WordPress Development Workflow
1. All members install OpenCode WordPress
2. Use approved skills for development
3. Mandatory agent review before commit
4. Hooks validate all commits
5. Follow team rules configuration- Train Team Members
- Workshop on OpenCode WordPress usage
- Skill invocation practices
- Agent interpretation
- Hook understanding
- Rules compliance
{
"team": {
"name": "Development Team",
"standards": "WordPress",
"strictness": "high"
},
"wordpress": {
"version": "6.0",
"phpVersion": "8.0",
"codingStandards": "WordPress-Strict",
"securityLevel": "strict",
"enableTesting": true,
"minTestCoverage": 80
},
"hooks": {
"php-lint": true,
"wp-debug-check": true,
"security-check": true,
"preventBypass": true
}
}- Configure hooks to prevent bypassing
- Mandatory agent review in CI/CD
- Team rules in centralized config
- Regular skill updates via submodule
If you have generic skills, replace with WordPress-specific:
# Remove generic skill
rm ~/.config/opencode/skills/generic-web-development
# Add WordPress skill
cp skills/wordpress-theme-development ~/.config/opencode/skills/WordPress skills should have higher priority:
{
"skillPriority": [
"wordpress-theme-development",
"wordpress-plugin-development",
"woocommerce-patterns",
"wordpress-security",
"wordpress-rest-api",
"wordpress-testing",
"wordpress-hooks-filters",
"wordpress-database"
]
}# Remove generic reviewer
rm ~/.config/opencode/agents/general-reviewer
# Add WordPress reviewers
cp agents/wordpress-reviewer.md ~/.config/opencode/agents/
cp agents/theme-reviewer.md ~/.config/opencode/agents/
cp agents/plugin-reviewer.md ~/.config/opencode/agents/WordPress agents should activate for WordPress code:
{
"agentActivation": {
"wordpress-reviewer": {
"triggers": ["*.php", "wp-content/**/*"],
"priority": 10
},
"theme-reviewer": {
"triggers": ["wp-content/themes/**/*"],
"priority": 11
},
"plugin-reviewer": {
"triggers": ["wp-content/plugins/**/*"],
"priority": 11
}
}
}# Keep common rules
# Add WordPress rules
mkdir -p ~/.config/opencode/rules/wordpress
cp rules/wordpress/* ~/.config/opencode/rules/wordpress/WordPress rules apply after common rules:
{
"rulePriority": [
"common/git-workflow",
"common/code-style",
"common/documentation",
"common/security",
"wordpress/coding-style",
"wordpress/hooks",
"wordpress/patterns",
"wordpress/security",
"wordpress/testing",
"wordpress/database"
]
}# Add WordPress commands to existing
cp .opencode/commands/wp-*.md ~/.config/opencode/.opencode/commands/
cp .opencode/commands/wc-*.md ~/.config/opencode/.opencode/commands/Create aliases for WordPress commands:
# Add to .bashrc/.zshrc
alias wp-theme='/wp-theme'
alias wp-plugin='/wp-plugin'
alias wp-review='/wp-review'
alias wp-build='/wp-build-fix'
alias wc='/wc-build'# Add WordPress hooks
mkdir -p ~/.config/opencode/hooks
cp hooks/php-lint.js ~/.config/opencode/hooks/
cp hooks/wp-debug-check.js ~/.config/opencode/hooks/
cp hooks/security-check.js ~/.config/opencode/hooks/
# Install dependencies
cd ~/.config/opencode/hooks
npm installWordPress hooks run before generic hooks:
{
"hookPriority": [
"php-lint.js",
"wp-debug-check.js",
"security-check.js",
"other-hooks..."
]
}// Inconsistent enqueue
wp_enqueue_style('style', get_stylesheet_uri());
wp_enqueue_script('script', get_template_directory_uri() . '/js/script.js');// Follow skill guidance
function my_theme_scripts() {
wp_enqueue_style(
'my-theme-style',
get_template_directory_uri() . '/assets/css/style.css',
array(),
MY_THEME_VERSION
);
wp_enqueue_script(
'my-theme-script',
get_template_directory_uri() . '/assets/js/main.js',
array('jquery'),
MY_THEME_VERSION,
true
);
}
add_action('wp_enqueue_scripts', 'my_theme_scripts');Migration steps:
- Invoke skill:
opencode skill wordpress-theme-development - Review enqueue patterns in skill
- Update theme functions.php
- Run validation:
/wp-theme validate
// Missing security
function my_plugin_save_data() {
global $wpdb;
$wpdb->insert('my_table', array(
'data' => $_POST['data']
));
}// Security enforced by rules
function my_plugin_save_data() {
// Verify nonce
if (!isset($_POST['my_plugin_nonce']) ||
!wp_verify_nonce($_POST['my_plugin_nonce'], 'my_plugin_action')) {
wp_die('Security check failed');
}
// Check capabilities
if (!current_user_can('manage_options')) {
wp_die('Unauthorized');
}
// Sanitize input
$data = sanitize_text_field($_POST['data']);
// Prepared query
global $wpdb;
$wpdb->insert(
'my_table',
array('data' => $data),
array('%s')
);
}Migration steps:
- Invoke skill:
opencode skill wordpress-plugin-development - Invoke security skill:
opencode skill wordpress-security - Review security patterns
- Update plugin code
- Run security check:
node security-check.js plugin-file.php
// Direct WooCommerce manipulation
add_action('woocommerce_before_calculate_totals', function($cart) {
foreach ($cart->get_cart() as $item) {
$item['data']->set_price(10);
}
});// Proper WooCommerce integration
add_action('woocommerce_before_calculate_totals', 'my_wc_custom_price');
function my_wc_custom_price($cart) {
if (is_admin() && !defined('DOING_AJAX')) {
return;
}
foreach ($cart->get_cart() as $cart_item_key => $cart_item) {
$product = $cart_item['data'];
// Check product type
if ($product->get_type() === 'my_custom_type') {
// Get custom price from meta
$custom_price = get_post_meta(
$product->get_id(),
'_custom_price',
true
);
if ($custom_price) {
$product->set_price($custom_price);
}
}
}
}Migration steps:
- Invoke skill:
opencode skill woocommerce-patterns - Review WooCommerce hook patterns
- Update WooCommerce integration
- Run validation:
/wc-build validate
After migration, validate all components work:
# Test skills
opencode skills list --all
# Test agents
opencode agents list --all
# Test commands
opencode commands list --all
# Test hooks
cd ~/.config/opencode/hooks
npm test
# Test rules
opencode rules validate# Full review
/wp-review --all
# Theme review
opencode agent theme-reviewer
# Plugin review
opencode agent plugin-reviewer
# WooCommerce review
/wc-build review# Auto-fix
/wp-build-fix --auto
# Manual fix with skill
opencode skill wordpress-security
# Follow guidance# Check SKILL.md files
find ~/.config/opencode/skills -name "SKILL.md"
# Check skill directory in config
opencode config get skillsDir
# Restart OpenCode
opencode restart# Check agent triggers
opencode config get agentActivation
# Invoke explicitly
opencode agent wordpress-reviewer
# Check WordPress file detection
opencode detect wordpress# Check rule priority
opencode config get rulePriority
# Disable conflicting rule
opencode rules disable generic-security
# Enable WordPress rule
opencode rules enable wordpress/security# Check Node.js version
node --version
# Reinstall dependencies
cd ~/.config/opencode/hooks && npm install
# Test hook manually
node php-lint.js test.php- Backup existing configuration
- Install OpenCode WordPress
- Verify all components installed
- Test skills invocation
- Test agents activation
- Test commands execution
- Test hooks validation
- Review existing WordPress code
- Apply OpenCode WordPress patterns
- Fix issues with skills guidance
- Validate all code
- Commit with hook validation
Don't migrate everything at once:
- Week 1: Install and configure
- Week 2: Migrate one theme
- Week 3: Migrate one plugin
- Week 4: Migrate WooCommerce code
- Week 5: Team adoption
- Week 6: Full workflow integration
- Document migration process
- Train team on new workflow
- Provide support during transition
- Regular feedback collection
- Iterate based on team needs
For migration issues:
- GitHub Issues: https://github.com/promoweb/opencode-wordpress/issues
- Migration Discussions: https://github.com/promoweb/opencode-wordpress/discussions/categories/migration
- Documentation: docs/ folder
GPL v2 or later