php-rules

php-rules is a skill for Claude Code from softspark/ai-toolkit. It costs 38 tokens per session (3,510 once invoked), scanned A, original, Apache-2.0.

A set of PHP coding rules covering style, common patterns, security, and testing. PHP is a programming language commonly used for web backends, while Composer manages PHP packages.

In plain words
What is it for?
Use it when writing or reviewing PHP projects that use tools or frameworks such as Composer, Laravel, Symfony, or PHPUnit.
Why use it?
It gives PHP changes consistent conventions and points developers toward safer, testable code.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the ai-toolkit plugin — 115 skills, 44 agents, 14 hooks shipped together

Good fit Use it when writing or reviewing PHP projects that use tools or frameworks such as Composer, Laravel, Symfony, or PHPUnit.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/softspark/ai-toolkit/php-rules
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 softspark/ai-toolkit --skill php-rules
Clone the repo
git clone --depth 1 https://github.com/softspark/ai-toolkit

Made for: Claude Code.

Or install ai-toolkit, the plugin that ships this one along with the rest of its 115 skills, 44 agents, 14 hooks.

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-rules

README.md
[![agentmods](https://agentmods.dev/badge/skills/softspark/ai-toolkit/php-rules/github.svg)](https://agentmods.dev/skills/softspark/ai-toolkit/php-rules)
Your own site
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/php-rules"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/php-rules/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-rules

Your own site · 80×15
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/php-rules"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/php-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,510 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00038 $0.03510
Opus 5.5 $0.00015 $0.01404
Sonnet 5.5 $0.00008 $0.00702
Haiku 4.5 $0.00004 $0.00351

Measured 1mo ago against content hash 9458e9d79b4f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

php-rules 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 1mo 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.

app/skills/php-rules/SKILL.md · 293 lines

How it starts

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

PHP Rules

These rules come from app/rules/php/ in ai-toolkit. They cover the project's standards for coding style, frameworks, patterns, security, and testing in PHP. Apply them when writing or reviewing PHP code.

PHP Coding Style

Standards

  • Follow PSR-12 extended coding style.
  • Use declare(strict_types=1) at the top of every file.
  • Use PHP 8.1+ features: enums, fibers, readonly properties, intersection types.
  • Use PHP CS Fixer or Pint for automated formatting.

Naming

  • PascalCase: classes, interfaces, traits, enums.
  • camelCase: methods, functions, variables.
  • UPPER_SNAKE: class constants (public const MAX_RETRIES = 3).
  • snake_case: not used for methods. PSR convention is camelCase.
  • Suffix interfaces with Interface or prefix with contract name (project convention).

Type System

  • Use typed properties: private readonly string $name;.
  • Use union types: string|int. Use intersection types: Countable&Iterator.
  • Use enum (PHP 8.1) for fixed sets of values. Use backed enums for persistence.
  • Use readonly classes (PHP 8.2) for immutable DTOs.
  • Use constructor promotion: public function __construct(private string $name).
  • Use never return type for functions that throw or exit.

Functions

  • Use typed parameters and return types on all functions/methods.
  • Use named arguments for readability: new User(name: 'Ada', age: 36).
  • Use null-safe operator: $user?->address?->city.
  • Use match expression over switch for value mapping.
  • Use first-class callable syntax: array_map($this->transform(...), $items).

Imports and Namespaces

  • Use PSR-4 autoloading via Composer.
  • Group use statements: classes, functions, constants.
  • Never use require/include for class loading. Use Composer autoloader.
  • Use one class per file. File name matches class name.

Error Handling

  • Use exceptions for error conditions. Never return error codes.
  • Create domain exception hierarchies extending RuntimeException or LogicException.
  • Use match with throw for exhaustive error mapping.
  • Log exceptions with context using PSR-3 logger.

Read the full file on GitHub · 293 lines

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. 1mo ago First seen · 293 lines · 38 tokens per session scan A 9458e9d79b4f

Subscribe to this mod's changes

php-rules is a skill published in the GitHub repository softspark/ai-toolkit (180 stars, last pushed 7d ago), licensed Apache-2.0. It adds 38 tokens to every session and 3,510 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-09-03.

Related

Other skills, from other repositories

phpunit-unit-test-reviewing

Internal sub-skill. Do not auto-activate. Use only when explicitly invoked by name by another skill or agent.

shopwareLabs/ai-coding-tools · 31 tokens

phpunit-integration-test-generation

Use this skill when the user asks to generate, write, or create integration tests for a Shopware 6 source class whose contract requires wired-up code — phrases like "generate integration tests for X", "write an integration test for this controller", "test this indexer", "create an integration test for the message…

shopwareLabs/ai-coding-tools · 184 tokens

phpunit-unit-test-writing

Use this skill when the user asks to write, generate, create, or add PHPUnit unit tests for a Shopware 6 source class — phrases like "write unit tests for X", "generate tests for ClassName", "create PHPUnit tests", "add test coverage", "test this class", "cover this with tests", "I need tests for", "unit test this"…

shopwareLabs/ai-coding-tools · 187 tokens

unit-test

A Go testing workflow for writing unit tests: small tests that check individual functions or components. It supports table-driven cases, where many inputs and expected results are organised in one test, and subtests.

johnqtcg/awesome-skills · 100 tokens

fuzzing-test

A Go testing guide for generating fuzz tests, which repeatedly try varied inputs to find crashes and unexpected behavior. It first checks whether the code is suitable for fuzzing.

johnqtcg/awesome-skills · 74 tokens

go-test-review

Review Go test code for quality including table-driven tests, t.Helper usage, assertion completeness, boundary cases, benchmarks, fuzz tests, and coverage targets. Trigger when PR contains test.go files, test helpers, httptest usage, testing.B, testing.F, or testdata directories. Use for test-quality focused review.

johnqtcg/awesome-skills · 68 tokens