create-operation-type

Generate Drupal AI operation type scaffolding with interfaces, DTOs, and unit tests.

10|4|Updated Jan 5, 2018
One-click install
npx skills add https://github.com/markconroy/markie --skill create-operation-type
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-operation-type
Source: https://github.com/markconroy/markie/tree/main/web/modules/contrib/ai/.agents/skills/create-operation-type
Command: npx skills add https://github.com/markconroy/markie --skill create-operation-type

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creating a new AI operation type in a Drupal AI module is repetitive and error-prone because it requires matching interfaces, data transfer objects, tests, provider wiring, and documentation.

Core Features & Use Cases

  • Generates complete operation type scaffolding: creates the operation interface, input, output, and optional item/response data class under the correct src/OperationType/{OperationName}/ structure.
  • Produces unit tests automatically: creates PHPUnit unit tests for the generated input, output, and item/response classes to ensure the scaffolding behaves as expected.
  • Ensures end-to-end integration with a test provider: updates the EchoAI test provider and adds a kernel test to validate the new interface call path works.
  • Validates generated code before finishing: runs a verification script to confirm required files exist, signatures and attribute metadata match conventions, and provider support is registered.

Quick Start

Ask for the operation name, labels, method signature details, and normalized output/item needs, then run the create-operation-type workflow to scaffold and verify the full operation type.

Frequently Asked Questions about create-operation-type

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

FAQPage Schema
How do I scaffold a new AI operation type in a Drupal module?

Scaffolding a Drupal AI operation type involves generating a matching interface, input/output DTOs, optional item/response classes, and unit tests. This process automates file creation under the correct src/OperationType directory structure and validates the setup.

What files are required when creating a custom AI provider integration for Drupal?

Creating a custom AI provider integration requires an operation interface, input and output DTOs, optional item/response classes, PHPUnit unit tests, and EchoAI provider registration. A kernel test must also validate the end-to-end interface call path.

How do PHPUnit kernel tests validate AI module operations in Drupal?

PHPUnit kernel tests validate AI module operations by executing the new interface call path against a test provider. They confirm required files exist, method signatures match #[OperationType] attribute metadata, and provider support is registered correctly.

Can I add text-to-image or moderation operations to the Drupal AI module?

Yes, you can add structured input/output transformations like text-to-image, moderation, and classification as new provider-supported AI operations. This requires defining the operation name, labels, method signature, and normalized output needs.

What's the best way to enforce naming conventions for AI operation types in Drupal?

Enforcing naming conventions for AI operation types is best handled by running an automated verification script. This script checks that deterministic scaffolding constraints are met, including file existence, #[OperationType] metadata format, and provider registration.

Why does my Drupal AI operation type fail provider registration?

Drupal AI operation type provider registration fails when required files are missing, signatures do not match conventions, or the EchoAI provider is not updated. Running the verification script identifies these integration gaps before deployment.