OpenParable
Skip to content
← Back to skills

Create Backend Entity

Development
create-backend-entity

Create Backend Entity is an Agent Skill for development published in the erxes/erxes repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Add or extend Mongoose-backed erxes backend entities, models, GraphQL schemas, resolvers, permissions, and metadata. Use for backend plugin or service feature work.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/erxes/erxes/blob/HEAD/.agents/skills/create-backend-entity/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/create-backend-entity, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Skill: Create Backend Entity

Workflow

  1. Identify the owning service or backend plugin.
  2. Search for the closest existing module with the same shape.
  3. Add or update local types/constants under the feature's existing @types, types, or constants.ts pattern.
  4. Add Mongoose schema changes in db/definitions and model/static methods in db/models when that is how the service is organized.
  5. Update GraphQL schema strings, query resolvers, mutation resolvers, and custom resolvers together when the API contract changes.
  6. Update tRPC routers only when the module already exposes equivalent tRPC behavior or the task requires it.
  7. Check permission definitions, checkPermission, activity logs, import/export, automation, segment, relation, and notification metadata only when the feature's existing behavior or the requested task requires it.
  8. Run focused validation for the owning project, usually pnpm nx build <api-project> and tests if they exist or behavior changed.

Important

  • erxes uses MongoDB and Mongoose, not TypeORM or NestJS entity patterns.
  • For new backend schemas, follow the operation plugin pattern: define schemas directly with new Schema(...), explicit fields, and local options. Do not introduce new schemaWrapper usage.
  • Preserve existing string ID conventions unless the local collection uses ObjectIds.
  • Keep business validation in the model/service layer when nearby code does.
  • Do not modify frontend GraphQL documents without checking existing operations and fragments first.
  • Do not change backend contracts only to simplify one frontend screen unless explicitly requested.