一键导入
opik-frontend
React frontend patterns for Opik. Use when working in apps/opik-frontend, on components, state, or data fetching.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
React frontend patterns for Opik. Use when working in apps/opik-frontend, on components, state, or data fetching.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | opik-frontend |
| description | React frontend patterns for Opik. Use when working in apps/opik-frontend, on components, state, or data fetching. |
// ❌ BAD
useEffect(() => {
fetch('/api/data').then(setData);
}, []);
// ✅ GOOD
const { data } = useQuery({
queryKey: ['data'],
queryFn: fetchData,
});
// ✅ USE useMemo for: complex computations, large data transforms
const filtered = useMemo(() =>
data.filter(x => x.status === 'active').map(transform),
[data]
);
// ✅ USE useCallback for: functions passed to children
const handleClick = useCallback(() => doSomething(id), [id]);
// ❌ DON'T memoize: simple values, primitives, local functions
const name = data?.name ?? ''; // No useMemo needed
// ✅ GOOD - specific selector
const selectedEntity = useEntityStore(state => state.selectedEntity);
// ❌ BAD - selecting entire store causes re-renders
const { selectedEntity, filters } = useEntityStore();
ui → shared (one-way only)
ui → shared → v1/pages-shared → v1/pages (one-way only)
ui → shared → v2/pages-shared → v2/pages (one-way only)
src/components/ is BLOCKED (old structure, no longer exists)npm run deps:validateshowProjectSelector={true} not isV2={true})const Component: React.FC<Props> = ({ prop }) => {
// 1. State hooks
// 2. Queries/mutations
// 3. Memoization (only when needed)
// 4. Event handlers
if (isLoading) return <Loader />;
if (error) return <ErrorComponent />;
return <div>...</div>;
};
// Query with params
const { data } = useQuery({
queryKey: [ENTITY_KEY, params],
queryFn: (context) => fetchEntity(context, params),
});
// Mutation with invalidation
const mutation = useMutation({
mutationFn: updateEntity,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: [ENTITY_KEY] });
},
});
usePermissions() guard guidance for UI actionsUse when a developer wants to add, write, or create an end-to-end test for an Opik feature, page, or branch — e.g. "add an e2e test for the experiments comparison page", "write a test for the feature I just built", "e2e test for this branch", "cover the dataset items flow with a test". Runs the full loop in tests_end_to_end/e2e/ — analyze the feature and frontend code, explore the live UI with the Playwright MCP, write the Page Object Model + spec, and run it locally until green.
Use when an Opik E2E test has failed and a developer wants it investigated — e.g. "why did this e2e test fail?", "investigate the failing run on my PR", "is dataset-crud-smoke flaky?", "the nightly e2e suite went red". Takes a failure from a CI check, a TestOps launch, a test name, or a local run; gathers the trace and history, classifies regression vs. flake, and proposes a fix. Read-only — it diagnoses and proposes, it does not edit tests.
Use when building or extending a Page Object Model (POM) for the Opik E2E suite (under `tests_end_to_end/e2e/pom/`) and you need to choose stable selectors against the live UI. Walks through seeding required state, exploring the running page with the Playwright MCP (accessibility snapshot + data-testid enumeration), picking the most stable locator for each element, and verifying it before committing. Used as the discovery sub-step by the `writing-e2e-tests` skill.
Java backend patterns for Opik. Use when working in apps/opik-backend, designing APIs, database operations, or services.
Python SDK patterns for Opik. Use when working in sdks/python, on SDK APIs, integrations, or message processing.
Generate self-contained HTML architecture diagrams. Use when creating visual diagrams for PRs, task plans, or architectural explanations.