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.
npx skills add AsyrafHussin/agent-skills --skill php-best-practicesgit clone --depth 1 https://github.com/AsyrafHussin/agent-skillsWrote 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.
[](https://agentmods.dev/skills/asyrafhussin/agent-skills/php-best-practices)<a href="https://agentmods.dev/skills/asyrafhussin/agent-skills/php-best-practices"><img src="https://agentmods.dev/badge/skills/asyrafhussin/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.
<a href="https://agentmods.dev/skills/asyrafhussin/agent-skills/php-best-practices"><img src="https://agentmods.dev/badge/skills/asyrafhussin/agent-skills/php-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- Socket pass
- Snyk pass
- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00064 | $0.02212 |
| Opus 5 | $0.00032 | $0.01106 |
| Sonnet 5 | $0.00013 | $0.00442 |
| Haiku 4.5 | $0.00006 | $0.00221 |
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 9d 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.
How it starts
The opening of the file, as written. The whole thing — 247 lines — stays where its author put it; the contents beside it link to each section on GitHub.
PHP Best Practices
Modern PHP 8.x patterns, PSR standards, type system best practices, and SOLID principles. Contains 51 rules for writing clean, maintainable PHP code.
Step 1: Detect PHP Version
Always check the project's PHP version before giving any advice. Features vary significantly across 8.0 - 8.5. Never suggest syntax that doesn't exist in the project's version.
Check composer.json for the required PHP version:
{ "require": { "php": "^8.1" } } // -> 8.1 rules and below
{ "require": { "php": "^8.3" } } // -> 8.3 rules and below
{ "require": { "php": ">=8.4" } } // -> 8.4 rules and below
Also check the runtime version:
php -v # e.g. PHP 8.3.12
Feature Availability by Version
| Feature | Version | Rule Prefix |
|---|---|---|
| Union types, match, nullsafe, named args, constructor promotion, attributes | 8.0+ | type-, modern- |
| Enums, readonly properties, intersection types, first-class callables, never, fibers | 8.1+ | modern- |
| Readonly classes, DNF types, true/false/null standalone types | 8.2+ | modern- |
Typed class constants, #[\Override], json_validate() |
8.3+ | modern- |
Property hooks, asymmetric visibility, #[\Deprecated], new without parens |
8.4+ | modern- |
| Pipe operator ` | >` | 8.5+ |
Only suggest features available in the detected version. If the user asks about upgrading or newer features, mention what becomes available at each version.
When to Apply
Reference these guidelines when:
- Writing or reviewing PHP code
- Implementing classes and interfaces
- Using PHP 8.x modern features
- Ensuring type safety
- Following PSR standards
- Applying design patterns
Rule Categories by Priority
| Priority | Category | Impact | Prefix | Rules |
|---|---|---|---|---|
| 1 | Type System | CRITICAL | type- |
9 |
| 2 | Modern PHP Features | CRITICAL | modern- |
16 |
| 3 | PSR Standards | HIGH | psr- |
6 |
| 4 | SOLID Principles | HIGH | solid- |
5 |
| 5 | Error Handling | HIGH | error- |
5 |
| 6 | Performance | MEDIUM | perf- |
5 |
| 7 | Security | CRITICAL | sec- |
5 |
What ships with it
56 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.
- AGENTS.md 21 KB
- metadata.json 2.9 KB
- README.md 2.2 KB
- rules/_sections.md 2.0 KB
- rules/_template.md 1018 B
- rules/error-custom-exceptions.md 3.5 KB
- rules/error-exception-hierarchy.md 3.4 KB
- rules/error-finally-cleanup.md 2.6 KB
- rules/error-never-suppress.md 2.4 KB
- rules/error-try-catch-specific.md 2.5 KB
- rules/modern-arrow-functions.md 3.3 KB
- rules/modern-asymmetric-visibility.md 2.7 KB
- rules/modern-attributes.md 3.9 KB
- rules/modern-constructor-promotion.md 4.1 KB
- rules/modern-enums-methods.md 4.7 KB
- rules/modern-enums.md 6.8 KB
- rules/modern-first-class-callables.md 4.5 KB
- rules/modern-match-expression.md 3.7 KB
- rules/modern-named-arguments.md 3.1 KB
- rules/modern-nullsafe-operator.md 3.6 KB
- rules/modern-override-attribute.md 2.6 KB
- rules/modern-pipe-operator.md 2.6 KB
- rules/modern-property-hooks.md 3.1 KB
- rules/modern-readonly-classes.md 3.3 KB
- rules/modern-readonly-properties.md 3.1 KB
- rules/modern-typed-constants.md 2.3 KB
- rules/perf-array-functions.md 2.2 KB
- rules/perf-avoid-globals.md 2.1 KB
- rules/perf-generators.md 2.8 KB
- rules/perf-lazy-loading.md 2.6 KB
- rules/perf-string-functions.md 2.0 KB
- rules/psr-12-coding-style.md 4.7 KB
- rules/psr-4-autoloading.md 3.0 KB
- rules/psr-file-structure.md 5.0 KB
- rules/psr-namespace-usage.md 4.9 KB
- rules/psr-naming-classes.md 3.6 KB
- rules/psr-naming-methods.md 5.7 KB
- rules/sec-file-uploads.md 3.6 KB
- rules/sec-input-validation.md 2.6 KB
- rules/sec-output-escaping.md 2.1 KB
- rules/sec-password-hashing.md 2.6 KB
- rules/sec-sql-prepared.md 2.6 KB
- rules/solid-dip.md 7.0 KB
- rules/solid-isp.md 6.7 KB
- rules/solid-lsp.md 6.5 KB
- rules/solid-ocp.md 6.8 KB
- rules/solid-srp.md 6.7 KB
- rules/type-intersection-types.md 2.6 KB
- rules/type-mixed-avoid.md 3.0 KB
- rules/type-nullable-types.md 2.5 KB
- rules/type-parameter-types.md 1.8 KB
- rules/type-property-types.md 1.9 KB
- rules/type-return-types.md 1.8 KB
- rules/type-strict-mode.md 4.6 KB
- rules/type-union-types.md 2.0 KB
- rules/type-void-never.md 2.9 KB
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.
- 9d ago First seen · 247 lines · 64 tokens per session scan A ed70a7d31a2e
php-best-practices is a skill published in the GitHub repository AsyrafHussin/agent-skills (74 stars, last pushed 12d ago), licensed MIT. It adds 64 tokens to every session and 2,212 once invoked, about $0.0003 per session on Opus 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-08-30.
Other skills, from other repositories
laravel-audit-architecture
Audit a Laravel application's architecture: boundaries, responsibility, coupling, duplication, and maintainability. Use when auditing architecture.
laravel-audit-conventions
Audit a Laravel application for framework conventions: anti-patterns, version-appropriate APIs, and misuse of framework features. Use when auditing Laravel conventions.
ring:adopting-lib-commons-huma-wrapper
Adopting the lib-commons/v5 shared Huma (OAS 3.1) OpenAPI wrapper + RFC 9457 problem model (commons/net/http/{openapi,problem}) in a Lerian Go service: wire openapi.New/ServeSpec + problem.Install (central >=500 scrub) on BOTH runtime and spec-gen paths, the per-rail problem.MapError flex seam, and rename-only spec…
ring:applying-licenses
Applying or switching a repository's license (Apache 2.0, Elastic License v2, or Proprietary): rewrites the LICENSE file, updates Go/TS source headers, sets SPDX identifiers, and validates consistency after user confirmation. Use when asked to set, apply, or switch a license, or when scaffolding a service with no…
ring:auditing-dependency-security
Auditing a dependency for supply-chain risk before install (pip/npm/go/cargo): checks typosquatting, maintainer/age risk, vulnerability DBs (OSV, GHSA, Socket), and lockfile hash pinning, then emits a risk score and approve/conditional/escalate/block decision. Use when adding or updating a dependency, reviewing a…
laravel-auditor-development
Integrate and apply the Laravel Auditor package in Laravel applications: installation, setup, the MCP tools, and the audit workflow. Use when setting up Laravel Auditor or wiring it into a Laravel app.