ワンクリックで
add-resource
Add a new Doctrine entity as a Sylius Resource (entity, repository, FormType, migration). Operations are added separately.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Add a new Doctrine entity as a Sylius Resource (entity, repository, FormType, migration). Operations are added separately.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Implement the fix described in a GitHub issue and open a Pull Request that closes it
Apply the latest review feedback to a Pull Request and push it to the PR branch
Add an admin autocomplete form type for a Sylius Resource (translatable or not), optionally injected into another form via an extension
Add an admin FormType for an existing Sylius Resource
Add a Sylius admin grid for an existing Sylius Resource
Add a multiple images collection (OneToMany) to an existing Sylius Resource
| name | add-resource |
| description | Add a new Doctrine entity as a Sylius Resource (entity, repository, FormType, migration). Operations are added separately. |
| argument-hint | [ModelName] |
| allowed-tools | AskUserQuestion, Bash, Read, Edit, Write, Glob, Grep |
Ask the user for the ModelName if not provided, and the list of fields with their types and which fields should have validation constraints (e.g. NotBlank, Length, Email).
This skill only registers the resource. To expose it in the admin, add operations via /sylius-stack:add-operation.
src/Entity/{ModelName}.php
<?php
declare(strict_types=1);
namespace App\Entity;
use App\Form\{ModelName}Type;
use App\Repository\{ModelName}Repository;
use Doctrine\ORM\Mapping as ORM;
use Sylius\Resource\Metadata\AsResource;
use Sylius\Resource\Model\ResourceInterface;
#[ORM\Entity(repositoryClass: {ModelName}Repository::class)]
#[AsResource(
section: 'admin',
routePrefix: '/admin',
templatesDir: '@SyliusAdminUi/crud',
formType: {ModelName}Type::class,
)]
class {ModelName} implements ResourceInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
// add your fields here
public function getId(): ?int
{
return $this->id;
}
}
Add the fields asked by the user with proper #[ORM\Column] attributes and getters/setters.
For fields that require validation, add Symfony constraints directly on the property:
use Symfony\Component\Validator\Constraints as Assert;
#[Assert\NotBlank]
#[Assert\Length(max: 255)]
#[ORM\Column(length: 255)]
private ?string $title = null;
src/Repository/{ModelName}Repository.php
<?php
declare(strict_types=1);
namespace App\Repository;
use App\Entity\{ModelName};
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\CreatePaginatorTrait;
class {ModelName}Repository extends ServiceEntityRepository
{
use CreatePaginatorTrait;
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, {ModelName}::class);
}
}
Run the command directly:
bin/console make:form {ModelName}Type {ModelName}
Read the generated src/Form/{ModelName}Type.php and verify the fields match what the user requested.
To add an autocomplete on a field (simple ChoiceType or AJAX entity autocomplete), run /sylius-stack:add-autocomplete afterwards.
Run both commands directly, do not ask the user:
bin/console doctrine:migrations:diff
Read the generated migration file and verify it only contains SQL for the new table.
bin/console doctrine:migrations:migrate --no-interaction
Run the command directly:
bin/console sylius:debug:resource 'App\Entity\{ModelName}'
/sylius-stack:add-operation to add CRUD operations (Create, Update, Delete, BulkDelete, Index, Show)/sylius-stack:add-grid to create an admin grid (required before adding the Index operation)/sylius-stack:add-menu to add the resource to the admin sidebar