Skip to content
Back to skills

Feature Scaffold

ASecurity

Scaffold a complete API feature end-to-end - migration, model, factory, validators, service, controller, resource/DTO, routes, tests. Use when implementing a new resource/endpoint/CRUD feature, when a task says "create/add <entity> API", or when extending a module with a new persisted entity.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 19, 2026
ai-agentstypescriptgobashexpressapifrontendbackend

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned October 19, 2026

npx -y skills add AlexWaha/agentry --skill feature-scaffold --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Feature Scaffold?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Feature Scaffold
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/alexwaha-feature-scaffold/badge)](https://www.skillsdirectory.com/skills/alexwaha-feature-scaffold)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: feature-scaffold
description: Scaffold a complete API feature end-to-end - migration, model, factory, validators, service, controller, resource/DTO, routes, tests. Use when implementing a new resource/endpoint/CRUD feature, when a task says "create/add <entity> API", or when extending a module with a new persisted entity.
allowed-tools: Read, Grep, Glob, Write, Edit, Bash
---

# Feature Scaffold

Produce every artifact of a complete API feature following the project's layering
pipeline: `Request -> Validator -> Service -> Resource/DTO -> Response`.
Concrete CLI commands live in `.agentry/project/stack.md`; the module/folder
layout in `.agentry/project/architecture.md`.

## Input

Gather before starting: resource name (singular, PascalCase), table name
(plural, snake_case), attributes (types, nullable, defaults), relationships,
auth requirement (`{{AUTH_METHOD}}`), business rules beyond CRUD.

## Steps

1. **Check sibling files for conventions.** Glob + Read existing models,
   controllers, validators, resources, services, factories, migrations, tests
   of the same kind. Match their naming, structure, and style. Run the
   Pre-Flight Checks from `rules/quality-standard.md` - the artifact may
   already exist.
2. **Migration.** Generate via the framework CLI (`{{MIGRATION_TOOL}}`), never
   hand-write the filename. Schema-only, reversible, index every column used in
   WHERE/JOIN/ORDER BY, explicit `ON DELETE` behavior on foreign keys. Details:
   `migration` skill.
3. **Model / Entity.** Data container only: fillable fields, casts,
   relationships, scopes. No business logic.
4. **Factory / test data builder.** Realistic defaults plus at least one named
   state (e.g. `inactive`).
5. **Store validator.** Field rules AND `authorize()` (authentication check).
6. **Update validator.** Partial rules ("sometimes"); `authorize()` enforces
   ownership.
7. **Service / use case.** All business logic; one method per operation;
   transactions around multi-step writes. Depends on models/services, never on
   controllers or resources.
8. **Controller / handler.** Thin: validated input -> service -> resource/DTO.
   Status codes via framework constants, never numeric literals.
9. **API Resource / DTO.** Public contract only, conditional relationship
   loading, stable versioned shape. Computed fields live here.
10. **Routes.** Versioned prefix (`/api/v1/...`), named, behind the
    `{{AUTH_METHOD}}` middleware/guard.
11. **Tests.** All 5 categories per endpoint - 401, 403, 422, 200/201, 404 -
    plus edge cases. Details: `write-tests` skill.
12. **Quality gate.** `{{FORMAT_CMD}}` -> `{{LINT_CMD}}` -> `{{TEST_CMD}}` ->
    grep the diff for forbidden debug patterns. Details: `health-check` skill.

## Output checklist

- [ ] Migration generated via CLI, runs, is reversible, indexes in place
- [ ] Model has fillable, casts, relationships, scopes - no business logic
- [ ] Factory has realistic defaults and at least one state
- [ ] Store validator: `authorize()` + complete field rules
- [ ] Update validator: ownership check + partial rules
- [ ] Service holds all business logic (list / create / update / delete)
- [ ] Controller is thin; resource/DTO shapes the response
- [ ] Routes versioned, named, auth-guarded
- [ ] Tests cover 401 / 403 / 422 / 2xx / 404 + edge cases
- [ ] Formatter, linter, tests all pass; no forbidden patterns in the diff

## References (read only when needed)

- [references/backend-layering.md](references/backend-layering.md) - per-layer
  code examples (Laravel, Prisma, Zod, TypeScript, Express, Pest) and layer
  responsibility rules
- [references/frontend-patterns.md](references/frontend-patterns.md) - web and
  mobile component patterns, shared state, API client, component tests

Files in this skill

  • SKILL.md3.7 KB
  • references/backend-layering.md10.6 KB
  • references/frontend-patterns.md6.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.