SuperAPI AI Directory

basercms5-development

Coding & development

View repository

Updated 10-16 08:05

About this skill

Development rules for baserCMS 5 series (CakePHP 5.0.5 series) + jQuery projects

This project is developed according to the following technology stack and design policy.

The 5 series skills have a three-layer structure, and this skill handles the **common base (environment, directory structure, naming, logging, prohibition of core hacks, server constraints)**. The authoritative source for implementation patterns is the field-specific skills: Plugin development/modification → basercms5-plugin-development、Theme development/modification → basercms5-theme-development、4→5 migration work → basercms4-to-5-upgrade(including the field-specific migration skills under it).

Recommended: Before starting 5 series development, refer once to basercms5-claude-workflow-setup(environment setup) to prepare the development environment (design = superpowers brainstorming / permission organization = permissions-audit / Auto mode on top of that / Markdown preview of spec and plan). This is a suggestion, and you can skip it if it is already in place.


Technologies used

  • baserCMS 5 series is used (internally, CakePHP 5.0.5 base)
  • Backend: PHP 8.1.5 to 8.2 / CakePHP 5.0.5
  • Database: MySQL 5.7 to 8.0
  • Frontend: jQuery 1.x to 3.x (multiple versions may be mixed within the project)
  • HTTP server: Apache (mod_rewrite enabled)

Directory structure rules

  • While the MVC structure conforms to CakePHP 5.0.5,baserCMS is mainly built on a plugin-by-plugin basis
    • htdocs/plugins/{Plugin名}/Controller/, Model/, View/ are placed in each
  • Common parts (header, footer, etc.) areplaced in the Elements/ directory within the theme
    • Mainly:htdocs/{テーマ名}/templates/element/
  • Layouts are also placed within the theme
    • Mainly:htdocs/{テーマ名}/templates/layout/
    • $this->layout can be switched by
  • Admin screen systems are controlled by /admin/ prefix URL routing
    • Files used:htdocs/config/.env
    • Definitions:export ADMIN_PREFIX="admin"

Coding policy (specific to baserCMS 5)

Please also refer to the coding policy in the common rules.

  • Function-based and procedural code is used more often than class-based
  • JavaScript is written inside the <script> tag in View files or in .js files
  • Ajax communication is performed using jQuery ($.ajax())
  • Do not use ES6 syntax (Promise, fetch, import/export)
  • SPA technologies such as React and Vue are not introduced for frontend implementation
    • There are some places where they are partially used

Naming conventions (specific to baserCMS 5)

Please also refer to the naming conventions in the common rules.

※ Follow baserCMS and CakePHP naming conventions (Controller, Helper, Model, etc.) as-is


Logging and error handling policy (specific to baserCMS5)

Please also refer to the logging and error handling policy in the common rules.

Purpose: /log Improve the accuracy of suggestions when implementing aliases and exception handling

Implementation methods specific to baserCMS5

  • In PHP, CakeLog::error() or error_log() use
  • In JavaScript, console.error() as a temporary measure, and consider server-side sending for the final implementation

Implementation example (described in the configuration file for baserCMS):

/**
 * 専用ログ
 */
if (!defined('PROJECT_PLUGIN_ACTION')) {
	define('PROJECT_PLUGIN_ACTION', 'project_plugin_action');
	CakeLog::config('project_plugin_action', [
		'engine' => 'FileLog',
		'types' => ['project_plugin_action'],
		'file' => 'project_plugin_action',
		'size' => '5MB',
		'rotate' => 5,
	]);
}

// ログを取りたい箇所に記述する
$this->log('Start', PROJECT_PLUGIN_ACTION);
$this->log(print_r($array, true), PROJECT_PLUGIN_ACTION);

Libraries and helpers used

  • BcBaserHelper, BcFormHelper, BcHtmlHelper utilize baserCMS-specific helpers such as
  • For HTML output, use $this->BcBaser->css(), $this->BcBaser->img() etc., and keep hand-written code to a minimum

The authoritative source for implementation patterns is in the field-specific skills

Concrete implementation patterns (including key points and pitfalls) are consolidated in the authoritative field-specific skills.

  • Plugin development(Table/Entity, controllers, admin panel forms, events, Vue/JS, etc.) → basercms5-plugin-development
  • Theme development(layout/element, widgets, mail form templates, assets) → basercms5-theme-development

For the 4→5 migration work itself, refer to basercms4-to-5-upgrade / basercms-plugin-4-to-5-upgrade / basercms-theme-4-to-5-upgrade .


Rules for handling files and directories

Purpose: When AI analyzes code and makes suggestions, handling things appropriately based on the following three classifications prevents unnecessary suggestions and incorrect changes.

  • Read-only: Framework core files, etc., which may be referenced but must not be modified
  • For configuration investigation: Referenced to check configuration values, but modification is prohibited

Clearly distinguish the handling of files and directories based on the following classifications.

Read-only (referenced by AI/humans but must not be altered)

  • htdocs/vendor/baserproject/(baserCMS core)
  • htdocs/vendor/cakephp/(CakePHP core)

For configuration investigation (for the purpose of understanding the contents. Used to retrieve values, etc., but modification is prohibited)

  • htdocs/config/install.php(confirmation of connection settings)
  • htdocs/config/.env.php(investigation of routing, debug settings, etc.)
  • htdocs/bin/cake(confirmation of CLI specifications)
  • htdocs/webroot/index.php, .htaccess(startup files, Rewrite settings)

Server configuration and constraints (specific to baserCMS5)

Please also refer to the server configuration and constraints in the common rules.

  • baserCMS is placed under the document root (index.php is the root)

Constraints and notes

  • Customization that conforms to baserCMS's standard configuration is the norm (core hacks prohibited)
  • No need to suggest replacing with other frameworks such as Laravel or CakePHP 5
  • No need to suggest modern JS frameworks (Vue, React, etc.)
  • When considering or making suggestions, give top priority to compatibility with and impact on the existing configuration
  • Aim for implementations that take the constraints of PHP 8.1.5 into account
  • Maintain compatibility with jQuery 1.x–3.x
  • Use SQL statements that work on both MySQL 5.7–8.0
  • Compliant with CakePHP 4. Be mindful of the separation of responsibilities between Table and Entity.
  • Validation is defined in the Table class.
  • Use Migration (phinx) for database changes.