heraspec 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +188 -103
  3. package/bin/heraspec.js +4805 -1122
  4. package/bin/heraspec.js.map +4 -4
  5. package/dist/core/templates/skills/CHANGELOG.md +117 -117
  6. package/dist/core/templates/skills/README-template.md +58 -58
  7. package/dist/core/templates/skills/README.md +38 -38
  8. package/dist/core/templates/skills/content-optimization-skill.md +104 -104
  9. package/dist/core/templates/skills/data/design-systems.csv +54 -0
  10. package/dist/core/templates/skills/data/pages-proposed.csv +21 -21
  11. package/dist/core/templates/skills/data/pages.csv +9 -9
  12. package/dist/core/templates/skills/data/typography.csv +57 -57
  13. package/dist/core/templates/skills/deploy-documentation-skill.md +408 -0
  14. package/dist/core/templates/skills/design-system-skill.md +176 -0
  15. package/dist/core/templates/skills/documents/templates/documentation-landing-page.html +63 -63
  16. package/dist/core/templates/skills/documents/templates/documentation.html +49 -49
  17. package/dist/core/templates/skills/documents/templates/landing-script.js +38 -38
  18. package/dist/core/templates/skills/documents/templates/landing-style.css +158 -158
  19. package/dist/core/templates/skills/documents/templates/script.js +56 -56
  20. package/dist/core/templates/skills/documents/templates/style.css +155 -155
  21. package/dist/core/templates/skills/documents/templates/technical-doc-template.md +16 -16
  22. package/dist/core/templates/skills/documents/templates/user-guide-template.md +16 -16
  23. package/dist/core/templates/skills/documents-skill.md +104 -104
  24. package/dist/core/templates/skills/e2e-test-skill.md +119 -119
  25. package/dist/core/templates/skills/git-embed-skill.md +57 -0
  26. package/dist/core/templates/skills/integration-test-skill.md +118 -118
  27. package/dist/core/templates/skills/knowledge/README.md +63 -0
  28. package/dist/core/templates/skills/knowledge/design-systems/airbnb/DESIGN.md +246 -0
  29. package/dist/core/templates/skills/knowledge/design-systems/airtable/DESIGN.md +89 -0
  30. package/dist/core/templates/skills/knowledge/design-systems/apple/DESIGN.md +313 -0
  31. package/dist/core/templates/skills/knowledge/design-systems/bmw/DESIGN.md +180 -0
  32. package/dist/core/templates/skills/knowledge/design-systems/cal/DESIGN.md +259 -0
  33. package/dist/core/templates/skills/knowledge/design-systems/claude/DESIGN.md +312 -0
  34. package/dist/core/templates/skills/knowledge/design-systems/clay/DESIGN.md +304 -0
  35. package/dist/core/templates/skills/knowledge/design-systems/clickhouse/DESIGN.md +281 -0
  36. package/dist/core/templates/skills/knowledge/design-systems/cohere/DESIGN.md +266 -0
  37. package/dist/core/templates/skills/knowledge/design-systems/coinbase/DESIGN.md +129 -0
  38. package/dist/core/templates/skills/knowledge/design-systems/composio/DESIGN.md +307 -0
  39. package/dist/core/templates/skills/knowledge/design-systems/cursor/DESIGN.md +309 -0
  40. package/dist/core/templates/skills/knowledge/design-systems/elevenlabs/DESIGN.md +265 -0
  41. package/dist/core/templates/skills/knowledge/design-systems/expo/DESIGN.md +281 -0
  42. package/dist/core/templates/skills/knowledge/design-systems/figma/DESIGN.md +220 -0
  43. package/dist/core/templates/skills/knowledge/design-systems/framer/DESIGN.md +246 -0
  44. package/dist/core/templates/skills/knowledge/design-systems/hashicorp/DESIGN.md +278 -0
  45. package/dist/core/templates/skills/knowledge/design-systems/ibm/DESIGN.md +332 -0
  46. package/dist/core/templates/skills/knowledge/design-systems/index.json +72 -0
  47. package/dist/core/templates/skills/knowledge/design-systems/intercom/DESIGN.md +146 -0
  48. package/dist/core/templates/skills/knowledge/design-systems/kraken/DESIGN.md +125 -0
  49. package/dist/core/templates/skills/knowledge/design-systems/linear.app/DESIGN.md +367 -0
  50. package/dist/core/templates/skills/knowledge/design-systems/lovable/DESIGN.md +298 -0
  51. package/dist/core/templates/skills/knowledge/design-systems/minimax/DESIGN.md +257 -0
  52. package/dist/core/templates/skills/knowledge/design-systems/mintlify/DESIGN.md +326 -0
  53. package/dist/core/templates/skills/knowledge/design-systems/miro/DESIGN.md +108 -0
  54. package/dist/core/templates/skills/knowledge/design-systems/mistral.ai/DESIGN.md +261 -0
  55. package/dist/core/templates/skills/knowledge/design-systems/mongodb/DESIGN.md +266 -0
  56. package/dist/core/templates/skills/knowledge/design-systems/notion/DESIGN.md +309 -0
  57. package/dist/core/templates/skills/knowledge/design-systems/nvidia/DESIGN.md +293 -0
  58. package/dist/core/templates/skills/knowledge/design-systems/ollama/DESIGN.md +267 -0
  59. package/dist/core/templates/skills/knowledge/design-systems/opencode.ai/DESIGN.md +281 -0
  60. package/dist/core/templates/skills/knowledge/design-systems/pinterest/DESIGN.md +230 -0
  61. package/dist/core/templates/skills/knowledge/design-systems/posthog/DESIGN.md +256 -0
  62. package/dist/core/templates/skills/knowledge/design-systems/raycast/DESIGN.md +268 -0
  63. package/dist/core/templates/skills/knowledge/design-systems/replicate/DESIGN.md +261 -0
  64. package/dist/core/templates/skills/knowledge/design-systems/resend/DESIGN.md +303 -0
  65. package/dist/core/templates/skills/knowledge/design-systems/revolut/DESIGN.md +185 -0
  66. package/dist/core/templates/skills/knowledge/design-systems/runwayml/DESIGN.md +244 -0
  67. package/dist/core/templates/skills/knowledge/design-systems/sanity/DESIGN.md +357 -0
  68. package/dist/core/templates/skills/knowledge/design-systems/sentry/DESIGN.md +262 -0
  69. package/dist/core/templates/skills/knowledge/design-systems/spacex/DESIGN.md +194 -0
  70. package/dist/core/templates/skills/knowledge/design-systems/spotify/DESIGN.md +246 -0
  71. package/dist/core/templates/skills/knowledge/design-systems/stripe/DESIGN.md +322 -0
  72. package/dist/core/templates/skills/knowledge/design-systems/supabase/DESIGN.md +255 -0
  73. package/dist/core/templates/skills/knowledge/design-systems/superhuman/DESIGN.md +252 -0
  74. package/dist/core/templates/skills/knowledge/design-systems/together.ai/DESIGN.md +263 -0
  75. package/dist/core/templates/skills/knowledge/design-systems/uber/DESIGN.md +295 -0
  76. package/dist/core/templates/skills/knowledge/design-systems/vercel/DESIGN.md +310 -0
  77. package/dist/core/templates/skills/knowledge/design-systems/voltagent/DESIGN.md +323 -0
  78. package/dist/core/templates/skills/knowledge/design-systems/warp/DESIGN.md +253 -0
  79. package/dist/core/templates/skills/knowledge/design-systems/webflow/DESIGN.md +92 -0
  80. package/dist/core/templates/skills/knowledge/design-systems/wise/DESIGN.md +173 -0
  81. package/dist/core/templates/skills/knowledge/design-systems/x.ai/DESIGN.md +257 -0
  82. package/dist/core/templates/skills/knowledge/design-systems/zapier/DESIGN.md +328 -0
  83. package/dist/core/templates/skills/knowledge/frameworks/php/codeigniter/rise-cms/profile.json +27 -0
  84. package/dist/core/templates/skills/knowledge/frameworks/php/codeigniter/rise-cms/structure.md +137 -0
  85. package/dist/core/templates/skills/knowledge/frameworks/php/laravel/botble/profile.json +39 -0
  86. package/dist/core/templates/skills/knowledge/frameworks/php/laravel/botble/structure.md +208 -0
  87. package/dist/core/templates/skills/knowledge/frameworks/php/wordpress/core/profile.json +51 -0
  88. package/dist/core/templates/skills/knowledge/frameworks/php/wordpress/core/structure.md +369 -0
  89. package/dist/core/templates/skills/knowledge/index.json +65 -0
  90. package/dist/core/templates/skills/module-codebase-skill.md +110 -110
  91. package/dist/core/templates/skills/plugin-directory-skill.md +396 -396
  92. package/dist/core/templates/skills/project-memory-skill.md +222 -0
  93. package/dist/core/templates/skills/project-memory-skill.vi.md +223 -0
  94. package/dist/core/templates/skills/scripts/CODE_EXPLANATION.md +394 -394
  95. package/dist/core/templates/skills/scripts/SEARCH_ALGORITHMS_COMPARISON.md +421 -421
  96. package/dist/core/templates/skills/scripts/SEARCH_MODES_GUIDE.md +238 -238
  97. package/dist/core/templates/skills/scripts/__pycache__/core.cpython-311.pyc +0 -0
  98. package/dist/core/templates/skills/scripts/core.py +391 -385
  99. package/dist/core/templates/skills/scripts/search.py +1 -1
  100. package/dist/core/templates/skills/smart-explore-skill.md +141 -0
  101. package/dist/core/templates/skills/sourcecode-analyzer-skill.md +210 -0
  102. package/dist/core/templates/skills/sourcecode-analyzer-skill.vi.md +210 -0
  103. package/dist/core/templates/skills/suggestion-skill.md +118 -118
  104. package/dist/core/templates/skills/templates/accessibility-checklist.md +40 -40
  105. package/dist/core/templates/skills/templates/example-prompt-full-theme.md +333 -333
  106. package/dist/core/templates/skills/templates/page-types-guide.md +338 -338
  107. package/dist/core/templates/skills/templates/pages-proposed-summary.md +273 -273
  108. package/dist/core/templates/skills/templates/pre-delivery-checklist.md +42 -42
  109. package/dist/core/templates/skills/templates/prompt-template-full-theme.md +313 -313
  110. package/dist/core/templates/skills/templates/responsive-design.md +40 -40
  111. package/dist/core/templates/skills/ui-ux-skill.md +595 -584
  112. package/dist/core/templates/skills/unit-test-skill.md +111 -111
  113. package/dist/core/templates/skills/ux-element/templates/Controller.php +50 -50
  114. package/dist/core/templates/skills/ux-element/templates/Shortcode.php +23 -23
  115. package/dist/core/templates/skills/ux-element/templates/Template.html +20 -20
  116. package/dist/core/templates/skills/ux-element/templates/Thumbnail.svg +8 -8
  117. package/dist/core/templates/skills/ux-element/templates/View.php +21 -21
  118. package/dist/core/templates/skills/ux-element-skill.md +83 -83
  119. package/dist/core/templates/skills/wordpress-plugin-check-skill.md +151 -76
  120. package/dist/core/templates/skills/wordpress-plugin-standard/templates/admin-dashboard.php +47 -47
  121. package/dist/core/templates/skills/wordpress-plugin-standard/templates/admin-settings.php +60 -60
  122. package/dist/core/templates/skills/wordpress-plugin-standard/templates/assets/admin-css.css +22 -22
  123. package/dist/core/templates/skills/wordpress-plugin-standard/templates/assets/admin-js.js +15 -15
  124. package/dist/core/templates/skills/wordpress-plugin-standard/templates/plugin-main.php +169 -169
  125. package/dist/core/templates/skills/wordpress-plugin-standard/templates/readme.txt +41 -41
  126. package/dist/core/templates/skills/wordpress-plugin-standard/templates/uninstall.php +21 -21
  127. package/dist/core/templates/skills/wordpress-plugin-standard-skill.md +100 -100
  128. package/dist/index.js +4068 -278
  129. package/package.json +75 -72
@@ -0,0 +1,369 @@
1
+ ## Executive Summary
2
+ - [Observed | High] WordPress 6.9.x is a monolithic PHP CMS with a deeply hook-driven architecture. The core runtime lives in `wp-includes/` (~250 files, ~4MB+ of PHP), administration in `wp-admin/` (~100 files), and all user extensions in `wp-content/` (plugins, themes, uploads, mu-plugins).
3
+ Evidence: `wp-settings.php` (bootstrap sequence), `wp-includes/version.php:19` (`$wp_version = '6.9.4'`), directory listings.
4
+ - [Observed | High] Extensibility is built on two primitives: **Actions** (`do_action`/`add_action`) for side-effects and **Filters** (`apply_filters`/`add_filter`) for data transformation. Nearly every behavior in WordPress can be intercepted, modified, or extended via these hooks.
5
+ Evidence: `wp-includes/plugin.php:121` (`add_filter`), `:173` (`apply_filters`), `:446` (`add_action`), `:487` (`do_action`); `wp-includes/default-filters.php` (~37KB of hook registrations).
6
+ - [Observed | High] WordPress provides a full REST API (prefix `/wp-json/wp/v2/`) with 40+ endpoint controllers for posts, pages, users, taxonomies, blocks, templates, menus, widgets, fonts, and more.
7
+ Evidence: `wp-settings.php:294-341` (REST API class loading), `wp-includes/rest-api/endpoints/` directory (40+ controller classes).
8
+
9
+ ## Technology Profile
10
+ - [Observed | High] Runtime: PHP >= 7.2.24; recommended 8.0+.
11
+ Evidence: `wp-includes/version.php:40` (`$required_php_version = '7.2.24'`).
12
+ - [Observed | High] Required PHP extensions: `json`, `hash`.
13
+ Evidence: `wp-includes/version.php:47-49`.
14
+ - [Observed | High] Database: MySQL >= 5.5.5 (also supports MariaDB). Data access via the `wpdb` class (custom query builder, not an ORM).
15
+ Evidence: `wp-includes/version.php:57`, `wp-includes/class-wpdb.php` (~118KB).
16
+ - [Observed | High] Frontend: Block Editor (Gutenberg) uses React/JSX for editor UI. Classic themes use PHP template hierarchy. Full Site Editing themes use `theme.json` + block templates.
17
+ Evidence: `wp-includes/blocks/` directory, `wp-includes/class-wp-block.php`, `wp-includes/class-wp-theme-json.php` (~164KB).
18
+ - [Observed | High] HTTP layer: `WP_Http` class with cURL and PHP streams transports. External requests via `Requests` library.
19
+ Evidence: `wp-includes/class-wp-http.php`, `wp-includes/class-wp-http-curl.php`, `wp-includes/Requests/` directory.
20
+
21
+ ## Repository Topology
22
+ - [Observed | High] Root directory structure:
23
+ ```
24
+ wordpress/
25
+ ├── wp-admin/ # Administration backend (93 PHP files, 7 subdirs)
26
+ │ ├── includes/ # Admin-only helper classes and functions
27
+ │ ├── css/ # Admin stylesheets
28
+ │ ├── js/ # Admin JavaScript
29
+ │ └── network/ # Multisite network admin
30
+ ├── wp-content/ # User-managed content
31
+ │ ├── plugins/ # Plugin installations
32
+ │ ├── themes/ # Theme installations
33
+ │ ├── uploads/ # Media uploads (created at runtime)
34
+ │ ├── mu-plugins/ # Must-use plugins (auto-loaded, no activation)
35
+ │ └── languages/ # Translation files
36
+ ├── wp-includes/ # Core library (249 PHP files, 29 subdirs)
37
+ │ ├── rest-api/ # REST API framework + 40+ endpoint controllers
38
+ │ ├── blocks/ # Core block type definitions
39
+ │ ├── html-api/ # HTML parser/processor
40
+ │ ├── block-supports/ # Block feature support handlers
41
+ │ ├── block-bindings/ # Block binding sources
42
+ │ ├── sitemaps/ # XML sitemap providers
43
+ │ ├── style-engine/ # CSS generation engine
44
+ │ ├── fonts/ # Font library management
45
+ │ ├── interactivity-api/ # Frontend interactivity framework
46
+ │ └── widgets/ # Core widget classes
47
+ ├── wp-config.php # Site configuration (user-created)
48
+ ├── wp-settings.php # Bootstrap loader (orchestrates entire load sequence)
49
+ ├── wp-load.php # Environment setup + config loading
50
+ ├── wp-blog-header.php # Front-end entry point
51
+ ├── wp-login.php # Authentication UI
52
+ ├── wp-cron.php # Pseudo-cron runner
53
+ └── xmlrpc.php # XML-RPC endpoint
54
+ ```
55
+ Evidence: filesystem listing of WordPress 6.9.4 source.
56
+
57
+ ## Architecture and Dependency Flow
58
+ - [Observed | High] Bootstrap sequence (wp-settings.php):
59
+ 1. Load `version.php`, `compat.php`, `load.php`
60
+ 2. Initialize error/recovery handlers
61
+ 3. Load `plugin.php` (hook system)
62
+ 4. Set constants, start object cache
63
+ 5. Load `default-filters.php` (attach core hooks)
64
+ 6. Initialize multisite if enabled
65
+ 7. Load mu-plugins → fire `muplugins_loaded`
66
+ 8. Load active plugins → fire `plugins_loaded`
67
+ 9. Load pluggable functions
68
+ 10. Create WP_Query, WP_Rewrite, WP objects
69
+ 11. Load active theme's `functions.php` → fire `after_setup_theme`
70
+ 12. `$wp->init()` → fire `init`
71
+ 13. Fire `wp_loaded`
72
+ Evidence: `wp-settings.php:1-765` (entire file, sequential require chain).
73
+ - [Observed | High] Request lifecycle (front-end):
74
+ `index.php` → `wp-blog-header.php` → `wp-load.php` (config) → `wp-settings.php` (bootstrap) → `WP::main()` → `WP::parse_request()` → `WP::query_posts()` → `WP::handle_404()` → `WP::register_globals()` → `template-loader.php` → selected template file.
75
+ Evidence: `wp-blog-header.php:14`, `wp-includes/class-wp.php`, `wp-includes/template-loader.php`.
76
+ - [Observed | High] Admin request lifecycle:
77
+ `wp-admin/*.php` → `wp-admin/admin.php` → `wp-load.php` → `wp-settings.php` → admin-specific includes → fire `admin_init`.
78
+ Evidence: `wp-admin/admin.php`.
79
+ - [Observed | High] AJAX lifecycle:
80
+ `wp-admin/admin-ajax.php` → validates nonce/auth → fires `wp_ajax_{action}` (logged-in) or `wp_ajax_nopriv_{action}` (public).
81
+ Evidence: `wp-admin/admin-ajax.php`.
82
+
83
+ ## Coding Style and Conventions
84
+ - [Observed | High] Naming: snake_case for functions and variables, `WP_` prefix for classes (e.g., `WP_Query`, `WP_Hook`, `WP_REST_Controller`), `wp_` prefix for global functions.
85
+ Evidence: throughout `wp-includes/*.php`.
86
+ - [Observed | High] Procedural + OOP hybrid: Core utility functions are global/procedural (`get_post()`, `wp_insert_post()`). Major subsystems are class-based (`WP_Query`, `WP_REST_Server`, `WP_Hook`, `wpdb`).
87
+ Evidence: `wp-includes/post.php` (procedural), `wp-includes/class-wp-query.php` (OOP).
88
+ - [Observed | High] Template Hierarchy: Front-end rendering follows a priority chain (`single-{post_type}.php` → `single.php` → `singular.php` → `index.php`). Functions: `locate_template()`, `get_template_part()`.
89
+ Evidence: `wp-includes/template-loader.php`, `wp-includes/template.php`.
90
+ - [Observed | High] WordPress Coding Standards (WPCS): enforced via phpcs with WordPress-specific sniffs. Tab indentation, Yoda conditions, `esc_*` output escaping, `wp_kses` input sanitization.
91
+ Evidence: inline phpcs annotations throughout core, `wp-includes/kses.php` (~83KB).
92
+ - [Observed | Medium] No `declare(strict_types=1)` in core. PHP type hints are used inconsistently; newer code uses typed parameters and return types, legacy code does not.
93
+ Evidence: comparison of `wp-includes/plugin.php` (no types) vs `wp-includes/class-wp-block-metadata-registry.php` (has types).
94
+
95
+ ## Extension Points (Modules/Themes/Plugins/Hooks)
96
+ - [Observed | High] **Plugin API**: Plugins reside in `wp-content/plugins/{plugin-name}/`. Main file requires a standard header comment (`Plugin Name`, `Version`, `Description`, etc.). Lifecycle hooks: `register_activation_hook()`, `register_deactivation_hook()`, `register_uninstall_hook()`.
97
+ Evidence: `wp-includes/plugin.php:763-1022`.
98
+ - [Observed | High] **Hook System**: `WP_Hook` class manages callbacks with priority ordering. Core functions: `add_action()`, `do_action()`, `add_filter()`, `apply_filters()`, `remove_action()`, `remove_filter()`, `has_action()`, `has_filter()`.
99
+ Evidence: `wp-includes/plugin.php`, `wp-includes/class-wp-hook.php` (~16KB).
100
+ - [Observed | High] **Must-Use Plugins**: Files in `wp-content/mu-plugins/` are auto-loaded before regular plugins. No activation needed. Loaded in alphabetical order.
101
+ Evidence: `wp-settings.php:468-482`.
102
+ - [Observed | High] **Theme System**: Themes in `wp-content/themes/{theme-name}/`. Required files: `style.css` (with header), `index.php`. Optional: `functions.php`, `template-parts/`, `patterns/`, `parts/`, `templates/`. Child themes inherit from parent via `Template:` header.
103
+ Evidence: `wp-includes/class-wp-theme.php` (~65KB), `wp-includes/theme.php` (~135KB).
104
+ - [Observed | High] **Block Registration**: Blocks registered via `register_block_type()` with `block.json` manifest. Supports server-side rendering, editor/front-end scripts, styles, and attributes schema.
105
+ Evidence: `wp-includes/blocks.php` (~114KB), `wp-includes/class-wp-block-type.php`.
106
+ - [Observed | High] **Shortcode API**: `add_shortcode()`, `do_shortcode()`. Used for embedding dynamic content in post content via `[shortcode]` syntax.
107
+ Evidence: `wp-includes/shortcodes.php` (~24KB).
108
+ - [Observed | High] **Widget System**: `WP_Widget` base class. Register via `register_widget()`. Displayed in sidebars/widget areas registered with `register_sidebar()`.
109
+ Evidence: `wp-includes/class-wp-widget.php`, `wp-includes/widgets.php` (~71KB).
110
+ - [Observed | High] **Customizer API**: `WP_Customize_Manager` provides live-preview theme options. Panels, sections, settings, controls. Register via `customize_register` action.
111
+ Evidence: `wp-includes/class-wp-customize-manager.php` (~203KB).
112
+ - [Observed | High] **Drop-in replacements**: Special files in `wp-content/` that replace core components: `advanced-cache.php`, `db.php`, `object-cache.php`, `sunrise.php`, `maintenance.php`.
113
+ Evidence: `wp-settings.php:98-100` (advanced-cache), `:136` (db.php via `require_wp_db()`).
114
+
115
+ ## API and Interaction Surfaces
116
+ - [Observed | High] **REST API**: Prefix `/wp-json/wp/v2/`. 40+ built-in endpoint controllers covering posts, pages, media, users, comments, taxonomies, terms, menus, blocks, templates, widgets, settings, fonts, search, and more. Custom endpoints via `register_rest_route()`.
117
+ Evidence: `wp-settings.php:294-341`, `wp-includes/rest-api.php` (~100KB).
118
+ - [Observed | High] **AJAX API**: `admin-ajax.php` endpoint. Hooks: `wp_ajax_{action}` (authenticated), `wp_ajax_nopriv_{action}` (public). Nonce verification via `check_ajax_referer()`.
119
+ Evidence: `wp-admin/admin-ajax.php`.
120
+ - [Observed | High] **XML-RPC**: Legacy remote API at `xmlrpc.php`. `WP_XMLRPC_Server` class (~215KB). Can be disabled via `xmlrpc_enabled` filter.
121
+ Evidence: `xmlrpc.php`, `wp-includes/class-wp-xmlrpc-server.php`.
122
+ - [Observed | High] **WP-CLI**: External tool (not bundled) but widely used. Commands follow `wp {command} {subcommand}` pattern. Custom commands via `WP_CLI::add_command()`.
123
+ - [Observed | High] **WP-Cron**: Pseudo-cron system triggered by page loads. Schedule events via `wp_schedule_event()`, `wp_schedule_single_event()`. Hook callbacks via `add_action()`.
124
+ Evidence: `wp-cron.php`, `wp-includes/cron.php` (~42KB).
125
+ - [Observed | High] **Application Passwords**: Built-in API authentication. Users can create application-specific passwords for REST API/XML-RPC access.
126
+ Evidence: `wp-includes/class-wp-application-passwords.php` (~17KB).
127
+ - [Observed | High] **Sitemap API**: Built-in XML sitemaps. Providers for posts, taxonomies, users. Custom providers via `wp_sitemaps_add_provider()`.
128
+ Evidence: `wp-includes/sitemaps/` directory (10 files).
129
+
130
+ ## Data Model and State Management
131
+ - [Observed | High] **Database abstraction**: `wpdb` class. Direct SQL via `$wpdb->query()`, `$wpdb->get_results()`, `$wpdb->prepare()` (parameterized queries). Not an ORM — manual SQL with helper methods.
132
+ Evidence: `wp-includes/class-wpdb.php` (~118KB).
133
+ - [Observed | High] **Core tables** (default prefix `wp_`): `posts`, `postmeta`, `comments`, `commentmeta`, `terms`, `term_taxonomy`, `term_relationships`, `termmeta`, `users`, `usermeta`, `options`, `links`. Multisite adds: `blogs`, `site`, `sitemeta`, `blogmeta`, `signups`, `registration_log`.
134
+ Evidence: `wp-admin/includes/schema.php`, `wp-includes/class-wpdb.php`.
135
+ - [Observed | High] **EAV pattern for metadata**: `postmeta`, `usermeta`, `commentmeta`, `termmeta` tables store arbitrary key-value pairs. API: `get_post_meta()`, `update_post_meta()`, `add_post_meta()`, `delete_post_meta()` (and equivalents for other meta types).
136
+ Evidence: `wp-includes/meta.php` (~66KB).
137
+ - [Observed | High] **Options API**: Site-wide key-value store in `options` table. `get_option()`, `update_option()`, `add_option()`, `delete_option()`. Autoloaded options cached in memory.
138
+ Evidence: `wp-includes/option.php` (~105KB).
139
+ - [Observed | High] **Transients API**: Cached key-value with expiration. Uses object cache if available, falls back to `options` table. `get_transient()`, `set_transient()`, `delete_transient()`.
140
+ Evidence: `wp-includes/option.php`.
141
+ - [Observed | High] **Object Cache**: In-memory per-request cache via `WP_Object_Cache`. Can be replaced with persistent backends (Redis, Memcached) via `wp-content/object-cache.php` drop-in.
142
+ Evidence: `wp-includes/class-wp-object-cache.php`, `wp-includes/cache.php`.
143
+ - [Observed | High] **DB schema upgrades**: `wp-admin/includes/upgrade.php` runs `dbDelta()` to diff and apply schema changes. Version tracked via `db_version` option vs `$wp_db_version` constant.
144
+ Evidence: `wp-includes/version.php:26`, `wp-admin/includes/upgrade.php`.
145
+
146
+ ## Security Posture
147
+ - [Observed | High] **Nonce system**: CSRF protection via `wp_create_nonce()`, `wp_verify_nonce()`, `check_admin_referer()`, `check_ajax_referer()`. Nonces are tied to user session and action string.
148
+ Evidence: `wp-includes/pluggable.php` (nonce functions).
149
+ - [Observed | High] **Output escaping**: `esc_html()`, `esc_attr()`, `esc_url()`, `esc_js()`, `esc_textarea()`, `wp_kses()`, `wp_kses_post()`. Late escaping pattern recommended.
150
+ Evidence: `wp-includes/formatting.php` (~354KB), `wp-includes/kses.php` (~83KB).
151
+ - [Observed | High] **Input sanitization**: `sanitize_text_field()`, `sanitize_email()`, `sanitize_file_name()`, `absint()`, `intval()`. All database queries should use `$wpdb->prepare()`.
152
+ Evidence: `wp-includes/formatting.php`.
153
+ - [Observed | High] **Capabilities system**: Role-based access control. `current_user_can()`, `user_can()`. Built-in roles: `administrator`, `editor`, `author`, `contributor`, `subscriber`. Custom capabilities via `add_cap()`.
154
+ Evidence: `wp-includes/capabilities.php` (~43KB), `wp-includes/class-wp-roles.php`.
155
+ - [Observed | High] **File upload validation**: MIME type checking, file extension whitelist. `wp_check_filetype()`, `wp_handle_upload()`.
156
+ Evidence: `wp-includes/functions.php`.
157
+ - [Observed | High] **Password hashing**: Uses `phpass` library. `wp_hash_password()`, `wp_check_password()`.
158
+ Evidence: `wp-includes/class-phpass.php`, `wp-includes/pluggable.php`.
159
+
160
+ ## Integration Capability Matrix
161
+ | Domain | Entry Points | Required Adapters | Complexity | Risks | Confidence |
162
+ |---|---|---|---|---|---|
163
+ | External APIs | REST API `/wp-json/wp/v2/`, `register_rest_route()` for custom endpoints | OAuth/Application Passwords for auth, custom controller classes | Low-Medium | API exposure if not properly permissioned | High |
164
+ | Authentication/SSO | `wp_authenticate` filter, `authenticate` filter chain, Application Passwords, pluggable auth functions | SSO plugin or custom `authenticate` filter | Medium | Session handling complexity, pluggable function conflicts | High |
165
+ | Payment | No built-in payment system | WooCommerce or custom plugin with payment gateway SDK | High | PCI compliance, plugin dependency | High |
166
+ | Messaging/Queue | WP-Cron for scheduling, `wp_mail()` for email, Action Scheduler (plugin) for async jobs | Queue plugin (Action Scheduler), SMTP plugin for reliable email | Medium | WP-Cron depends on traffic, no true async queue in core | High |
167
+ | Storage/CDN | `wp_upload_dir()`, `wp_get_attachment_url()` filters, media upload hooks | CDN plugin or custom `upload_dir` / `wp_get_attachment_url` filter | Low | URL rewriting, cache invalidation | High |
168
+ | Observability | `WP_DEBUG_LOG`, `error_log()`, `do_action('shutdown')`, Query Monitor plugin | Logging plugin or custom error handler via `set_error_handler` | Low-Medium | No structured logging in core, debug log is flat file | Medium |
169
+ | Admin/UI customization | `admin_menu`, `add_meta_box()`, `admin_enqueue_scripts`, Settings API, Custom admin pages | Standard WordPress admin hooks | Low | Hook conflicts with other plugins, admin UI consistency | High |
170
+ | Content/data migration | WXR export/import, REST API bulk operations, `wp_insert_post()`, `wpdb` direct queries | WP-CLI for bulk operations, custom importer plugin | Medium | Post meta mapping, attachment migration, serialized data | High |
171
+ | Theme/template | Template hierarchy, `get_template_part()`, child themes, `theme.json`, block templates | Standard theme development patterns | Low | Theme switching breaks customizations, widget areas differ | High |
172
+
173
+ ## Strengths, Weaknesses, Risks
174
+ - [Observed | High] **Strength**: Unmatched extensibility via hooks/filters — virtually every behavior can be modified without touching core.
175
+ Evidence: `wp-includes/default-filters.php` (~37KB of hook registrations), `wp-includes/plugin.php`.
176
+ - [Observed | High] **Strength**: Massive ecosystem — 60,000+ plugins, 10,000+ themes, extensive documentation, huge community.
177
+ - [Observed | High] **Strength**: Built-in REST API with comprehensive coverage of all content types.
178
+ Evidence: `wp-includes/rest-api/endpoints/` (40+ controllers).
179
+ - [Observed | Medium] **Weakness**: No true dependency injection or service container — relies on global state (`$wpdb`, `$wp_query`, `$wp_filter`, etc.).
180
+ Evidence: `wp-settings.php` (extensive use of `$GLOBALS`).
181
+ - [Observed | Medium] **Weakness**: WP-Cron is pseudo-cron triggered by page loads — unreliable for time-critical scheduled tasks without external cron trigger.
182
+ Evidence: `wp-cron.php`.
183
+ - [Observed | Medium] **Weakness**: EAV metadata pattern (postmeta/usermeta) causes performance issues at scale due to JOIN-heavy queries.
184
+ Evidence: `wp-includes/class-wp-meta-query.php`.
185
+ - [Observed | High] **Risk**: Plugin/theme conflicts via shared hook namespace. No isolation between extensions.
186
+ Mitigation: Unique function/class prefixes, namespace usage in modern plugins.
187
+ - [Observed | High] **Risk**: `wp-config.php` contains database credentials and auth keys in plain PHP.
188
+ Mitigation: Restrict file permissions, move above web root if possible.
189
+
190
+ ## Top 10 Evidence Items
191
+ 1. [Observed | High] Hook System Core
192
+ File: `wp-includes/plugin.php`, `wp-includes/class-wp-hook.php`
193
+ Summary: `add_filter`, `apply_filters`, `add_action`, `do_action` — the foundation of ALL WordPress extensibility.
194
+ 2. [Observed | High] Bootstrap Sequence
195
+ File: `wp-settings.php` (765 lines)
196
+ Summary: Orchestrates entire WordPress load: constants → error handling → hook system → cache → mu-plugins → plugins → theme → init.
197
+ 3. [Observed | High] REST API Surface
198
+ File: `wp-includes/rest-api/endpoints/` (40+ controller classes)
199
+ Summary: Full CRUD API for posts, media, users, terms, menus, blocks, templates, widgets, fonts, settings.
200
+ 4. [Observed | High] Database Abstraction
201
+ File: `wp-includes/class-wpdb.php` (~118KB)
202
+ Summary: `wpdb` class — prepare(), query(), get_results(), insert(), update(), delete(). MySQL/MariaDB only.
203
+ 5. [Observed | High] Query Engine
204
+ File: `wp-includes/class-wp-query.php` (~163KB)
205
+ Summary: `WP_Query` — THE content retrieval engine. Handles posts, pages, CPTs, taxonomies, meta queries, date queries, pagination.
206
+ 6. [Observed | High] Theme System
207
+ File: `wp-includes/class-wp-theme.php` (~65KB), `wp-includes/theme.php` (~135KB)
208
+ Summary: Template hierarchy resolution, child theme inheritance, theme.json support, block template discovery.
209
+ 7. [Observed | High] Block System
210
+ File: `wp-includes/blocks.php` (~114KB), `wp-includes/class-wp-block-type.php`
211
+ Summary: `register_block_type()`, block.json parsing, server-side rendering, block supports, block patterns/categories.
212
+ 8. [Observed | High] Default Filters
213
+ File: `wp-includes/default-filters.php` (~37KB)
214
+ Summary: All core hook registrations — content filters, sanitization, formatting, REST API init, widget init, cron schedules.
215
+ 9. [Observed | High] Security Functions
216
+ File: `wp-includes/pluggable.php` (~127KB), `wp-includes/kses.php` (~83KB)
217
+ Summary: Nonces, password hashing, auth cookies, email, user authentication — all overridable via pluggable pattern.
218
+ 10. [Observed | High] Rewrite System
219
+ File: `wp-includes/class-wp-rewrite.php` (~63KB)
220
+ Summary: Pretty permalink generation, custom rewrite rules, endpoint registration, flush_rewrite_rules().
221
+
222
+ ## Plugin Development Quick Reference
223
+ ### Minimum Plugin Structure
224
+ ```
225
+ my-plugin/
226
+ ├── my-plugin.php # Main file with plugin header
227
+ ├── includes/ # PHP classes and functions
228
+ ├── admin/ # Admin-specific code
229
+ ├── public/ # Front-end code
230
+ ├── languages/ # Translation files (.pot, .po, .mo)
231
+ ├── assets/
232
+ │ ├── css/
233
+ │ ├── js/
234
+ │ └── images/
235
+ ├── templates/ # Template files
236
+ ├── readme.txt # WordPress.org plugin directory readme
237
+ └── uninstall.php # Cleanup on uninstall
238
+ ```
239
+
240
+ ### Essential Plugin Header
241
+ ```php
242
+ <?php
243
+ /**
244
+ * Plugin Name: My Plugin
245
+ * Plugin URI: https://example.com/my-plugin
246
+ * Description: A brief description.
247
+ * Version: 1.0.0
248
+ * Author: Author Name
249
+ * Author URI: https://example.com
250
+ * License: GPL-2.0+
251
+ * Text Domain: my-plugin
252
+ * Domain Path: /languages
253
+ * Requires at least: 6.0
254
+ * Requires PHP: 7.4
255
+ */
256
+ ```
257
+
258
+ ### Key Plugin Patterns
259
+ ```php
260
+ // Hook into WordPress
261
+ add_action('init', 'myplugin_init');
262
+ add_filter('the_content', 'myplugin_filter_content');
263
+
264
+ // Register Custom Post Type
265
+ register_post_type('book', [...]);
266
+
267
+ // Register REST API endpoint
268
+ add_action('rest_api_init', function() {
269
+ register_rest_route('myplugin/v1', '/data', [...]);
270
+ });
271
+
272
+ // Enqueue scripts/styles
273
+ add_action('wp_enqueue_scripts', function() {
274
+ wp_enqueue_style('myplugin-style', plugins_url('css/style.css', __FILE__));
275
+ wp_enqueue_script('myplugin-script', plugins_url('js/script.js', __FILE__), ['jquery'], '1.0', true);
276
+ });
277
+
278
+ // Admin menu
279
+ add_action('admin_menu', function() {
280
+ add_menu_page('My Plugin', 'My Plugin', 'manage_options', 'my-plugin', 'myplugin_admin_page');
281
+ });
282
+
283
+ // Activation/Deactivation
284
+ register_activation_hook(__FILE__, 'myplugin_activate');
285
+ register_deactivation_hook(__FILE__, 'myplugin_deactivate');
286
+ ```
287
+
288
+ ## Theme Development Quick Reference
289
+ ### Classic Theme Structure
290
+ ```
291
+ my-theme/
292
+ ├── style.css # Theme header + styles
293
+ ├── index.php # Fallback template
294
+ ├── functions.php # Theme setup, hooks, enqueues
295
+ ├── header.php # <head> and opening body
296
+ ├── footer.php # Footer and closing body
297
+ ├── sidebar.php # Sidebar widget area
298
+ ├── single.php # Single post template
299
+ ├── page.php # Page template
300
+ ├── archive.php # Archive listing
301
+ ├── search.php # Search results
302
+ ├── 404.php # Not found page
303
+ ├── comments.php # Comment display
304
+ ├── screenshot.png # Theme preview (1200x900)
305
+ └── template-parts/ # Reusable template partials
306
+ ```
307
+
308
+ ### Block Theme (FSE) Structure
309
+ ```
310
+ my-block-theme/
311
+ ├── style.css # Theme header
312
+ ├── theme.json # Design tokens, settings, styles
313
+ ├── templates/ # Block-based templates (HTML)
314
+ │ ├── index.html
315
+ │ ├── single.html
316
+ │ ├── page.html
317
+ │ └── archive.html
318
+ ├── parts/ # Template parts
319
+ │ ├── header.html
320
+ │ └── footer.html
321
+ ├── patterns/ # Block patterns
322
+ ├── assets/
323
+ │ ├── fonts/
324
+ │ └── images/
325
+ └── functions.php # Optional: enqueues, registrations
326
+ ```
327
+
328
+ ## WordPress Lifecycle Hooks (Execution Order)
329
+ ```
330
+ muplugins_loaded → After must-use plugins load
331
+ plugins_loaded → After all active plugins load
332
+ setup_theme → Before theme functions.php loads
333
+ after_setup_theme → After theme functions.php loads
334
+ init → WordPress fully initialized (register CPT/taxonomy here)
335
+ wp_loaded → Everything loaded, before headers sent
336
+ admin_init → Admin-only init (after init)
337
+ admin_menu → Register admin menu items
338
+ wp → After WP object setup, before template
339
+ template_redirect → Before template selection (redirects here)
340
+ wp_enqueue_scripts → Enqueue front-end scripts/styles
341
+ wp_head → Inside <head> tag
342
+ wp_footer → Before </body> tag
343
+ shutdown → PHP shutdown handler
344
+ ```
345
+
346
+ ## Unknowns and Verification Plan
347
+ - [Assumed | Medium] Plugin compatibility with specific PHP 8.x strict mode features varies widely per plugin.
348
+ Verification: Test with `WP_DEBUG=true` and PHP 8.x in staging.
349
+ - [Assumed | Medium] WP-Cron reliability depends on traffic volume and hosting configuration.
350
+ Verification: Set up system cron (`wget -q -O - https://example.com/wp-cron.php`) and disable `DISABLE_WP_CRON`.
351
+ - [Assumed | Low] Multisite-specific behaviors may differ significantly from single-site installations.
352
+ Verification: Test in multisite environment if cross-site features are needed.
353
+
354
+ ## Recommended Next Actions (30/60/90 day)
355
+ - [30 days | High priority]
356
+ - Identify which hooks your plugin/theme needs and document them.
357
+ - Set up local development with `WP_DEBUG`, `WP_DEBUG_LOG`, `SCRIPT_DEBUG` enabled.
358
+ - Review WordPress Coding Standards (WPCS) and install phpcs with WordPress sniffs.
359
+ - Register Custom Post Types and Taxonomies using `init` hook.
360
+ - [60 days | Medium priority]
361
+ - Implement REST API custom endpoints for any AJAX functionality.
362
+ - Set up i18n: wrap strings with `__()`, `_e()`, `esc_html__()`, generate `.pot` file.
363
+ - Create block patterns or custom blocks with `block.json` if using Block Editor.
364
+ - Implement proper uninstall cleanup (database tables, options, transients).
365
+ - [90 days | Medium priority]
366
+ - Performance optimization: implement object caching, review query efficiency.
367
+ - Security audit: verify nonce usage, capability checks, escaping, and sanitization.
368
+ - Create automated tests with `WP_UnitTestCase` and `wp-env`.
369
+ - Submit to WordPress.org Plugin Directory if applicable (follow Plugin Guidelines).
@@ -0,0 +1,65 @@
1
+ {
2
+ "version": "1.0",
3
+ "description": "HeRaSpec Knowledge Base — Pre-analyzed profiles for frameworks, APIs, and platforms",
4
+ "categories": ["frameworks", "apis", "platforms"],
5
+ "entries": [
6
+ {
7
+ "id": "php-laravel-botble",
8
+ "category": "frameworks",
9
+ "runtime": "php",
10
+ "framework": "laravel",
11
+ "cms": "botble",
12
+ "frameworkVersion": "^13.0",
13
+ "runtimeVersion": "^8.3",
14
+ "matchSignals": [
15
+ { "type": "file-contains", "file": "composer.json", "contains": "botble" },
16
+ { "type": "file-contains", "file": "composer.json", "contains": "laravel/framework" },
17
+ { "type": "directory-exists", "path": "platform/core" },
18
+ { "type": "directory-exists", "path": "platform/plugins" }
19
+ ],
20
+ "minMatchScore": 3,
21
+ "knowledgePath": "frameworks/php/laravel/botble",
22
+ "files": ["profile.json", "structure.md"],
23
+ "lastUpdated": "2026-04-04"
24
+ },
25
+ {
26
+ "id": "php-codeigniter-rise-cms",
27
+ "category": "frameworks",
28
+ "runtime": "php",
29
+ "framework": "codeigniter",
30
+ "cms": "rise-cms",
31
+ "frameworkVersion": "^4.0",
32
+ "runtimeVersion": "^8.1",
33
+ "matchSignals": [
34
+ { "type": "file-contains", "file": "index.php", "contains": "CodeIgniter\\Boot::bootWeb()" },
35
+ { "type": "file-contains", "file": "app/Config/Rise.php", "contains": "app_version" },
36
+ { "type": "directory-exists", "path": "plugins" },
37
+ { "type": "directory-exists", "path": "app/Controllers" }
38
+ ],
39
+ "minMatchScore": 3,
40
+ "knowledgePath": "frameworks/php/codeigniter/rise-cms",
41
+ "files": ["profile.json", "structure.md"],
42
+ "lastUpdated": "2026-04-04"
43
+ },
44
+ {
45
+ "id": "php-wordpress-core",
46
+ "category": "frameworks",
47
+ "runtime": "php",
48
+ "framework": "wordpress",
49
+ "cms": "wordpress",
50
+ "frameworkVersion": "^6.0",
51
+ "runtimeVersion": ">=7.2.24",
52
+ "matchSignals": [
53
+ { "type": "file-contains", "file": "wp-includes/version.php", "contains": "$wp_version" },
54
+ { "type": "file-contains", "file": "wp-config.php", "contains": "DB_NAME" },
55
+ { "type": "directory-exists", "path": "wp-content" },
56
+ { "type": "directory-exists", "path": "wp-includes" },
57
+ { "type": "directory-exists", "path": "wp-admin" }
58
+ ],
59
+ "minMatchScore": 3,
60
+ "knowledgePath": "frameworks/php/wordpress/core",
61
+ "files": ["profile.json", "structure.md"],
62
+ "lastUpdated": "2026-05-03"
63
+ }
64
+ ]
65
+ }
@@ -1,110 +1,110 @@
1
- # Skill: Module Codebase (Perfex Module)
2
-
3
- ## Purpose
4
-
5
- This skill is used to create and manage codebase structure for Perfex CRM modules following Perfex best practices.
6
-
7
- ## When to Use
8
-
9
- - When creating a new module for Perfex CRM
10
- - When refactoring existing module structure
11
- - When ensuring module follows Perfex conventions
12
- - When creating standard folder and file structure for module
13
-
14
- ## Step-by-Step Process
15
-
16
- ### Step 1: Analyze Requirements
17
- - Identify main functionality of module
18
- - Identify required database tables
19
- - Identify hooks and filters to use
20
- - Identify permissions to create
21
-
22
- ### Step 2: Scaffold Structure
23
- - Run script: `scripts/scaffold-module.sh <module-name>`
24
- - Script will create standard folder structure:
25
- - `modules/<module-name>/`
26
- - `modules/<module-name>/controllers/`
27
- - `modules/<module-name>/models/`
28
- - `modules/<module-name>/views/`
29
- - `modules/<module-name>/language/`
30
- - `modules/<module-name>/assets/`
31
- - Copy templates to correct locations
32
-
33
- ### Step 3: Configure Module
34
- - Fill information in `module-config.php` (from template)
35
- - Register module in Perfex system
36
- - Set up permissions and menu items
37
-
38
- ### Step 4: Implement Core Logic
39
- - Create controllers following Perfex structure
40
- - Create models with Eloquent patterns
41
- - Implement hooks and filters
42
- - Create database migrations
43
-
44
- ### Step 5: Testing & Documentation
45
- - Test module with Perfex core
46
- - Write documentation (use documents skill)
47
- - Create user guide (use documents skill)
48
-
49
- ## Required Input
50
-
51
- - **Module name**: Module name (kebab-case, e.g., `category-management`)
52
- - **Module description**: Module functionality description
53
- - **Database tables**: List of tables to create
54
- - **Hooks required**: List of hooks to implement
55
- - **Permissions**: List of permissions to create
56
- - **Menu items**: List of menu items to add
57
-
58
- ## Expected Output
59
-
60
- - Complete module folder structure
61
- - Fully configured files
62
- - Database migrations
63
- - Module registration code
64
- - Basic documentation structure
65
-
66
- ## Tone & Rules
67
-
68
- ### Code Style
69
- - Follow PSR-12 coding standards
70
- - Use camelCase for functions
71
- - Use PascalCase for classes
72
- - Comment in English
73
-
74
- ### Naming Conventions
75
- - Module folder: `perfex-<module-name>`
76
- - Class names: `Perfex<ModuleName>`
77
- - Function names: `perfex_<module_name>_<action>`
78
- - Database tables: `tbl<ModuleName>`
79
-
80
- ### Limitations
81
- - ❌ DO NOT create global functions (except hooks)
82
- - ❌ DO NOT hardcode database credentials
83
- - ❌ DO NOT bypass Perfex permission system
84
- - ❌ DO NOT modify core Perfex files
85
- - ❌ DO NOT use deprecated Perfex APIs
86
-
87
- ## Available Templates
88
-
89
- - `templates/module-structure.php` - Basic module structure
90
- - `templates/module-config.php` - Module configuration file
91
- - `templates/module-hooks.php` - Template for hooks
92
- - `templates/module-migration.php` - Database migration template
93
-
94
- ## Available Scripts
95
-
96
- - `scripts/scaffold-module.sh` - Automatically create module structure
97
-
98
- ## Examples
99
-
100
- See `examples/` directory for reference:
101
- - `good-module-structure/` - Example of well-organized module
102
- - `bad-module-structure/` - Example to avoid
103
-
104
- ## Links to Other Skills
105
-
106
- - **documents**: Use to create technical docs and user guide
107
- - **ui-ux**: Use when module has admin interface
108
- - **content-optimization**: Use for module marketing pages
109
- - **module-registration**: Use to register module with Perfex
110
- - **permission-group**: Use to create permissions for module
1
+ # Skill: Module Codebase (Perfex Module)
2
+
3
+ ## Purpose
4
+
5
+ This skill is used to create and manage codebase structure for Perfex CRM modules following Perfex best practices.
6
+
7
+ ## When to Use
8
+
9
+ - When creating a new module for Perfex CRM
10
+ - When refactoring existing module structure
11
+ - When ensuring module follows Perfex conventions
12
+ - When creating standard folder and file structure for module
13
+
14
+ ## Step-by-Step Process
15
+
16
+ ### Step 1: Analyze Requirements
17
+ - Identify main functionality of module
18
+ - Identify required database tables
19
+ - Identify hooks and filters to use
20
+ - Identify permissions to create
21
+
22
+ ### Step 2: Scaffold Structure
23
+ - Run script: `scripts/scaffold-module.sh <module-name>`
24
+ - Script will create standard folder structure:
25
+ - `modules/<module-name>/`
26
+ - `modules/<module-name>/controllers/`
27
+ - `modules/<module-name>/models/`
28
+ - `modules/<module-name>/views/`
29
+ - `modules/<module-name>/language/`
30
+ - `modules/<module-name>/assets/`
31
+ - Copy templates to correct locations
32
+
33
+ ### Step 3: Configure Module
34
+ - Fill information in `module-config.php` (from template)
35
+ - Register module in Perfex system
36
+ - Set up permissions and menu items
37
+
38
+ ### Step 4: Implement Core Logic
39
+ - Create controllers following Perfex structure
40
+ - Create models with Eloquent patterns
41
+ - Implement hooks and filters
42
+ - Create database migrations
43
+
44
+ ### Step 5: Testing & Documentation
45
+ - Test module with Perfex core
46
+ - Write documentation (use documents skill)
47
+ - Create user guide (use documents skill)
48
+
49
+ ## Required Input
50
+
51
+ - **Module name**: Module name (kebab-case, e.g., `category-management`)
52
+ - **Module description**: Module functionality description
53
+ - **Database tables**: List of tables to create
54
+ - **Hooks required**: List of hooks to implement
55
+ - **Permissions**: List of permissions to create
56
+ - **Menu items**: List of menu items to add
57
+
58
+ ## Expected Output
59
+
60
+ - Complete module folder structure
61
+ - Fully configured files
62
+ - Database migrations
63
+ - Module registration code
64
+ - Basic documentation structure
65
+
66
+ ## Tone & Rules
67
+
68
+ ### Code Style
69
+ - Follow PSR-12 coding standards
70
+ - Use camelCase for functions
71
+ - Use PascalCase for classes
72
+ - Comment in English
73
+
74
+ ### Naming Conventions
75
+ - Module folder: `perfex-<module-name>`
76
+ - Class names: `Perfex<ModuleName>`
77
+ - Function names: `perfex_<module_name>_<action>`
78
+ - Database tables: `tbl<ModuleName>`
79
+
80
+ ### Limitations
81
+ - ❌ DO NOT create global functions (except hooks)
82
+ - ❌ DO NOT hardcode database credentials
83
+ - ❌ DO NOT bypass Perfex permission system
84
+ - ❌ DO NOT modify core Perfex files
85
+ - ❌ DO NOT use deprecated Perfex APIs
86
+
87
+ ## Available Templates
88
+
89
+ - `templates/module-structure.php` - Basic module structure
90
+ - `templates/module-config.php` - Module configuration file
91
+ - `templates/module-hooks.php` - Template for hooks
92
+ - `templates/module-migration.php` - Database migration template
93
+
94
+ ## Available Scripts
95
+
96
+ - `scripts/scaffold-module.sh` - Automatically create module structure
97
+
98
+ ## Examples
99
+
100
+ See `examples/` directory for reference:
101
+ - `good-module-structure/` - Example of well-organized module
102
+ - `bad-module-structure/` - Example to avoid
103
+
104
+ ## Links to Other Skills
105
+
106
+ - **documents**: Use to create technical docs and user guide
107
+ - **ui-ux**: Use when module has admin interface
108
+ - **content-optimization**: Use for module marketing pages
109
+ - **module-registration**: Use to register module with Perfex
110
+ - **permission-group**: Use to create permissions for module