PHP Typed Collection Class Generator

VerifiedSafe

Generates a typed Collection class for managing entity sets, using Atournayre traits and interfaces. Produces a final PHP file in `src/Collection/` with methods like `asList()` and features from the traits. Helps enforce consistent, typed collection structures in your domain layer.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#php#collection#typed-class#entity#atournayre

Recommended for

Automated summary

Generates a typed Collection class for a PHP entity, using traits and interfaces from the Atournayre framework.

Strengths

  • Reduces boilerplate by leveraging predefined traits and interfaces
  • Provides a robust collection with counting and transformation methods
  • Seamlessly integrates into an Atournayre-based project

Limitations

  • Requires the atournayre/framework dependency
  • The entity must already exist in the project
  • Only generates basic functionality (YAGNI principle)
When to use it

Use this skill when you need a typed collection for an entity in a Symfony project using the Atournayre framework.

When not to use it

Do not use it if you are not using the Atournayre framework or prefer to implement collections manually.

Security analysis

Safe
Quality score85/100

The skill generates a PHP file using a template; it only reads an entity file and writes a new class, with no destructive or exfiltrating actions.

No concerns found

How this analysis is made

Examples

Generate ProductCollection
Use skill php:make-collection with EntityName=Product

name: php:make-collection description: Génère classe Collection typée avec traits Atournayre model: sonnet allowed-tools: [Bash, Read, Write, Edit, Grep, Glob] version: 1.0.0 license: MIT

PHP Make Collection Skill

Instructions à Exécuter

IMPORTANT : Exécute ce workflow étape par étape :

Description

Génère une classe Collection typée pour gérer des ensembles d'entités avec les traits et interfaces Atournayre.

Usage

Use skill php:make-collection

Variables requises

  • {EntityName} - Nom de l'entité en PascalCase (ex: Product)
  • {entityName} - Nom de l'entité en camelCase (ex: product)
  • {namespace} - Namespace du projet (défaut: App)

Dépendances

  • Entité dans src/Entity/{EntityName}.php
  • Framework atournayre/framework

Outputs

  • src/Collection/{EntityName}Collection.php

Workflow

  1. Demander le nom de l'entité (EntityName)
  2. Vérifier que l'entité existe dans src/Entity/{EntityName}.php
    • Si non : arrêter et demander de créer l'entité d'abord
  3. Générer la classe Collection depuis le template templates/Collection/
  4. Afficher le fichier créé

Patterns appliqués

  • Classe final
  • Interfaces : AsListInterface, ToArrayInterface, CountInterface, CountByInterface, AtLeastOneElementInterface, HasSeveralElementsInterface, HasNoElementInterface, HasOneElementInterface, HasXElementsInterface, LoggableInterface
  • Traits : Collection, Collection\ToArray, Collection\Countable
  • Méthode statique asList(array $collection)

References

  • Usage - Exemples d'utilisation et méthodes métier

Notes

  • Respect du principe YAGNI : pas de méthodes génériques anticipées
  • Seules les méthodes explicitement demandées doivent être ajoutées
  • Les traits fournissent déjà les fonctionnalités de base

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/php-typed-collection-class-generator-mm8o524c/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/php-typed-collection-class-generator-mm8o524c' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/php-typed-collection-class-generator-mm8o524c/download' --output '.skill-downloads/php-typed-collection-class-generator-mm8o524c/SKILL.md.part' && mv '.skill-downloads/php-typed-collection-class-generator-mm8o524c/SKILL.md.part' '.skill-downloads/php-typed-collection-class-generator-mm8o524c/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Original excerpt: Dépendances
  • Entité dans src/Entity/{EntityName}.php
  • Framework atournayre/framework

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/php-typed-collection-class-generator-mm8o524c/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills