KaiGen WordPress Plugin Skill
Use this skill when updating the KaiGen WordPress plugin. It summarizes project structure, build/test commands, and coding conventions so changes follow existing patterns.
Quick start
- •Read
AGENTS.mdfor repo-specific guidance and commands. - •Identify the change area (block editor UI vs. server hooks vs. settings UI).
- •Implement changes in
src/orinc/and avoid editingbuild/directly. - •Run tests and linters per
AGENTS.mdafter changes are ready.
Project map
- •
kaigen.php: plugin bootstrap and version header. - •
inc/: server-side logic, hooks, REST/AJAX endpoints. - •
src/: editor UI and client logic (build output goes tobuild/). - •
build/: generated assets (do not edit directly). - •
src/index.js: block entrypoint;src/components/: UI components. - •
src/api.js: client API requests; coordinate withinc/handlers. - •
src/admin.js: settings UI; settings stored via WordPress options ininc/.
Data flow
- •Editor UI in
src/sends requests viasrc/api.js. - •Server handlers in
inc/call provider APIs and return results. - •Client inserts/updates image blocks in the editor.
Commands (from AGENTS.md)
- •Build:
npm run build - •Lint JS:
npm run lint:js/ Fix:npm run lint:js:fix - •Lint CSS:
npm run lint:css - •Lint PHP:
npm run lint:php(requirescomposer install) - •Fix PHP:
npm run lint:php:fix - •Format:
npm run format - •E2E:
npm run test:e2e - •Single e2e:
npx playwright test tests/e2e/[test-file].spec.ts
Coding rules
- •Use tabs for indentation (except YAML files which use 2 spaces).
- •Follow WordPress Coding Standards; include PHP doc blocks with @package and function descriptions.
- •Sanitize user input (e.g.,
sanitize_text_field()), escape output (esc_attr(),esc_html()). - •Use hooks/filters for provider integration; avoid provider-specific logic in base files.
Common tasks → files
- •UI control:
src/components/,src/index.js - •Provider payload:
src/api.jsand matching handler ininc/ - •Provider integration: add handler/hooks in
inc/, expose insrc/ - •Settings UI:
src/admin.js; storage ininc/ - •Version update:
kaigen.php,readme.txt,package.json
Notes
- •
build/is committed but generated; changesrc/then runnpm run build. - •After any changeset ready to commit, run
npm run test:e2eand the relevant linters.