hadyfayed/laravel-agent/dto-make
Claude Code and agent skill by hadyfayed/laravel-agent
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Generate a typed DTO with spatie/laravel-data, validation, and casting; when creating data transfer objects.
Install
npx vskill@latest install hadyfayed/laravel-agent/dto-makeSKILL.md
The same SKILL.md was published earlier as hadyfayed/laravel-agent/dto-make.
Task
Generate a type-safe Data Transfer Object using spatie/laravel-data for request validation, API responses, and data transformation.
Input
- Name: DTO class name (e.g.,
CreateUserData,ProductData,OrderData) - from: Origin type (default:
request) request— Input validation from form/requestmodel— Transform Eloquent model to DTOarray— Basic array-to-object conversion- resource: Include API resource transformation methods
Steps
- Install spatie/laravel-data if not present:
``bash composer require spatie/laravel-data ``
- Create DTO class in
app/Data/<Name>.php:
- Constructor with typed properties
- Validation rules (via attributes or static methods)
- Cast definitions for special types (Carbon, Enum, etc.)
- Transform methods if
--resourceflag is set
- Choose template based on your use case:
- Basic DTO — Simple properties, minimal validation
- DTO with Validation — Attribute-based validation rules
- DTO from Model — Resource transformation with lazy loading
- Nested DTOs — Multi-level data structures with collections
- DTO with Enum — Type-safe status/state fields
- Controller integration:
- Use DTO directly in method signature for auto-validation
- Use
from()factory to construct from arrays or models - Use
validateAndCreate()for manual validation
- Tests:
- Create test with sample data
- Verify validation rules fire on invalid input
- Test model-to-DTO transformation if applicable
Reference
For comprehensive patterns and examples:
${CLAUDE_SKILL_DIR}/references/basic-patterns.md— Template examples${CLAUDE_SKILL_DIR}/references/validation-and-casts.md— Validation rules and type casts${CLAUDE_SKILL_DIR}/references/resource-transformation.md— API response patterns
Security guardrails
- Never expose sensitive fields (passwords, tokens) in DTOs
- Always validate enum values; do not trust user input
- Use
Lazyfor expensive relationships to avoid N+1 queries - Sanitize string fields before casting to prevent injection
- Store DTOs with proper type hints for IDE support
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/dto-make/SKILL.md
Popularity
- Repository stars
- 13
- Repository forks
- 1
- 7-day trend score
- 13
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hadyfayed/laravel-agent/dto-make)