1. Habit
  2. Skills
  3. PHP Best Practices skill
asyrafhussin · 4K installs

PHP Best Practices skill
Runs by itself, PHP code changes.

PHP code checked against modern rules.

Install the PHP Best Practices skill and make it a habit: follow https://gethabit.dev/skills/asyrafhussin/php-best-practices.md

  1. 1Copy
  2. 2Paste into Claude Code, Codex or Cursor
  3. 3It runs by itself

4K installs92 starsMIT licenceSource on GitHub ↗

PHP Best Practices

by asyrafhussin · 4K installs

The skill

PHP Best Practices reviews PHP 8.x code against type safety, modern features, PSR standards, SOLID principles, error handling, performance and security rules, matched to the project's version.

Only when you ask.

The habit

PHP code checked against modern rules.

↻ Runs by itselfPHP code changes

How the habit works.
You don't have to.

Three questionsWhen does it start? How does it check its work? What does it remember?

One run, step by step.
Then it stops.

Stop ruleStops after one change set per run, with at most one re-scan.

  1. 01

    Detect version

    Your agent reads the required PHP version from composer.json and checks php -v.

  2. 02

    Check types

    It checks strict types, return, parameter and property types against the type rules.

  3. 03

    Check modern features

    It flags where enums, match, readonly and other version-appropriate features fit.

  4. 04

    Check PSR and SOLID

    It checks PSR-4, PSR-12, naming and the five SOLID principles.

  5. 05

    Check errors and security

    It checks exception handling, prepared statements, output escaping and password hashing.

  6. 06

    Report

    It writes each finding as file:line with its category to the run log.

What it may do.
Nothing more.

Safe by defaultIt writes only in its own folder and asks you before anything goes out.

Is it for you?
Use it when it fits.

Quick checkRead both lists. If the left one sounds like you, the PHP Best Practices skill helps.

Use it when

  • ✓ reviewing or auditing PHP code
  • ✓ checking type safety in PHP
  • ✓ ensuring PSR and SOLID compliance

Skip it when

  • – the project is not PHP
  • – you want automated refactoring instead of review

Questions

PHP Best Practices skill, answered.

Will it suggest features my PHP lacks?

No. It checks the project version first and only suggests syntax available in that version.

Does it rewrite my code?

The loop reports findings as file:line notes; applying the fixes is a separate decision.

How do I install the PHP Best Practices skill?

Copy the prompt at the top into your agent. It installs the skill from asyrafhussin/agent-skills and sets up the habit. Or run npx skills add asyrafhussin/agent-skills --skill php-best-practices.

Is the PHP Best Practices skill free?

Yes. It is published under MIT. Habit is free too.

PHP Best Practices. Now as a habit.

Install the PHP Best Practices skill and make it a habit: follow https://gethabit.dev/skills/asyrafhussin/php-best-practices.md

  • Free
  • No account
  • Undo in one line

All asyrafhussin skills →More code skills →

Works in

  • Claude Code
  • Codex
  • Cursor
  • ChatGPT
  • Claude app

Made by asyrafhussin, published under MIT. Habit links to the original and never changes it. Is this your skill?

Copying didn't work here. Select the line and copy it by hand.