
Craft php guidelines
Gives your agent Craft CMS 5 PHP coding standards for plugins and modules
Craft php guidelines is an open-source agent skill for developer tools. It is available on Claude Code.
- Scripts
- shell
- Platforms
- Claude Code
- GitHub stars
- 91
- Last commit
- License
- MIT
- Listing updated
Similar skills
About Craft php guidelines
This skill brings a set of house conventions for writing PHP in Craft CMS 5 plugins and modules. It covers PHPDoc blocks, section headers and class layout, naming for services, jobs, records and events, validation rules, date handling, environment variable access, and Craft::t copy rules. Reference files are split by topic, so the agent reads only the sections that match the current task.
Before editing, the skill runs a shell script to report the Craft version of the project, which the agent uses to choose version-specific advice. The guidance also includes a verification checklist covering ECS and PHPStan runs, test results and docblock completeness before a commit.
It expects a Craft CMS 5 codebase, PHP 8.2 or later, and DDEV for running the linting, static analysis and scaffolding commands it references. It is meant to complement the companion skills for Craft architecture and DDEV rather than replace them.
When your agent uses it
Craft CMS 5 PHP coding standards and conventions. ALWAYS load when writing, editing, reviewing, or discussing any PHP in a Craft plugin or module, even small edits, and when running ECS, PHPStan, or ddev craft make. Covers PHPDoc blocks (@author, @since, @throws chains), section headers (=========), class organization, naming (services, jobs, records, events, enums), defineRules(), beforePrepare() and addSelect(), MemoizableArray, DateTimeHelper vs Carbon, declare(strict_types=1), ?string nullables, early returns, CP Twig templates, form macros, Craft::t, ECS/PHPStan config, and the verification checklist.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
- Runs shell scripts(see the files on GitHub)
- Asks for: Bash(sh ${CLAUDE_SKILL_DIR}/scripts/craft-version.sh)(see the files on GitHub)
- No network calls found in its scripts(see the files on GitHub)
- License: MIT(see the files on GitHub)
From a static check of its 9 files (68 KB) on GitHub on 3 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the craftcms-claude-skills plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add michtio/craftcms-claude-skills
/plugin install craftcms-claude-skills@craftcms-claude-skillsOr copy only this skill to ~/.claude/skills/craft-php-guidelines:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/craft-php-guidelines &&
cp -R "$tmp/skills/craft-php-guidelines" ~/.claude/skills/craft-php-guidelines &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/craft-php-guidelines inside it instead.
Copy the skill folder to ~/.agents/skills/craft-php-guidelines to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/craft-php-guidelines &&
cp -R "$tmp/skills/craft-php-guidelines" ~/.agents/skills/craft-php-guidelines &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/craft-php-guidelines inside it instead.
Copy the skill folder to ~/.cursor/skills/craft-php-guidelines to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/craft-php-guidelines &&
cp -R "$tmp/skills/craft-php-guidelines" ~/.cursor/skills/craft-php-guidelines &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/craft-php-guidelines inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/michtio/craftcms-claude-skills.git --path skills/craft-php-guidelinesOr copy the folder to ~/.gemini/skills/craft-php-guidelines yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/craft-php-guidelines:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/craft-php-guidelines &&
cp -R "$tmp/skills/craft-php-guidelines" ~/.copilot/skills/craft-php-guidelines &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/craft-php-guidelines inside it instead.
Get the folder:
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.gitThen copy craftcms-claude-skills/skills/craft-php-guidelines into your agent's skills folder as craft-php-guidelines. Agents that support SKILL.md read one folder per skill.
What it does
- PHPDoc and header standards
- Rules for docblocks, @author and @since placement, @throws chains and section separators.
- Class and naming conventions
- Guidance on class ordering, visibility prefixes, and naming for services, records, jobs and events.
- Dates and environment handling
- Covers DateTimeHelper versus Carbon, parsing database datetimes, and reading env variables with App helpers.
- Authorization parity checks
- Advice on sharing one permission gate across control panel, console, GraphQL and queue surfaces.
- Tooling and verification
- Instructions for ECS, PHPStan narrowing, scaffolding commands and a pre-commit checklist.
Good for
- Review a Craft plugin controller for coding standard violations
- Write a new queue job or record class following Craft naming rules
- Set up ECS and PHPStan config for a Craft plugin repository
- Check that PHPDoc blocks and @throws chains are complete before a commit
- Replace getenv calls with App::env in plugin settings code
Craft php guidelines FAQ
Does Craft php guidelines apply to front-end Twig templates?
No. It states that front-end Twig is covered by a separate craft-twig-guidelines skill, and that template architecture and CP JavaScript belong to other skills.
Which Craft version does Craft php guidelines target?
It targets Craft CMS 5 and requires PHP 8.2 or later, as stated in its standards section.
Does Craft php guidelines need any tools installed?
It runs a shell script to detect the Craft version and references DDEV commands for ECS, PHPStan and scaffolding.
Does Craft php guidelines allow strict_types declarations in plugin files?
No. It says declare(strict_types=1) is not used in plugin source files, only in standalone config files such as ecs.php.
How do I install Craft php guidelines in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/craft-php-guidelines to use it in all your projects, or to .claude/skills/craft-php-guidelines in one project. Or install the craftcms-claude-skills plugin, which includes it: /plugin marketplace add michtio/craftcms-claude-skills, then /plugin install craftcms-claude-skills@craftcms-claude-skills.
Does Craft php guidelines run scripts?
Yes. It runs shell scripts. No network calls were found in its scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Craft php guidelines?
Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.
What are the best alternatives to Craft php guidelines?
The closest alternatives to Craft php guidelines are Craftcms, Craft twig guidelines, Code, Craft plugin release and Coding standards.
Where this comes from
- Description: from the skill's own SKILL.md.
More from michtio/craftcms-claude-skills

Gives agents a safe Pest workflow for testing Craft CMS 5 plugins without touching live
- Open source
- 91 GitHub stars
- Developer tools

Guides an agent through Craft Cloud config, deploys, caching, and Cloud-specific limits
- Open source
- 91 GitHub stars
- Databases

Guides Craft CMS 5 content architecture: sections, entry types, fields, Matrix
- Open source
- 91 GitHub stars
- Developer tools

Deploys and runs Craft CMS on fortrabbit managed PHP hosting with safe git workflows
- Open source
- 91 GitHub stars
- Developer tools

Guides agents writing Craft CMS control panel JavaScript with the Garnish UI toolkit
- Open source
- 91 GitHub stars
- Developer tools

Runs one approved Craft CMS slice through outside builders under locked test gates
- Open source
- 91 GitHub stars
- Developer tools


