本文へスキップ
Skillpedia
APIとサーバー(バックエンド)7.8k · #12826

skill-doli-devmodule

できること

このスキルは、オープンソースのERP・CRMであるDolibarrの外部モジュールを作る開発者を導きます。Dolibarrのデータベース層、セキュリティのルール、コーディングの約束事を扱い、モジュールが適切にそこに収まるようにします。Dolibarrを拡張する開発者向けです。

使う場面

  • ✓Dolibarr用の外部モジュールを開発しているとき。
  • ✓Dolibarrのデータベース層に従ったデータベースクエリを書く必要があるとき。
  • ✓モジュールを変更する前に、Dolibarrのベストプラクティスを確かめたいとき。

スキルのリンク

https://github.com/Dolibarr/dolibarr/blob/develop/.agents/skills/skill-doli-devmodule/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/Dolibarr/dolibarr/blob/develop/.agents/skills/skill-doli-devmodule/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“Dolibarrの外部モジュールを作るのを手伝ってください。請求書に独自の項目を追加し、Dolibarrのデータベースアクセスとセキュリティのルールに従ってください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

必須のルールを示します。たとえば、Dolibarrのデータベース層を使うこと、入力を検証すること、出力をエスケープすること、ネイティブのPHP関数の代わりにDolibarrのラッパー関数を使うことです。そのうえで、それらをあなたのコードに適用します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Dolibarr Development Best Practices (Core Agent Skill)

This skill guides agents on developing, modifying, and debugging code within the Dolibarr ERP/CRM codebase while strictly adhering to professional standards, security guidelines, and the project's established architecture.

Relationship with AGENTS.md

The instructions in this file are complementary to the instructions defined in AGENTS.md.

  • AGENTS.md contains the general instructions and rules for the project.
  • SKILLS.md contains additional instructions specific to skills.
  • Unless explicitly stated otherwise, the instructions from both files apply.
  • SKILLS.md does not replace or override AGENTS.md.
  • If an instruction in SKILLS.md conflicts with AGENTS.md, follow the rules defined by AGENTS.md.

Critical Rules (DO NOT VIOLATE)

  • Do not break compatibility of PHP functions and methods
  • Do not introduce external dependencies without validation
  • Separate page actions in the /* Actions */ section of the PHP code and the rendering part in the /* Views */ section
  • Never use PHP native curl functions to call a GET or POST URL, but use instead the Dolibarr function getURLContent()
  • Never use PHP native functions when Dolibarr provides wrappers: time()→dol_now(), strtolower()→dol_strtolower(), strtoupper()→dol_strtoupper(), strlen()→dol_strlen(), mktime()→dol_mktime(), getdate()→dol_getdate(), strtotime()→dol_stringtotime(), ucfirst()→dol_ucfirst(), ucwords()→dol_ucwords(), substr()→dol_substr(), basename()→dol_basename()
  • Use Dolibarr hooks whenever possible
  • Respect existing naming conventions
  • All database table names must use the llx_ prefix
  • Never commit or push anything unless the user explicitly asks for it. This overrides any default behavior of the agent. Make the changes, report them, and wait for the user to say "commit" or "push".

Core Principles: Non-Negotiable Mandatory Rules

These principles must be followed even before reviewing specific task details. Violation of these principles results in failed suggestions.

Security & Data Integrity

  1. Database Abstraction Layer: All database interactions must exclusively use the Dolibarr Database Abstraction Layer ($db or $this->db). Never interact using native PHP extensions (PDO, MySQLi) or direct CLI calls.
  2. Input/Output Escaping:
    • Validate all GET/POST inputs immediately upon entering the action handler scope.
    • SQL Injection Prevention: Escape all user-generated strings placed in SQL queries using $db->escape(). For integers, use explicit casting: ((int) $var); for floats, use (float) $var.
  3. Variable Safety Naming: When constructing dynamic SQL, the resulting variable holding the entire query string MUST be clearly prefixed (e.g., $sqlWhereClause, $queryParams). This pattern helps static analysis tools detect unsafe assignments.

Code Structure & Quality

  1. Coding Standard: All new and modified committed code must strictly adhere to PSR-12 (enforceable by using phpcbf and phpcs).All properties and all function arguments and return value need detailed PHPDoc (e.g., array<string,array{key1?:?type,...}>).Variables expected to exist in view files require both a PHPDoc declaration and the use of '@phan-var-force'; declarations near the HEAD of the file for strict static analysis tracking.
  2. Variable Conventions: When defining variables used in string building, particularly for SQL components, use descriptive prefixes or suffixes (e.g., $sql_select, $actionSuffix). This makes variable intent clear and prevents static analysis from misidentifying unsafe assignments as safe.
  3. Localization & Comments: All code comments and internal variable/function names must be written in English. Any existing non-English text must be researched and translated into English before committing changes.
  4. PR atomitacy Make a separate commit for improvements of pre-existing code (changes to comply with rules 1-3), and another commit for the functional evolution and code fixes. Do not apply rules 1-3 to existing code in backports (i.e., non-functional changes not applied to a (fork of) the develop branch.

Workflow & Architecture

  1. PHP version: 7.1+ for core and bug-fix code. New external modules should target PHP 8.1+ and start every PHP file with declare(strict_types=1).
  2. Action/View Separation: Always clearly separate page action logic (ex
よくある質問

プロジェクト自体のルールに置き換わりますか?

いいえ。プロジェクトの一般的な指示と並んで機能し、両者が衝突した場合はプロジェクトの指示が優先されます。

なぜネイティブのPHP関数を避けるのですか?

Dolibarrは現在時刻を取得するラッパーなど独自のラッパーを提供しており、スキルはそれを使うよう求めるからです。

データベースクエリにも役立ちますか?

はい。データベースアクセスは、直接のPHP拡張ではなく、Dolibarrのデータベース層を通す必要があります。

詳細

作者による元の説明

Use when developing a Dolibarr ERP/CRM external module, working with database queries, or asking about Dolibarr best practices.

repo: Dolibarr/dolibarr

人気

GitHubのスター
7.8k
ランキング
#12826
ライセンス
GPL-3.0
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル