standards-coding

Standardize Magento 2 PHP code and module structure with PHPCS compliance.

2|3|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/caravanglory/magehub --skill standards-coding
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: standards-coding
Source: https://github.com/caravanglory/magehub/tree/main/skills/standards/standards-coding
Command: npx skills add https://github.com/caravanglory/magehub --skill standards-coding

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you write, refactor, and review Magento 2 code that stays aligned with project conventions, reduces upgrade risk, and passes coding-standard checks.

Core Features & Use Cases

  • Magento Coding Standards: Apply PHPCS, strict types, explicit visibility, and XML configuration conventions consistently across modules.
  • Service Contracts & Repositories: Design public APIs with interfaces, repository patterns, and dependency boundaries that fit Magento architecture.
  • Maintainable Refactors: Improve existing code with narrow, production-safe changes instead of ad hoc helpers or unstable concrete dependencies.
  • Use Case: Ask it to review a module for PHPCS violations, identify public API issues, or propose a compliant repository implementation before merge.

Quick Start

Ask the skill to review your Magento module for coding standards, service contracts, strict types, and PHPCS issues.

Frequently Asked Questions about standards-coding

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I ensure my Magento 2 module passes PHPCS coding standards?

To ensure Magento 2 modules pass PHPCS coding standards, apply strict types, explicit visibility, and consistent XML configuration conventions. Reviewing modules for these violations before merge enforces maintainable production code and reduces upgrade risk.

What is the best way to design Magento 2 service contracts and repositories?

Designing Magento 2 service contracts and repositories requires interface-based APIs and the repository pattern. Implementing these architectural boundaries creates maintainable dependencies that align with Magento standards and reduce ad hoc helper usage.

Can I refactor existing Magento 2 code to use strict types and interfaces?

Refactoring existing Magento 2 code to use strict types and interfaces is fully supported. Apply narrow, production-safe changes to replace unstable concrete dependencies with interface-based APIs and repository patterns for better maintainability.

Does this approach validate Magento XML configuration and extension attributes?

Yes, validating Magento XML configuration and extension attributes is a core function. Standardizing module structure includes enforcing XML configuration conventions and checking extension attributes for compliance with Magento coding standards.

Why does my Magento 2 repository pattern implementation fail code review?

Magento 2 repository pattern implementations often fail code review due to missing strict types, improper interface-based APIs, or unstable concrete dependencies. Refactoring to use proper service contracts and explicit visibility resolves these standard violations.

When do I need to review my Magento module for coding standard compliance?

Reviewing Magento modules for coding standard compliance is needed when writing, refactoring, or preparing modules for merge. Validate PHPCS rules, service contracts, and repository patterns to ensure production-safe, maintainable code.