# Build Reliable Backend Models

Backend teams need consistent model definitions that match database and ORM standards. This skill guides AI assistants through model naming, relationships, casts, validation, factories, and seeders.

## Install

```bash
npx skillstore add devanb/backend-models
```

## Metadata

- Status: approved
- Slug: devanb-backend-models
- Skillstore revision: r1
- Version status: missing
- Tree hash: 2f7a0042b680eb7bbc069308b7eb06421f640c829e80deb4f70ea28a21f85738
- Author: DevanB
- GitHub username: DevanB
- License: MIT
- Repository: https://github.com/DevanB/lucidlog/tree/master/.claude/skills/backend-models
- Ref: 0519034dad657fb1f7706e0550e962beeda73fdf
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, filesystem
- Quality score: 79
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/devanb-backend-models
- Manifest: https://skillstore.pages.dev/api/skills/devanb-backend-models/manifest

## Capabilities

- Guides creation and editing of model files under app/Models/ and similar directories.
- Covers Eloquent relationships including hasMany, belongsTo, belongsToMany, hasOne, and morphTo.
- Provides direction for casts, fillable fields, hidden attributes, timestamps, and soft deletes.
- Supports model validation logic, scopes, accessors, mutators, events, and observers.
- Includes guidance areas for factories, seeders, database constraints, foreign keys, and indexes.

## Use Cases

- Create Project Models: Draft model definitions with names, attributes, relationships, timestamps, casts, and validation needs.
- Prepare Test Data: Plan factories and seeders that match model attributes, relationships, and database constraints.
- Review Model Consistency: Check existing model files for relationship accuracy, fillable fields, hidden attributes, scopes, and soft delete setup.

## Prompt Templates

### Create a Basic Model

```
Use the backend-models skill to draft an Eloquent model for [entity] with fillable fields [fields] and timestamps.
```

### Add Relationships and Casts

```
Use the backend-models skill to update [model] with relationships to [related models], casts for [fields], and hidden attributes for [fields].
```

### Review Model Constraints

```
Use the backend-models skill to review [model] against these migration details: [summary]. Check constraints, indexes, validation, and scopes.
```

### Design a Model Layer

```
Use the backend-models skill to design models for [feature]. Include entities, relationships, casts, validation rules, factories, seeders, indexes, and observer needs.
```

## Limitations

- The detailed standards are delegated to an external relative Markdown link.
- It does not include executable generators or migration automation.
- It does not validate a real database schema without project context.
- It focuses on ORM model configuration, not controller or API design.

## Best Practices

- Provide table names, key fields, and relationship cardinality before asking for model changes.
- Ask for casts, fillable fields, hidden attributes, and validation rules in the same model review.
- Confirm model guidance against migrations and database constraints before implementation.

## Anti Patterns

- Do not ask the skill to infer private schema details without project context.
- Do not treat model guidance as a substitute for migration or database review.
- Do not reference missing external standard files without sharing the relevant rules.

## Security Audit

- Audited at: 2026-07-09T12:39:03.724\+00:00
- Summary: The external command finding is a false positive caused by Markdown backticks around a path, with no command execution. The filesystem finding is confirmed because SKILL.md points agents to a parent-directory file outside the skill package using ../../../. No prompt injection, exfiltration intent, or other semantic abuse was found in SKILL.md.

## Stats

- Views: 185
- Downloads: 14
- Favorites: 0
- Popularity score: 0
