Skip to content
Agentmart
Submit a tool

entity-models

Model API entities as classes inside model/, including base model inheritance, relation helpers, model-to-model composition, and route-to-model instance flows.

Skill by werlang

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/werlang-entity-models

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Model API entities as classes inside model/, including base model inheritance, relation helpers, model-to-model composition, and route-to-model instance flows. Use when creating entities, join-table relations, persistence methods, or routes that should coordinate model instances through a shared database driver helper.

Use cases: backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Node.js package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/entity-models

What's inside

Skill name
entity-models
Description
Model API entities as classes inside model/, including base model inheritance, relation helpers, model-to-model composition, and route-to-model instance flows. Use when creating entities, join-table relations, persistence methods, or routes that should coordinate model instances through a shared database driver helper.
License
MIT
Instructions
34 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (9)

  • SKILL.md
  • entity-models.md · references/
  • error.js · references/mini-project/src/helpers/
  • mysql.js · references/mini-project/src/helpers/
  • article.js · references/mini-project/src/model/
  • model.js · references/mini-project/src/model/
  • relation.js · references/mini-project/src/model/
  • user.js · references/mini-project/src/model/
  • articles.js · references/mini-project/src/routes/

SKILL.md (first lines)

# Entity Models

Use this skill when entities should be implemented as classes and relationships should stay in the model layer.

## Rules

- Put entity classes in `model/`.
- Export named classes only.
- Instantiate models in routes instead of passing raw objects around.
- Keep relation logic in models or dedicated relation helpers.
- Keep persistence logic in models and delegate database access to a shared driver helper.
- Let routes orchestrate request-level work through model instances.
- **Mass Assignment Defense**: Whitelist explicitly permitted fields on model create/update methods; never assign raw `req.body` directly to database persistence layers per [`security-defense-and-mitigation`](../security-defense-and-mitigation/SKILL.md).
- **IDOR / BOLA Prevention**: Always scope entity query and mutation methods by the authenticated account/tenant ID (`where owner_id = ?`) to ensure unauthorized cross-user access is impossible.
- **Rich Domain Encapsulation**: Keep validation invariants and domain business rules inside entity methods rather than in anemic data bags per [`clean-code-and-oop`](../clean-code-and-oop/SKILL.md).

## Relation Pattern

Use a small relation helper for join tables and many-to-many behavior.

Typical responsibilities:

- check relation existence
- insert relation rows
- replace relation sets
- delete relation rows
- list related rows

## References

- Read `references/entity-models.md` for the generic architecture.
- Read `references/mini-project/` for a small relation-aware example.
- Pair with [`api-building`](../api-building/SKILL.md), [`security-defense-and-mitigation`](../security-defense-and-mitigation/SKILL.md), and [`clean-code-and-oop`](../clean-code-and-oop/SKILL.md).

From werlang/user-skills, MIT.

More from werlang/user-skills

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Oct 16, 2026 (13 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from werlang

Cite this page

entity-models skill. Agent Mart. https://agentmart.dev/skills/werlang-entity-models (last updated 2026-10-24)