Agent Skills
› authgear/authgear-server
› add-portal-admin-api-query
add-portal-admin-api-query
GitHub指导在 Portal Admin 中添加 GraphQL 查询的标准流程,包括读取 schema、创建文件、处理分页及类型生成。
Trigger Scenarios
需要添加 Portal Admin GraphQL 查询
前端页面需要特定数据且需服务端过滤
Install
npx skills add authgear/authgear-server --skill add-portal-admin-api-query -g -y
SKILL.md
Frontmatter
{
"name": "add-portal-admin-api-query",
"description": "Add a Portal Admin GraphQL query under portal\/src\/graphql\/adminapi\/query.",
"argument-hint": "<query name>"
}
Follow this skill when adding a Portal Admin GraphQL query.
Workflow
- Read
./portal/src/graphql/adminapi/schema.graphqlfirst. - Create the
.graphqlfile under./portal/src/graphql/adminapi/query. - Include
cursor,pageInfo, andtotalCountwhen the query supports pagination and the user did not ask to omit them. - Query the fields of the entity itself, but avoid nested entities unless the user asked for them.
- Fetch only the records the screen needs, filtered on the server by what it already knows (the IDs on its rows). Do not list a whole collection to pick items out on the client: page size is silently capped, usually at 100. If the schema has no such filter, stop and propose the API change instead of working around it — see "Query only the data the screen needs" in the
update-portal-uiskill. - Run
cd ./portal && npm run gentypeafter adding the file.
Notes
- Keep the operation name consistent with existing Portal GraphQL naming.
- Do not invent schema fields; use only what exists in the schema file.
Version History
-
8690720
Current 2026-10-19 04:00
新增错误处理、查询范围限制和常量复用规则;修正因静默分页截断导致的数据缺失问题。
- 2dd6d88 2026-07-24 16:30


