> php-error-handling
Modern PHP error and exception handling standards. Use when implementing exception hierarchies, error handlers, or custom exceptions in PHP. (triggers: **/*.php, try, catch, finally, Throwable, set_exception_handler)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/php-error-handling?format=md"PHP Error Handling
Priority: P0 (CRITICAL)
Structure
src/
└── Exceptions/
├── {Domain}Exception.php
└── Handler.php
Implementation Guidelines
- Exception-Driven: Prefer throwing exceptions over returning
false. - Throwable Interface: Catch
Throwablefor both Errors and Exceptions. - Custom Exceptions: Extend
RuntimeExceptionfor domain-specific errors. - Multi-catch: Use
catch (TypeA | TypeB $e)for identical handling. - Finally Cleanup: Use
finallyto ensure resource release. - Global Handling: Set
set_exception_handlerin entry points. - PSR-3 Logging: Log critical faults using standard loggers.
Anti-Patterns
- Error Suppression: No @: Avoid suppressing errors with
@. - Silent Catch: No Empty Catches: Log or handle all caught exceptions.
- Logic Flow: No Flow Control: Don't use exceptions for expected logic.
- Panic Display: No display_errors: Log to file, never to production screen.
References
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)