php-type-safety

Community

Strengthen PHP types at runtime and analysis.

Authorpeterfox
Version1.0.0
Installs0

System Documentation

What problem does it solve?

PHP projects often struggle to maintain type safety across dynamic data boundaries. This skill provides a disciplined pattern: combine runtime assertions (Webmozart\Assert) with PHPDoc shapes to help PHPStan and Psalm understand and enforce types, reducing bugs and improving maintainability.

Core Features & Use Cases

  • Runtime assertions at entry/exit points to validate inputs and guard downstream operations.
  • PHPDoc shapes and type aliases to describe complex data structures (arrays, maps, lists) for static analysis.
  • Templates and generics support to create reusable, strongly-typed APIs across modules.

Quick Start

Annotate a function parameter with a PHPDoc shape and add a runtime assertion at the boundary.

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: php-type-safety
Download link: https://github.com/peterfox/agent-skills/archive/main.zip#php-type-safety

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.