用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Bottelet/DaybydayCRM --skill dto-contract命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Defines structural rules for Laravel architecture, layering, and code organization
Defines application service structure and business orchestration boundaries
Governs safe, incremental, repository-wide development workflow with continuous validation gates
基于 SOC 职业分类
正在显示 SKILL.md
| name | dto-contract |
| description | Defines DTO structure, lifecycle, and transformation rules across the application |
| license | MIT |
| metadata | {"author":"project"} |
DTOs define structured, transport-safe data contracts used between layers of the application.
They exist to replace unstructured arrays when data shape matters, is reused, or must remain consistent across boundaries.
DTOs MUST:
DTOs MUST NOT:
Request, Eloquent models, etc.)DTOs are simple POPOs with fluent getters and setters.
Example:
class InvoiceDto
{
private int $invoiceId;
private int $companyId;
private float $amount;
public function getInvoiceId(): int
{
return $this->invoiceId;
}
public function setInvoiceId(int $invoiceId): self
{
$this->invoiceId = $invoiceId;
return $this;
}
public function getCompanyId(): int
{
return $this->companyId;
}
public function setCompanyId(int $companyId): self
{
$this->companyId = $companyId;
return $this;
}
public function getAmount(): float
{
return $this->amount;
}
public function setAmount(float $amount): self
{
$this->amount = $amount;
return $this;
}
}
DTOs MUST be created via Transformers.
$dto = InvoiceTransformer::fromModel($invoice);
or
$dto = InvoiceTransformer::fromArray($data);
DTOs MUST NOT be manually assembled inside services unless trivial and explicitly justified.
Transformers are the ONLY layer allowed to construct DTOs.
DTOs MUST NOT depend on Transformers.
Direction is strictly:
Model / Array → Transformer → DTO → Service
Use DTOs when:
DTOs MAY be skipped when:
FormRequestDTOs are explicit data contracts, not business logic containers.
DTOs MAY include region markers to improve IDE navigation (e.g. PhpStorm folding).
These are purely cosmetic and MUST NOT affect runtime behavior or architecture decisions.
Example:
class InvoiceDto
{
#region Properties
private int $invoiceId;
private int $companyId;
private float $amount;
#endregion
#region Getters
public function getInvoiceId(): int { ... }
public function getCompanyId(): int { ... }
public function getAmount(): float { ... }
#endregion
#region Setters
public function setInvoiceId(int $invoiceId): self { ... }
public function setCompanyId(int $companyId): self { ... }
public function setAmount(float $amount): { ... }
}
They exist to stabilize data shape across the system, not to introduce unnecessary abstraction.