create-aggregation

Generate Elasticsearch aggregation classes, exceptions, and PHPUnit tests for PHP projects.

66|2|Updated Nov 27, 2025
One-click install
npx skills add https://github.com/bonu-dev/php-elasticsearch-builder --skill create-aggregation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-aggregation
Source: https://github.com/bonu-dev/php-elasticsearch-builder/tree/main/.agents/skills/create-aggregation
Command: npx skills add https://github.com/bonu-dev/php-elasticsearch-builder --skill create-aggregation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill automates the generation of new Elasticsearch aggregation classes, handling boilerplate, custom exceptions, and unit tests so developers avoid repetitive manual coding.

Core Features & Use Cases

  • Automated class scaffolding: Generates the aggregation PHP class with appropriate traits.
  • Exception scaffolding: Creates custom exception files when needed.
  • Unit test generation: Provides ready‑to‑run PHPUnit tests covering basic, filterable, globalizable, and size features.
  • Documentation update: Inserts the new aggregation into the project’s AGENTS.md file.

Use case example: When extending a PHP project with a custom metric or bucket aggregation, run this skill to instantly produce all required files following the project’s conventions.

Quick Start

Use the create‑aggregation skill to add a new aggregation named “average_sales” to the project.

Frequently Asked Questions about create-aggregation

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

FAQPage Schema
How do I generate Elasticsearch aggregation classes in PHP automatically?

You can scaffold Elasticsearch aggregation classes automatically by using a code generation skill that creates PHP class files with appropriate traits, custom exceptions, and PHPUnit tests. This automation handles boilerplate and follows project immutability and coding standards, requiring PHP 8.4+ and PHPUnit.

What is the best way to add custom metric or bucket aggregations to a PHP project?

The best way to add custom metric or bucket aggregations is through automated scaffolding that generates the aggregation class, relevant custom exception files, and ready-to-run unit tests covering basic, filterable, globalizable, and size features. It also updates the project's AGENTS.md documentation automatically.

Does Elasticsearch aggregation scaffolding work with PHP 8.4 and PHPUnit?

Yes, Elasticsearch aggregation scaffolding requires PHP 8.4+ and PHPUnit. The generated aggregation classes and unit tests follow the project's immutability and coding standards, ensuring compatibility with modern PHP development environments and testing workflows.

Can I generate unit tests for Elasticsearch aggregation classes automatically?

Yes, you can generate ready-to-run PHPUnit tests automatically when scaffolding Elasticsearch aggregation classes. The generated tests cover basic, filterable, globalizable, and size features, ensuring comprehensive coverage for custom metric and bucket aggregations without manual test writing.

Why does creating Elasticsearch aggregation classes manually require so much boilerplate?

Creating Elasticsearch aggregation classes manually involves repetitive boilerplate for class structure, custom exceptions, and unit tests. Automated scaffolding eliminates this by generating all required files at once, including the aggregation PHP class with appropriate traits, exception files, and PHPUnit tests following project conventions.