php-best-practices

php-best-practices is a skill for Claude Code, Codex from kabudu/engineering-agent-skills. It costs 45 tokens per session (1,096 once invoked), scanned A, original, MIT.

A PHP development workflow for implementing, changing, debugging, and reviewing PHP code while checking supported PHP versions, project rules, dependencies, and framework conventions.

In plain words
What is it for?
Use it for substantial PHP feature work, refactoring, bug fixes, and code reviews. It helps verify contracts, tests, configuration, and runtime support.
Why use it?
It reduces compatibility mistakes, unclear behaviour, and changes that conflict with the project's existing setup.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for substantial PHP feature work, refactoring, bug fixes, and code reviews. It helps verify contracts, tests, configuration, and runtime support.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kabudu/engineering-agent-skills/php-best-practices
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add kabudu/engineering-agent-skills --skill php-best-practices
Clone the repo
git clone --depth 1 https://github.com/kabudu/engineering-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for php-best-practices

README.md
[![agentmods](https://agentmods.dev/badge/skills/kabudu/engineering-agent-skills/php-best-practices/github.svg)](https://agentmods.dev/skills/kabudu/engineering-agent-skills/php-best-practices)
Your own site
<a href="https://agentmods.dev/skills/kabudu/engineering-agent-skills/php-best-practices"><img src="https://agentmods.dev/badge/skills/kabudu/engineering-agent-skills/php-best-practices/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for php-best-practices

Your own site · 80×15
<a href="https://agentmods.dev/skills/kabudu/engineering-agent-skills/php-best-practices"><img src="https://agentmods.dev/badge/skills/kabudu/engineering-agent-skills/php-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,096 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00045 $0.01096
Opus 5.5 $0.00018 $0.00438
Sonnet 5.5 $0.00009 $0.00219
Haiku 4.5 $0.00005 $0.00110

Measured 28d ago against content hash d041926c829b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

php-best-practices scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 28d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/php-best-practices/SKILL.md · 42 lines

How it starts

The opening of the file, as written. The whole thing — 42 lines — stays where its author put it; the contents beside it link to each section on GitHub.

BeautifulPHP

Produce clear, idiomatic PHP that satisfies the requested behaviour on the project's supported runtimes. Follow repository instructions and established framework conventions. Keep changes scoped; introduce dependencies and abstractions only when they solve a concrete problem.

Establish the target and contract

Read affected code, tests, Composer manifests, analysis configuration, and any existing CI, container, or deployment settings. Establish the supported PHP range, required extensions, framework version, and actual execution environment. Distinguish a library's consumer compatibility promise from an application's deployment target. A local interpreter or lockfile alone does not establish either.

Reconcile conflicting version evidence before compatibility-sensitive edits. If the target is unresolved, state the uncertainty and ask for the missing decision while continuing independent work. Do not silently raise the minimum version, narrow the supported range, or bypass platform requirements. Check syntax, built-in APIs, dependencies, and deprecations against the full promised range. Read compatibility when establishing a target, upgrading PHP, or using version-sensitive features.

Before refactoring, identify observable contracts: return values, exceptions, side effects, ordering, serialization, and public signatures. Preserve them unless the request authorises changes. Documenting a difference does not authorise it. Add focused regression coverage for demonstrated bugs and fragile boundaries.

Implement deliberately

  • Prefer cohesive functions and objects with clear names and explicit dependencies. Use interfaces for real substitution or public contracts, not one per class. Avoid speculative layers, service locators, global mutable state, and unmeasured optimisation; respect established framework mechanisms.
  • Express meaningful constraints with native parameter, return, and property types supported by the target. Use PHPDoc for additional information such as generics and array shapes. Validate external data before treating it as a domain value; casts and type annotations are not validation.
  • Distinguish missing keys, null, false, zero, and empty strings. Choose comparisons and presence checks by semantics. Consider array-key coercion, list versus map shape, byte versus character operations, and JSON representation. Read types and contracts when these boundaries or public APIs change.
  • Apply strict typing deliberately. Scalar argument strictness depends on the calling file; adding declarations or narrower types can change accepted inputs. Do not present strict typing as sanitisation or apply it mechanically during compatibility-preserving refactors.
  • Use exceptions for failures according to project contracts, preserving useful context and previous causes. Distinguish normal absence from failure. Catch at a recovery or translation boundary; do not swallow Throwable, suppress diagnostics, or return a success-shaped fallback after failure. Release resources with appropriate cleanup and transactions.
  • Treat final, readonly, constructor promotion, enums, and property hooks as design choices with version and compatibility costs. Check inheritance, named arguments, reflection, serialization, and framework hydration before changing exposed structures.
  • Keep untrusted data separate from executable commands and queries. Enforce authorisation at the operation boundary, encode output for its destination, and bound resource use. Read security and boundaries for HTTP, persistence, filesystem, process, or external-service changes.
  • Document contracts types cannot convey: failure modes, units, encoding, side effects, and meaningful ordering or lifecycle constraints. Prefer examples that exercise realistic failure handling over comments that repeat the code.

Read the full file on GitHub · 42 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 28d ago First seen · 42 lines · 45 tokens per session scan A d041926c829b

Subscribe to this mod's changes

php-best-practices is a skill published in the GitHub repository kabudu/engineering-agent-skills (3 stars, last pushed 1mo ago), licensed MIT. It adds 45 tokens to every session and 1,096 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-01.

Related

php-best-practices compared with skills from other repositories

php-best-practices next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
php-best-practiceskabudu/engineering-agent-skillsSkill31mo agoMITA45Claude Code, Codex
mvc-expertroedyrustam/vibes-plugSkill1293d agoMITA30Cursor
wp-phpstan-static-analysisLonsdale201/wp-agent-skillsSkill269d agoMITA227Claude Code, Codex
drupaltools-phpstandrupaltools/skillsSkill171mo agononeA53Claude Code, Codex
setup-ts-deep-modulesvinvcn/mattpocock-skills-zh-CNSkill6.2k5d agoMITA49Claude Code, Codex
diagnosing-bugsvinvcn/mattpocock-skills-zh-CNSkill6.2k5d agoMITA50Claude Code, Codex
kotlin-tooling-native-build-performanceKotlin/kotlin-agent-skillsSkill1.2k2d agoApache-2.0A96Claude Code, Codex