# Create Query

> Create Query 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 reuse erxes frontend GraphQL queries, mutations, fragments, subscriptions, and Apollo hooks. Use for frontend data-fetching changes.

- Skill name: `create-query`
- Category: [Development](https://www.openparable.com/skill/development/1)
- Source: https://github.com/erxes/erxes/blob/HEAD/.agents/skills/create-query/SKILL.md
- Repository: erxes/erxes (4,036 GitHub stars when collected)

## SKILL.md

# Skill: Create GraphQL Query

## Workflow

1. Search existing queries
2. Search fragments
3. Search existing hooks
4. Reuse existing GraphQL structure
5. Name new operations with the plugin or module prefix plus purpose, such as
   `operationTaskList` or `cmsPageList`
6. Keep query near feature module
7. Reuse Apollo patterns
8. For mutations or subscriptions, ensure affected visible data updates without
   a browser refresh through cache updates, refetching, or `subscribeToMore`
9. Preserve typings
10. Run focused validation: `pnpm nx lint <plugin>` and
   `pnpm nx build <plugin>`

## Important

- Avoid duplicate queries
- Keep operation names unique
- Reuse fragments/hooks first
- Do not leave stale lists, counters, details, or selectors after a mutation
- Preserve current API contracts
- Do not change backend GraphQL contracts from frontend work unless explicitly
  requested

---

Source: https://www.openparable.com/skill/development/create-query (OpenParable). Cite the canonical URL above.
