# Copilot Custom Instructions for WordPress Plugin Development

## General Guidelines

- Use PHP for plugin logic and follow WordPress coding standards.
- All plugin code must be wrapped in functions or classes to prevent namespace collisions.
- Prefix all functions, classes, and variables with a unique plugin-specific prefix.
- Use proper WordPress hooks (actions and filters) to integrate functionality.
- Always escape, sanitize, and validate user input and output.
- Use `__()` and `_e()` for all user-facing strings to support translation.
- Include a plugin header comment block at the top of the main file.

## Plugin File Structure

- Main plugin file: `jays-chat-assistant.php`
- Subfolders: `includes/`, `admin/`, `public/`, `languages/`


## Example of Hook Usage

```php
// Register a custom action on plugin activation
register_activation_hook(__FILE__, 'jays_chat_assistant_activate');

function jays_chat_assistant_activate() {
    // Activation code here
}
```

## Example of Prefixing Functions

```php
function jays_chat_assistant_do_something() {
    // Function code here
}
```

## Best Practices

- Use OOP (Object-Oriented Programming) for complex plugins; otherwise, keep code modular.
- Avoid direct database queries; use WordPress APIs when possible.
- Always enqueue scripts and styles properly using `wp_enqueue_script()` and `wp_enqueue_style()`.
- Use nonces and capability checks for security in admin actions.

## Example: Enqueuing Scripts

```php
function jays_chat_assistant_enqueue_scripts() {
    wp_enqueue_script('jays-chat-assistant-js', plugins_url('public/js/jays-chat-assistant.js', __FILE__), array('jquery'), '1.0.0', true);
}
add_action('wp_enqueue_scripts', 'jays_chat_assistant_enqueue_scripts');
```

## Example: Adding an Admin Menu

```php
function jays_chat_assistant_add_menu_page() {
    add_menu_page(
        __('Jays Chat Assistant', 'jays-chat-assistant'),
        __('Jays Chat Assistant', 'jays-chat-assistant'),
        'manage_options',
        'jays-chat-assistant',
        'jays_chat_assistant_admin_page'
    );
}
add_action('admin_menu', 'jays_chat_assistant_add_menu_page');

function jays_chat_assistant_admin_page() {
    echo '<h1>' . esc_html__('Jays Chat Assistant Plugin Settings', 'jays-chat-assistant') . '</h1>';
}
```

---

Follow these conventions for all code completions and suggestions.