scaffold-factory
SKILL.md
Laravel Factory Scaffold Skill
Use this skill when defining test data generators for Models.
Conventions
1. Sensible Faker Data
- Use
$this->fakermethods that match the column type contextually. - Email:
safeEmail()(never real emails). - Text:
paragraph()orsentence()depending on length. - Enums:
fake()->randomElement(Enum::cases()).
2. State Methods
- Create state methods for every boolean flag or status enum in the model.
- This makes tests readable:
User::factory()->active()->admin()->create().
public function admin(): static
{
return $this->state(fn (array $attributes) => [
'role' => UserRole::Admin,
]);
}
public function suspended(): static
{
return $this->state(fn (array $attributes) => [
'suspended_at' => now(),
]);
}
3. Relationships
- For "BelongsTo" relationships, create the parent factory by default in the definition.
'user_id' => User::factory(),
Weekly Installs
3
Repository
iurygdeoliveira…bsis-kitGitHub Stars
31
First Seen
Jan 24, 2026
Security Audits
Installed on
claude-code2
windsurf1
trae1
opencode1
codex1
antigravity1