.agents/skills/frontend-query-mutation/SKILL.md
Guide for implementing Dify frontend query and mutation patterns with TanStack Query and oRPC. Trigger when creating or updating contracts in web/contract, wiring router composition, consuming consoleQuery or marketplaceQuery in components or services, deciding whether to call queryOptions() directly or extract a helper or use-* hook, handling conditional queries, cache invalidation, mutation error handling, or migrating legacy service calls to contract-first query and mutation helpers.
npx skillsauth add langgenius/dify frontend-query-mutationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
web/contract/*.queryOptions() and mutationOptions().references/contract-patterns.md for contract files, router composition, client helpers, and query or mutation call-site shape.references/runtime-rules.md for conditional queries, invalidation, error handling, and legacy migrations.useQuery(...) or useMutation(...) calls with oRPC helpers at the call site.web/service/use-{domain}.ts only for orchestration or shared domain behavior.{ params, query?, body? } shape.mutate(...); use mutateAsync(...) only when Promise semantics are required.web/contract/console/*.tsweb/contract/marketplace.tsweb/contract/router.tsweb/service/client.tsweb/service/use-*.tsconsoleQuery or marketplaceQueryreferences/contract-patterns.md for contract shape, router registration, query and mutation helpers, and anti-patterns that degrade inference.references/runtime-rules.md for conditional queries, invalidation, mutate versus mutateAsync, and legacy migration rules.Treat this skill as the single query and mutation entry point for Dify frontend work. Keep detailed rules in the reference files instead of duplicating them in project docs.
development
Generate Vitest + React Testing Library tests for Dify frontend components, hooks, and utilities. Triggers on testing, spec files, coverage, Vitest, RTL, unit tests, integration tests, or write/review test requests.
development
Trigger when the user requests a review of frontend files (e.g., `.tsx`, `.ts`, `.js`). Support both pending-change reviews and focused file reviews while applying the checklist rules.
testing
Write, update, or review Dify end-to-end tests under `e2e/` that use Cucumber, Gherkin, and Playwright. Use when the task involves `.feature` files, `features/step-definitions/`, `features/support/`, `DifyWorld`, scenario tags, locator/assertion choices, or E2E testing best practices for this repository.
development
Refactor high-complexity React components in Dify frontend. Use when `pnpm analyze-component --json` shows complexity > 50 or lineCount > 300, when the user asks for code splitting, hook extraction, or complexity reduction, or when `pnpm analyze-component` warns to refactor before testing; avoid for simple/well-structured components, third-party wrappers, or when the user explicitly wants testing without refactoring.