Borrowing it
Nothing to install: this file belongs to irahardianto/rugged-gemini. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/irahardianto/rugged-gemini/main/.gemini/skills/php-idioms/SKILL.mdgit clone --depth 1 https://github.com/irahardianto/rugged-geminiWrote 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/irahardianto/rugged-gemini/php-idioms)<a href="https://agentmods.dev/skills/irahardianto/rugged-gemini/php-idioms"><img src="https://agentmods.dev/badge/skills/irahardianto/rugged-gemini/php-idioms/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/irahardianto/rugged-gemini/php-idioms"><img src="https://agentmods.dev/badge/skills/irahardianto/rugged-gemini/php-idioms.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.00000 | $0.00806 |
| Opus 5 | $0.00000 | $0.00403 |
| Sonnet 5 | $0.00000 | $0.00161 |
| Haiku 4.5 | $0.00000 | $0.00081 |
Grade A, and why
php-idioms 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 5d 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.
This is a copy
89% identical to php-idioms — 8 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 121 lines — stays where its author put it; the contents beside it link to each section on GitHub.
PHP Idioms and Patterns
Modern PHP (8.x) rewards type safety, immutability, and framework-agnostic design. Lean into typed properties, enums, and readonly classes. Idiomatic PHP = strict types, PSR-compliant, well-tested.
Scope: PHP coding idioms. Test naming: GEMINI.md § Testing Strategy. Logging:
@.gemini/skills/logging-and-observability-principles/SKILL.md.
Modern PHP Features (8.x)
-
declare(strict_types=1)— always, every file. -
Enums for domain constants:
enum Priority: string { case Low = 'low'; case Medium = 'medium'; case High = 'high'; } -
Readonly classes for immutable DTOs:
readonly class CreateTaskRequest { public function __construct( public string $title, public Priority $priority, ) {} } -
Named arguments for clarity:
$task = new Task(title: 'Deploy fix', priority: Priority::High); -
Match expressions over switch:
$score = match($priority) { Priority::Low => 1, Priority::Medium => 5, Priority::High => 10, };
Error Handling
-
Domain exception hierarchies:
abstract class DomainException extends \RuntimeException {} class NotFoundException extends DomainException { public function __construct( public readonly string $resource, public readonly string $resourceId, ) { parent::__construct("{$resource} '{$resourceId}' not found"); } } -
Never
catch (\Exception)without re-throw or specific handling. -
Type-safe return types — never mixed without justification.
Interfaces and DI
- Define interface where consumed, implement where provided:
// In task feature interface TaskStorage { public function getById(string $id): Task; public function save(Task $task): void; } // Constructor injection class TaskService { public function __construct( private readonly TaskStorage $storage, ) {} }
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.
- 5d ago First seen · 121 lines · 0 tokens per session scan A 42f3c7e092dc
php-idioms is a skill published in the GitHub repository irahardianto/rugged-gemini (5 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 806 tokens. A static security scan graded it A with 0 findings. It is 89% identical to php-idioms, differing in 8 lines, and is treated as a copy.
Other skills, from other repositories
integration-fixture
Create or validate a .test integration fixture under tests/php/Integration/Fixtures.
php
PHP development: code quality, PSR standards, testing with PHPUnit.
Behat BDD Testing
PHP BDD testing with Behat framework using Gherkin feature files, Mink browser extension, context classes, and Symfony integration for behavior-driven acceptance testing.
Laravel Dusk Testing
Expert-level Laravel Dusk browser testing skill for PHP/Laravel applications. Covers Chrome-based E2E testing, browser assertions, Page Objects, component testing, authentication helpers, and database integration.
phel-lang
Building applications WITH Phel (Lisp that compiles to PHP). Triggers on .phel files, phel-config.php, phel CLI commands (init, run, repl, test, build), or requests to build a Phel app. Skip when working on the Phel compiler internals (use compiler-guide or phel-patterns instead).
craft-pest
Testing Craft CMS 5 plugins and modules with Pest — test isolation, database safety, and the markhuot/craft-pest-core harness. ALWAYS load when writing, running, fixing, or reviewing tests for a Craft plugin or module, and whenever a suite touches a real Craft install. Covers why rollback is opt-in, tests/Pest.php +…