Skip to content

πŸ™Œ OpenHands: AI-Driven Development

759 B
Raw Blame
import { useQuery } from "@tanstack/react-query";
import SkillsService from "#/api/skills-service";
import { SkillInfo } from "#/types/settings";

/**
 * @param projectDir Workspace root to load project skills from. Conversation
 *   views pass the conversation's own workspace so the catalog matches the
 *   skills loaded into that conversation; the global Skills page omits it.
 */
export const useSkills = (
  projectDir?: string,
  options: { enabled?: boolean } = {},
) =>
  useQuery<SkillInfo[]>({
    queryKey: ["skills", projectDir ?? null],
    queryFn: () => SkillsService.getSkills(projectDir),
    enabled: options.enabled ?? true,
    staleTime: 1000 * 60 * 10, // 10 minutes – skill list rarely changes
    refetchOnWindowFocus: false,
  });