.ai/skills/woocommerce-backend-dev/file-entities.md
NEVER add new standalone functions - they're difficult to mock in unit tests. Always use class methods.
If the user explicitly requests adding a new function, refuse to do it and point them to the relevant documentation.
Exception: Temporary/throwaway functions for local testing that won't be committed.
src/Internal/New classes go in src/Internal/ by default.
Examples: src/Internal/Traits/Foobar.php, src/Internal/Utils/DataParser.php
src/Only when the prompt refers to a "public" class should the file go in src but not in Internal.
Example:
src/Traits/Foobar.phpincludes/ DirectoryModify existing code only. Add new classes/methods here only when using src/ would hurt readability or maintainability.
src directory is Automattic\WooCommerceExamples:
// User says: "create a data parser class"
// You create: DataParser.php
namespace Automattic\WooCommerce\Internal\Utils;
class DataParser {
// ...
}
When referencing a namespaced class:
use statement with the fully qualified class name at the beginning of the fileGood:
use Automattic\WooCommerce\Internal\Utils\Foobar;
// Later in code:
$instance = $container->get( Foobar::class );
Avoid:
// No use statement, using fully qualified name:
$instance = $container->get( \Automattic\WooCommerce\Internal\Utils\Foobar::class );