Agent skill
frontend-query-mutation
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.
Install this agent skill to your Project
npx add-skill https://github.com/langgenius/dify/tree/main/.agents/skills/frontend-query-mutation
SKILL.md
Frontend Query & Mutation
Intent
- Keep contract as the single source of truth in
web/contract/*. - Prefer contract-shaped
queryOptions()andmutationOptions(). - Keep invalidation and mutation flow knowledge in the service layer.
- Keep abstractions minimal to preserve TypeScript inference.
Workflow
- Identify the change surface.
- Read
references/contract-patterns.mdfor contract files, router composition, client helpers, and query or mutation call-site shape. - Read
references/runtime-rules.mdfor conditional queries, invalidation, error handling, and legacy migrations. - Read both references when a task spans contract shape and runtime behavior.
- Read
- Implement the smallest abstraction that fits the task.
- Default to direct
useQuery(...)oruseMutation(...)calls with oRPC helpers at the call site. - Extract a small shared query helper only when multiple call sites share the same extra options.
- Create
web/service/use-{domain}.tsonly for orchestration or shared domain behavior.
- Default to direct
- Preserve Dify conventions.
- Keep contract inputs in
{ params, query?, body? }shape. - Bind invalidation in the service-layer mutation definition.
- Prefer
mutate(...); usemutateAsync(...)only when Promise semantics are required.
- Keep contract inputs in
Files Commonly Touched
web/contract/console/*.tsweb/contract/marketplace.tsweb/contract/router.tsweb/service/client.tsweb/service/use-*.ts- component and hook call sites using
consoleQueryormarketplaceQuery
References
- Use
references/contract-patterns.mdfor contract shape, router registration, query and mutation helpers, and anti-patterns that degrade inference. - Use
references/runtime-rules.mdfor conditional queries, invalidation,mutateversusmutateAsync, 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.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
backend-code-review
Review backend code for quality, security, maintainability, and best practices based on established checklist rules. Use when the user requests a review, analysis, or improvement of backend files (e.g., `.py`) under the `api/` directory. Do NOT use for frontend files (e.g., `.tsx`, `.ts`, `.js`). Supports pending-change review, code snippets review, and file-focused review.
frontend-testing
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.
frontend-code-review
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.
component-refactoring
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.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
claude-code-expert
Especialista profundo em Claude Code - CLI da Anthropic. Maximiza produtividade com atalhos, hooks, MCPs, configuracoes avancadas, workflows, CLAUDE.md, memoria, sub-agentes, permissoes e integracao com ecossistemas.
Didn't find tool you were looking for?