Secure Plugin Developmentのロゴ

Secure Plugin Development

組織
wpultimatesecurity
secure-plugin-development

WordPressのプラグインやテーマを新規作成するとき、プラグインファイルのひな形を作成するとき、フックを設定するとき、またはリクエスト、オプション、出力を扱う機能を追加するときに使用します。ABSPATHガード、権限チェック+ノンス+サニタイズ+エスケープの流れ、プリペアドクエリ、安全なデフォルトを含む、初期状態から安全な基盤を整えます。各課題に対応するセキュリティスキルも案内します。WordPress開発を始める際にあらかじめ適用してください。

Add to TypingMind

概要

公開者wpultimatesecurity
リポジトリWordPress-Security-Skills
スキル名secure-plugin-development
スター
54
フォーク
3
同梱ファイル
3
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 3個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    wpultimatesecurityがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Secure Plugin Development」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/wpultimatesecurity/WordPress-Security-Skills/tree/dev/skills/secure-plugin-development
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wpultimatesecurity/WordPress-Security-Skills.git /tmp/WordPress-Security-Skills
mkdir -p .claude/skills
cp -r /tmp/WordPress-Security-Skills/skills/secure-plugin-development .claude/skills/secure-plugin-development
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでSecure Plugin Developmentを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にSecure Plugin Developmentを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Secure Plugin Developmentは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Secure plugin & theme development (baseline)

When to use this skill

Use this skill at the start of any WordPress development work and whenever you add a feature that crosses a trust boundary:

  • Creating a new plugin main file or theme functions.php addition.
  • Registering hooks (add_action / add_filter) that handle input or render output.
  • Adding admin pages, settings, shortcodes, blocks, widgets, or REST routes.
  • Reviewing an existing plugin to bring it up to a secure baseline.

This is the router skill. Follow the security decision tree: choose the entry path (browser/API, renderer, cron, or CLI), then add the relevant data and policy branches. It explains when to combine focused skills and when browser nonce checks do not apply; do not load every skill for every task.

Core principles (and why they matter)

  1. Never trust input; always escape output. Every value from $_GET, $_POST, $_REQUEST, $_COOKIE, the database, or a remote API is untrusted until sanitized, and untrusted again the moment it is echoed. These are two separate jobs.
  2. Block direct file access. Plugin files are reachable by URL. Without an ABSPATH guard, an attacker can execute them outside WordPress, bypassing all your checks.
  3. Separate authentication, CSRF, and authorization. Use a nonce for cookie-authenticated state changes and an appropriate capability/object check for privileged actions. REST API credentials, cron, and CLI have different trust models; follow the decision tree rather than adding browser checks everywhere.
  4. Use core APIs, not hand-rolled code. Prefer maintained sanitize/escape/DB/HTTP APIs, but choose the API and its arguments for the actual trust boundary.
  5. Least privilege by default. Default options to the safe value, scope capabilities tightly, and expose the minimum surface.
  6. Fail closed. On any failed check, stop and return an error — never fall through.

Step-by-step implementation

  1. Guard the file: defined( 'ABSPATH' ) || exit; at the top of every PHP file.
  2. Namespace everything: prefix functions, hooks, options, and globals (e.g. my_plugin_*) to avoid collisions and accidental overrides.
  3. Choose the handler trust model using the decision tree:
    1. Apply transport-appropriate authentication and CSRF protection.
    2. Check authority over the action and specific resource.
    3. Validate input shape/type, unslash WordPress-slashed request input, and sanitize.
    4. Use $wpdb->prepare() for dynamic values in custom queries.
    5. Escape at each output sink for its actual context.
  4. Set safe defaults for all options; validate on save and on read.
  5. Enqueue assets properly (wp_enqueue_script/style) and pass data via wp_localize_script() rather than inline-echoing PHP into JS.
  6. Keep secrets out of the repo and out of client-readable output.

Supporting references

ReferenceLoad when
Secure plugin baseline checklistBefore final verification of the secure plugin baseline controls.
Choose the security review pathSelecting focused skills for the entry point and all relevant data and risk branches.
Secure plugin skeletonImplementing a capability-gated plugin admin page and the full settings-save flow.

Common AI mistakes / anti-patterns

Mistake 1 — No ABSPATH guard

php
// ❌ Insecure: file executes if requested directly over HTTP.
<?php
function my_plugin_init() { /* ... */ }
php
// ✅ Secure: bail unless loaded within WordPress.
<?php
defined( 'ABSPATH' ) || exit;

function my_plugin_init() { /* ... */ }

Mistake 2 — Doing the work before the security checks

php
// ❌ Insecure: option saved before anything is verified.
function my_plugin_save() {
    update_option( 'my_opt', $_POST['val'] );
    check_admin_referer( 'my_plugin_save' );
    current_user_can( 'manage_options' );
}
php
// ✅ Secure: verify, authorize, sanitize, THEN act.
function my_plugin_save() {
    check_admin_referer( 'my_plugin_save', 'my_plugin_nonce' );
    if ( ! current_user_can( 'manage_options' ) ) {
        wp_die( esc_html__( 'Forbidden', 'my-plugin' ), 403 );
    }
    $val = isset( $_POST['val'] ) ? sanitize_text_field( wp_unslash( $_POST['val'] ) ) : '';
    update_option( 'my_opt', $val );
}

Mistake 3 — Rolling your own instead of using core APIs

php
// ❌ Insecure: manual SQL, manual escaping, raw remote fetch.
$rows = $wpdb->get_results( "SELECT * FROM t WHERE id = " . $_GET['id'] );
echo "<a href=" . $_GET['url'] . ">x</a>";
$body = file_get_contents( $remote_url );
php
// ✅ Secure: prepared query, escaped output, HTTP API.
$id   = absint( $_GET['id'] ?? 0 );
$rows = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}t WHERE id = %d", $id ) );
echo '<a href="' . esc_url( wp_unslash( $_GET['url'] ?? '' ) ) . '">x</a>';
$response = wp_remote_get( $remote_url );
$body     = is_wp_error( $response ) ? '' : wp_remote_retrieve_body( $response );

Mistake 4 — Unsafe defaults

php
// ❌ Insecure: feature ships enabled, capability defaults wide open.
add_option( 'my_plugin_allow_uploads', true );
php
// ✅ Secure: default to the safe value; opt-in to risk.
add_option( 'my_plugin_allow_uploads', false );

Correct code examples

A minimal but complete secure plugin skeleton — ABSPATH guard, an admin page behind a capability, and the full verify → authorize → sanitize → act → escape flow — lives in references/secure-plugin-skeleton.php.

Checklist

  • Every PHP file opens with defined( 'ABSPATH' ) || exit;.
  • Functions, hooks, and options are uniquely prefixed.
  • Each request handler verifies nonce, then capability, then sanitizes input.
  • All custom DB access uses $wpdb->prepare().
  • All dynamic output is escaped at the point of echo.
  • Options have safe defaults and are validated on save.
  • Remote requests use the WP HTTP API (wp_remote_*), not file_get_contents/cURL.
  • No secrets, keys, or credentials are hard-coded or sent to the browser.
  • Scripts are enqueued and given data via wp_localize_script().

Official references

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Secure Plugin Development」では何ができますか?

WordPressのプラグインやテーマを新規作成するとき、プラグインファイルのひな形を作成するとき、フックを設定するとき、またはリクエスト、オプション、出力を扱う機能を追加するときに使用します。ABSPATHガード、権限チェック+ノンス+サニタイズ+エスケープの流れ、プリペアドクエリ、安全なデフォルトを含む、初期状態から安全な基盤を整えます。各課題に対応するセキュリティスキルも案内します。WordPress開発を始める際にあらかじめ適用してください。

TypingMindでSecure Plugin Developmentを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Secure Plugin Developmentはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにSecure Plugin Developmentをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/wpultimatesecurity/WordPress-Security-Skills/tree/dev/skills/secure-plugin-developmentを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Secure Plugin Developmentを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Secure Plugin Developmentで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSecure Plugin Developmentを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Secure Plugin Development」は無料ですか?

はい。wpultimatesecurityがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る
affaan-mのロゴ

Agent Architecture Audit

affaan-m
コミュニティ人気

エージェントやLLMアプリケーション向けのフルスタック診断です。12層のエージェントスタックを対象に、ラッパーのリグレッション、メモリ汚染、ツール利用規律の欠如、隠れた修復ループ、レンダリングの破損を監査します。重要度順の問題点と、コードを中心とした修正案を提示します。エージェントアプリケーション、自律ループ、LLMを活用した機能を開発する方に必須です。

39.1K
261.1K
指示
表示
NousResearchのロゴ

Antigravity Cli

NousResearch
組織人気

Antigravity CLI(agy)のプラグイン、認証、サンドボックスを操作します。

53.5K
250.4K
1ファイル
表示
langgeniusのロゴ

Backend Code Review

langgenius
組織人気

ユーザーが`api/`配下のバックエンドコードのレビューまたは監査を明示的に依頼した場合にのみ使用します。保留中の変更、特定ファイル、貼り付けられた差分のレビューに対応します。実装のみの依頼には使用しないでください。…

24.9K
157.6K
4ファイル
表示
langgeniusのロゴ

Frontend Code Review

langgenius
組織人気

ユーザーが`web/`または`packages/dify-ui/`配下のフロントエンドコードのレビューまたは監査を明示的に依頼した場合にのみ使用します。保留中の変更、特定ファイル、貼り付けられた差分のレビューに対応します。実装のみの依頼には使用しないでください。…

24.9K
157.6K
8ファイル
表示

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇