# Magento Php Specialist

> Advanced PHP development for Magento 2 following PSR-12 and Magento coding standards. Use when writing PHP code, implementing business logic, or ensuring code quality. Masters modern PHP features, object-oriented programming, design patterns, and Magento-specific PHP practices.

- **Type:** Skill
- **Install:** `agentstack add skill-maxnorm-magento2-agent-skills-magento-php-specialist`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [maxnorm](https://agentstack.voostack.com/s/maxnorm)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [maxnorm](https://github.com/maxnorm)
- **Source:** https://github.com/maxnorm/magento2-agent-skills/tree/main/skills/magento-php-specialist

## Install

```sh
agentstack add skill-maxnorm-magento2-agent-skills-magento-php-specialist
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Magento 2 PHP Specialist

Expert specialist in leveraging advanced PHP techniques and modern practices to create high-performance, maintainable Magento 2 applications following enterprise development standards.

## When to Use

- Writing PHP code for Magento 2
- Implementing business logic
- Ensuring code quality and standards
- Working with modern PHP features
- Implementing design patterns

## PHP Standards (STRICT ENFORCEMENT)

### PSR-12 Compliance
- **PSR-12**: Strictly adhere to PSR-12 coding standards
- **Magento2 Coding Standard**: Follow standards in `vendor/magento/magento-coding-standard/Magento2`
- **Strict Types**: `declare(strict_types=1);` required
- **EditorConfig**: Check project's `.editorconfig` for indentation (4 spaces), line endings (LF), encoding (UTF-8)

### Code Structure Requirements
- **Opening Braces**: Classes and methods must have opening braces on their own line (PSR-12)
- **Constructor Property Promotion**: Use with `readonly` modifier where appropriate
- **Type Hinting**: All parameters and return types must be type-hinted
- **Strict Comparisons**: Always use `===` and `!==` (never `==` or `!=`)
- **Constructor PHPDoc**: Must include `@param` annotation for each parameter

### Modern PHP Features
- **Constructor Property Promotion**: Use constructor property promotion
- **Readonly Properties**: Use `readonly` modifier where appropriate
- **Union Types**: Use union types for flexible type hints
- **Match Expressions**: Use match expressions instead of switch when appropriate
- **Named Arguments**: Use named arguments for clarity

### Code Example
```php
repository->getById($id);
    }
}
```

## Best Practices

### Object-Oriented Programming
- **Composition Over Inheritance**: Prefer composition patterns
- **Dependency Injection**: Constructor injection only - avoid service locators
- **Single Responsibility**: One purpose per class/method
- **Interface Segregation**: Use small, focused interfaces
- **SOLID Principles**: Follow SOLID principles

### Code Quality
- **Type Safety**: 100% type coverage - parameters, return types, properties
- **Error Handling**: Comprehensive exception handling
- **Logging**: Use `\Psr\Log\LoggerInterface` for logging
- **Documentation**: Minimal PHPDoc with `@param`, `@return`, `@throws`
- **Testing**: Write unit tests for business logic

### Magento-Specific Patterns
- **Service Contracts**: Use service contracts for APIs
- **Repository Pattern**: Implement repository pattern for data access
- **Factory Pattern**: Use factories for object creation
- **Plugin Pattern**: Use plugins to extend functionality
- **Observer Pattern**: Use observers for event-driven architecture

## References

- [PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/)
- [Adobe Commerce PHP Development](https://developer.adobe.com/commerce/php/development/)
- [Coding Standards](https://developer.adobe.com/commerce/php/coding-standards/)

Focus on writing clean, maintainable PHP code that follows Magento best practices.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [maxnorm](https://github.com/maxnorm)
- **Source:** [maxnorm/magento2-agent-skills](https://github.com/maxnorm/magento2-agent-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-maxnorm-magento2-agent-skills-magento-php-specialist
- Seller: https://agentstack.voostack.com/s/maxnorm
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
