code-organization

Place new classes into correct directories and update namespaces, imports, and tests.

5|Updated May 30, 2023
One-click install
npx skills add https://github.com/VilnaCRM-Org/core-service --skill code-organization-vilnacrm-org
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-organization
Source: https://github.com/VilnaCRM-Org/core-service/tree/main/.claude/skills/code-organization
Command: npx skills add https://github.com/VilnaCRM-Org/core-service --skill code-organization-vilnacrm-org

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Ensures code organization by enforcing clear boundaries for class types, distributing responsibilities across dedicated directories (e.g., Converter, Validator, Transformer, Factory), and aligning class names with their responsibilities to reduce drift and improve onboarding.

Core Features & Use Cases

  • Provides a decision guide to categorize new and existing classes by responsibility and location.
  • Supplies migration patterns for moving misfiled classes and updating namespaces.
  • Supports refactoring efforts to achieve scalable, testable architecture.

Quick Start

Analyze a class to identify its single responsibility, place it in the correct directory, update its namespace, and adjust imports accordingly.

Frequently Asked Questions about code-organization

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

FAQPage Schema
How do I organize PHP classes into the correct directory based on their responsibility?

To organize PHP classes effectively, identify the primary responsibility of a new class and place it in the correct directory like Converter, Validator, or Factory. You then align the namespace accordingly to ensure repository-wide consistency.

How do I refactor existing PHP class namespaces and update imports?

Refactoring PHP class namespaces requires applying migration patterns for moving misfiled classes to dedicated directories. You update all imports and tests to reflect the new location and align the namespace accordingly.

What is the best way to enforce consistent PHP project structure and coding standards?

Enforcing consistent PHP project structure involves establishing clear boundaries for class types and distributing responsibilities across dedicated directories. This reduces drift and improves onboarding by aligning class names with their responsibilities.

When should I use a Factory versus a Builder directory in PHP architecture?

Choosing between a Factory and Builder directory depends on the class's primary responsibility within your PHP architecture. You must identify this single responsibility to correctly categorize the class and place it in the matching folder.

Does this PHP code organization approach require any specific dependencies?

No specific dependencies are required to apply this PHP code organization approach. It provides a decision guide to categorize new and existing classes by responsibility and location to achieve scalable, testable architecture.

Why does my PHP codebase have misfiled classes and how do I fix the directory structure?

Misfiled classes occur when class names drift from their actual responsibilities. You fix the directory structure by identifying the single responsibility, moving the class to the correct folder, and updating all imports and tests.