agentleFS
MathiasPaulenkoMathiasPaulenko/ai-toolkit/skills/wordpress-themes/SKILL.md

wordpress-themes

Skill2 starsChanged 4 months agoMITView on GitHub

WordPress theme development standards. Covers theme structure, template hierarchy, custom post types, ACF integration, enqueueing assets, security, and performance best practices.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use wp_enqueue_* (no hardcoded <script>/<link>).

    line 176
  2. Very specific:

    Use get_template_part() for reusable chunks.

    line 180

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

WordPress Theme Development

1. Theme Structure

my-theme/
  style.css          # Theme metadata + base styles
  index.php          # Fallback template
  functions.php      # Theme setup, hooks, helpers
  screenshot.png     # 1200x900 admin preview
  templates/         # Block theme templates (FSE)
  parts/             # Block theme template parts
  blocks/            # Custom block styles
  inc/               # PHP includes
    setup.php
    custom-post-types.php
    acf-fields.php
  assets/
    css/
    js/
    images/
  languages/         # Translation files

2. Theme Metadata (style.css)

/*
Theme Name: My Custom Theme
Theme URI: https://example.com
Author: Mathias Paulenko Echeverz
Author URI: https://example.com
Description: A clean, performant WordPress theme.
Version: 1.0.0
License: GPL-2.0+
License URI: https://example.com/licenses/gpl-2.0.html
Text Domain: my-theme
Domain Path: /languages
Requires at least: 6.0
Requires PHP: 8.0
*/

3. Enqueueing Assets

// functions.php
add_action('wp_enqueue_scripts', function () {
    $theme_version = wp_get_theme()->get('Version');
    
    wp_enqueue_style(
        'my-theme-style',
        get_stylesheet_uri(),
        [],
        $theme_version
    );
    
    wp_enqueue_script(
        'my-theme-app',
        get_template_directory_uri() . '/assets/js/app.js',
        [],
        $theme_version,
        true // in_footer
    );
    
    wp_localize_script('my-theme-app', 'themeData', [
        'ajaxUrl' => admin_url('admin-ajax.php'),
        'restUrl' => rest_url(),
        'nonce'   => wp_create_nonce('wp_rest'),
    ]);
});

4. Template Hierarchy

RequestTemplate Used
Single postsingle.php → singular.php → index.php
Pagepage-{slug}.php → page-{id}.php → page.php
Archivearchive-{post_type}.php → archive.php
Categorycategory-{slug}.php → category.php
Searchsearch.php
404404.php
Home (blog)home.php → index.php
Front pagefront-page.php

5. Custom Post Types

// inc/custom-post-types.php
add_action('init', function () {
    register_post_type('portfolio', [
        'labels'      => [
            'name'          => __('Portfolios', 'my-theme'),
            'singular_name' => __('Portfolio', 'my-theme'),
        ],
        'public'      => true,
        'has_archive' => true,
        'rewrite'     => ['slug' => 'portfolio'],
        'supports'    => ['title', 'editor', 'thumbnail', 'excerpt'],
        'menu_icon'   => 'dashicons-portfolio',
        'show_in_rest' => true, // Gutenberg support
    ]);
});

6. ACF Integration

// inc/acf-fields.php
if (function_exists('acf_add_local_field_group')) {
    acf_add_local_field_group([
        'key'      => 'group_portfolio_details',
        'title'    => 'Portfolio Details',
        'fields'   => [
            [
                'key'   => 'field_client_name',
                'label' => 'Client Name',
                'name'  => 'client_name',
                'type'  => 'text',
            ],
            [
                'key'   => 'field_project_url',
                'label' => 'Project URL',
                'name'  => 'project_url',
                'type'  => 'url',
            ],
        ],
        'location' => [
            [
                [
                    'param'    => 'post_type',
                    'operator' => '==',
                    'value'    => 'portfolio',
                ],
            ],
        ],
    ]);
}

7. Security

// Escape all output
<h1><?php echo esc_html(get_the_title()); ?></h1>
<a href="<?php echo esc_url(get_permalink()); ?>">Read more</a>

// Sanitize input
$email = sanitize_email($_POST['email']);

// Nonce verification
if (!wp_verify_nonce($_POST['_wpnonce'], 'my_action')) {
    wp_die('Security check failed');
}

// Prepared queries
$wpdb->get_results(
    $wpdb->prepare("SELECT * FROM {$wpdb->posts} WHERE post_status = %s", 'publish')
);

8. Performance

  • Use wp_enqueue_* (no hardcoded <script>/<link>).
  • Enable object caching (Redis/Memcached).
  • Optimize images (WebP, lazy loading).
  • Minimize autoloaded options.
  • Use get_template_part() for reusable chunks.
  • Enable Gzip and browser caching via server config.

9. Translations

// Load text domain
add_action('after_setup_theme', function () {
    load_theme_textdomain('my-theme', get_template_directory() . '/languages');
});

// In templates
_e('Read more', 'my-theme');
$title = __('Latest Posts', 'my-theme');

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.