Master backend architectures, REST API design, microservices, and server-side development across multiple languages. Use this as a central index to access specialized sub-skills.
日本語の概要は準備中です。原文の説明を表示しています。
Generates Saga pattern components for PHP 8.5. Creates Saga interfaces, steps, orchestrator, state management, and compensation logic with unit tests.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
Creates Saga pattern infrastructure for distributed transaction coordination.
Determine:
Create in this order:
Domain Layer (src/Domain/Shared/Saga/)
SagaState.php — State enum with transitionsStepResult.php — Step result value objectSagaStepInterface.php — Step contractSagaContext.php — Execution contextSagaResult.php — Saga resultApplication Layer (src/Application/Shared/Saga/)
SagaPersistenceInterface.php — Persistence portSagaRecord.php — Persisted recordAbstractSagaStep.php — Base step classSagaOrchestrator.php — OrchestratorInfrastructure Layer
DoctrineSagaPersistence.php — Doctrine implementationTests
SagaStateTest.phpSagaOrchestratorTest.phpFor each saga step (e.g., Order saga):
src/Application/{Context}/Saga/Step/
├── ReserveInventoryStep.php
├── ChargePaymentStep.php
└── CreateShipmentStep.php
src/Application/{Context}/Saga/
└── {Context}SagaFactory.php
| Layer | Path |
|---|---|
| Domain Types | src/Domain/Shared/Saga/ |
| Application Saga | src/Application/Shared/Saga/ |
| Context Steps | src/Application/{Context}/Saga/Step/ |
| Saga Factory | src/Application/{Context}/Saga/ |
| Infrastructure | src/Infrastructure/Persistence/Doctrine/Repository/ |
| Unit Tests | tests/Unit/{Layer}/{Path}/ |
Pending → Running → Completed
↓
Compensating → Failed
↓
CompensationFailed
| Component | Pattern | Example |
|---|---|---|
| State Enum | SagaState | SagaState |
| Step Interface | SagaStepInterface | SagaStepInterface |
| Abstract Step | AbstractSagaStep | AbstractSagaStep |
| Concrete Step | {Action}Step | ReserveInventoryStep |
| Orchestrator | SagaOrchestrator | SagaOrchestrator |
| Factory | {Name}SagaFactory | OrderSagaFactory |
| Test | {ClassName}Test | SagaOrchestratorTest |
interface SagaStepInterface
{
public function name(): string;
public function execute(SagaContext $context): StepResult;
public function compensate(SagaContext $context): StepResult;
public function isIdempotent(): bool;
public function timeout(): int;
}
final readonly class StepResult
{
public static function success(array $data = []): self;
public static function failure(string $error): self;
public function isSuccess(): bool;
public function isFailure(): bool;
}
final readonly class {Action}Step extends AbstractSagaStep
{
public function name(): string
{
return '{action_name}';
}
public function execute(SagaContext $context): StepResult
{
$idempotencyKey = $this->idempotencyKey($context);
// Check for existing result (idempotency)
// Execute action
// Return StepResult::success([...data...]) or failure
}
public function compensate(SagaContext $context): StepResult
{
// Get data from context
// Undo action
// Handle "already undone" gracefully
return StepResult::success();
}
}
// Create saga
$saga = $orderSagaFactory->create($command);
// Execute
$result = $saga->execute();
if ($result->isCompleted()) {
// Success
} elseif ($result->isFailed()) {
// Failed but compensated
$error = $result->error;
} elseif ($result->isCompensationFailed()) {
// Needs manual intervention
$originalError = $result->error;
$compensationError = $result->compensationError;
}
# Symfony services.yaml
Domain\Shared\Saga\SagaStepInterface:
tags: ['saga.step']
Application\Shared\Saga\SagaPersistenceInterface:
alias: Infrastructure\Persistence\Doctrine\Repository\DoctrineSagaPersistence
Application\Order\Saga\OrderSagaFactory:
arguments:
$reserveStep: '@Application\Order\Saga\Step\ReserveInventoryStep'
$chargeStep: '@Application\Order\Saga\Step\ChargePaymentStep'
$shipStep: '@Application\Order\Saga\Step\CreateShipmentStep'
CREATE TABLE sagas (
id VARCHAR(255) PRIMARY KEY,
type VARCHAR(255) NOT NULL,
state VARCHAR(50) NOT NULL,
completed_steps JSONB NOT NULL DEFAULT '[]',
context JSONB NOT NULL,
error TEXT,
created_at TIMESTAMP(6) NOT NULL,
updated_at TIMESTAMP(6) NOT NULL,
completed_at TIMESTAMP(6)
);
CREATE INDEX idx_sagas_state ON sagas (state);
CREATE INDEX idx_sagas_type_state ON sagas (type, state);
For complete PHP templates and test examples, see:
references/templates.md — All component templatesreferences/examples.md — Order saga example and unit testsまだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Master backend architectures, REST API design, microservices, and server-side development across multiple languages. Use this as a central index to access specialized sub-skills.
日本語の概要は準備中です。原文の説明を表示しています。
在每次回复中使用固定前缀并列出本次实际参考的指令/文件,便于校验是否遵循上下文与规则。
日本語の概要は準備中です。原文の説明を表示しています。
Automate 21risk tasks via Rube MCP (Composio). Always search tools first for current schemas.
日本語の概要は準備中です。原文の説明を表示しています。
Automate 2chat tasks via Rube MCP (Composio). Always search tools first for current schemas.
日本語の概要は準備中です。原文の説明を表示しています。
Arquitecto de Soluciones Principal y Consultor Tecnológico de Andru.ia. Diagnostica y traza la hoja de ruta óptima para proyectos de IA en español.
日本語の概要は準備中です。原文の説明を表示しています。
[00] META. Orchestrate skills into dynamic chains for complex tasks. Analyzes the task, discovers available skills, builds an optimal chain, explains why each skill is needed, and executes step-by-step with user confirmation. Use for any complex task requiring multiple thinking/research/analysis steps. Triggers on "plan this", "how to approach", "what's the strategy", "build a plan", or any multi-step problem requiring skill orchestration.
日本語の概要は準備中です。原文の説明を表示しています。