quiver-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -0
- package/bin/quiver-cli.mjs +2 -0
- package/dist/cli.js +3074 -0
- package/package.json +55 -0
- package/template/.agents/AGENTS.md +25 -0
- package/template/.agents/commands/cp.md +116 -0
- package/template/.agents/commands/next-setup.md +1064 -0
- package/template/.agents/commands/tf-readme.md +38 -0
- package/template/.agents/config.json +60 -0
- package/template/.agents/skills/agent-browser/SKILL.md +55 -0
- package/template/.agents/skills/apps/skybridge/SKILL.md +46 -0
- package/template/.agents/skills/apps/skybridge/references/architecture.md +175 -0
- package/template/.agents/skills/apps/skybridge/references/copy-template.md +24 -0
- package/template/.agents/skills/apps/skybridge/references/csp.md +33 -0
- package/template/.agents/skills/apps/skybridge/references/deploy.md +33 -0
- package/template/.agents/skills/apps/skybridge/references/discover.md +84 -0
- package/template/.agents/skills/apps/skybridge/references/download-file.md +77 -0
- package/template/.agents/skills/apps/skybridge/references/fetch-and-render-data.md +151 -0
- package/template/.agents/skills/apps/skybridge/references/oauth.md +115 -0
- package/template/.agents/skills/apps/skybridge/references/open-external-links.md +71 -0
- package/template/.agents/skills/apps/skybridge/references/prompt-llm.md +20 -0
- package/template/.agents/skills/apps/skybridge/references/publish.md +19 -0
- package/template/.agents/skills/apps/skybridge/references/run-locally.md +51 -0
- package/template/.agents/skills/apps/skybridge/references/state-and-context.md +151 -0
- package/template/.agents/skills/apps/skybridge/references/ui-guidelines.md +205 -0
- package/template/.agents/skills/code/cleanup/SKILL.md +26 -0
- package/template/.agents/skills/code/vercel-react-best-practices/AGENTS.md +3810 -0
- package/template/.agents/skills/code/vercel-react-best-practices/README.md +123 -0
- package/template/.agents/skills/code/vercel-react-best-practices/SKILL.md +149 -0
- package/template/.agents/skills/code/vercel-react-best-practices/metadata.json +15 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/_sections.md +46 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/_template.md +28 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-effect-event-deps.md +56 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-cheap-condition-before-await.md +37 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-defer-await.md +82 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-analyzable-paths.md +63 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-barrel-imports.md +60 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-flatmap-filter.md +60 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-request-idle-callback.md +105 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-resource-hints.md +85 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-script-defer-async.md +68 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-no-inline-components.md +82 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-split-combined-hooks.md +64 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-use-deferred-value.md +59 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-hoist-static-io.md +149 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-no-shared-module-state.md +50 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-parallel-nested-fetching.md +34 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/template/.agents/skills/data/prisma-cli/SKILL.md +247 -0
- package/template/.agents/skills/data/prisma-cli/references/db-execute.md +78 -0
- package/template/.agents/skills/data/prisma-cli/references/db-pull.md +185 -0
- package/template/.agents/skills/data/prisma-cli/references/db-push.md +148 -0
- package/template/.agents/skills/data/prisma-cli/references/db-seed.md +188 -0
- package/template/.agents/skills/data/prisma-cli/references/debug.md +46 -0
- package/template/.agents/skills/data/prisma-cli/references/dev.md +157 -0
- package/template/.agents/skills/data/prisma-cli/references/format.md +48 -0
- package/template/.agents/skills/data/prisma-cli/references/generate.md +173 -0
- package/template/.agents/skills/data/prisma-cli/references/init.md +136 -0
- package/template/.agents/skills/data/prisma-cli/references/mcp.md +38 -0
- package/template/.agents/skills/data/prisma-cli/references/migrate-deploy.md +127 -0
- package/template/.agents/skills/data/prisma-cli/references/migrate-dev.md +145 -0
- package/template/.agents/skills/data/prisma-cli/references/migrate-diff.md +89 -0
- package/template/.agents/skills/data/prisma-cli/references/migrate-reset.md +78 -0
- package/template/.agents/skills/data/prisma-cli/references/migrate-resolve.md +57 -0
- package/template/.agents/skills/data/prisma-cli/references/migrate-status.md +65 -0
- package/template/.agents/skills/data/prisma-cli/references/studio.md +137 -0
- package/template/.agents/skills/data/prisma-cli/references/validate.md +53 -0
- package/template/.agents/skills/data/prisma-client-api/SKILL.md +216 -0
- package/template/.agents/skills/data/prisma-client-api/references/client-methods.md +223 -0
- package/template/.agents/skills/data/prisma-client-api/references/constructor.md +208 -0
- package/template/.agents/skills/data/prisma-client-api/references/filters.md +256 -0
- package/template/.agents/skills/data/prisma-client-api/references/model-queries.md +281 -0
- package/template/.agents/skills/data/prisma-client-api/references/query-options.md +276 -0
- package/template/.agents/skills/data/prisma-client-api/references/raw-queries.md +194 -0
- package/template/.agents/skills/data/prisma-client-api/references/relations.md +308 -0
- package/template/.agents/skills/data/prisma-client-api/references/transactions.md +184 -0
- package/template/.agents/skills/design/impeccable/SKILL.md +176 -0
- package/template/.agents/skills/design/impeccable/reference/adapt.md +311 -0
- package/template/.agents/skills/design/impeccable/reference/animate.md +201 -0
- package/template/.agents/skills/design/impeccable/reference/audit.md +133 -0
- package/template/.agents/skills/design/impeccable/reference/bolder.md +113 -0
- package/template/.agents/skills/design/impeccable/reference/brand.md +108 -0
- package/template/.agents/skills/design/impeccable/reference/clarify.md +288 -0
- package/template/.agents/skills/design/impeccable/reference/codex.md +105 -0
- package/template/.agents/skills/design/impeccable/reference/colorize.md +257 -0
- package/template/.agents/skills/design/impeccable/reference/craft.md +123 -0
- package/template/.agents/skills/design/impeccable/reference/critique.md +767 -0
- package/template/.agents/skills/design/impeccable/reference/delight.md +302 -0
- package/template/.agents/skills/design/impeccable/reference/distill.md +111 -0
- package/template/.agents/skills/design/impeccable/reference/document.md +429 -0
- package/template/.agents/skills/design/impeccable/reference/extract.md +69 -0
- package/template/.agents/skills/design/impeccable/reference/harden.md +347 -0
- package/template/.agents/skills/design/impeccable/reference/init.md +172 -0
- package/template/.agents/skills/design/impeccable/reference/interaction-design.md +189 -0
- package/template/.agents/skills/design/impeccable/reference/layout.md +161 -0
- package/template/.agents/skills/design/impeccable/reference/live.md +718 -0
- package/template/.agents/skills/design/impeccable/reference/onboard.md +234 -0
- package/template/.agents/skills/design/impeccable/reference/optimize.md +258 -0
- package/template/.agents/skills/design/impeccable/reference/overdrive.md +130 -0
- package/template/.agents/skills/design/impeccable/reference/polish.md +241 -0
- package/template/.agents/skills/design/impeccable/reference/product.md +60 -0
- package/template/.agents/skills/design/impeccable/reference/quieter.md +99 -0
- package/template/.agents/skills/design/impeccable/reference/shape.md +165 -0
- package/template/.agents/skills/design/impeccable/reference/typeset.md +279 -0
- package/template/.agents/skills/design/impeccable/scripts/cleanup-deprecated.mjs +284 -0
- package/template/.agents/skills/design/impeccable/scripts/command-metadata.json +94 -0
- package/template/.agents/skills/design/impeccable/scripts/context-signals.mjs +225 -0
- package/template/.agents/skills/design/impeccable/scripts/context.mjs +270 -0
- package/template/.agents/skills/design/impeccable/scripts/critique-storage.mjs +242 -0
- package/template/.agents/skills/design/impeccable/scripts/design-parser.mjs +835 -0
- package/template/.agents/skills/design/impeccable/scripts/detect-csp.mjs +198 -0
- package/template/.agents/skills/design/impeccable/scripts/detect.mjs +21 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/browser/injected/index.mjs +1733 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/cli/main.mjs +244 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/detect-antipatterns-browser.js +4551 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/detect-antipatterns.mjs +43 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/browser/detect-url.mjs +252 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/regex/detect-text.mjs +535 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +986 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/detect-html.mjs +208 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/findings.mjs +12 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/node/file-system.mjs +198 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/profile/profiler.mjs +166 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/registry/antipatterns.mjs +419 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/rules/checks.mjs +2316 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/color.mjs +124 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/constants.mjs +101 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/page.mjs +7 -0
- package/template/.agents/skills/design/impeccable/scripts/impeccable-paths.mjs +126 -0
- package/template/.agents/skills/design/impeccable/scripts/is-generated.mjs +69 -0
- package/template/.agents/skills/design/impeccable/scripts/live-accept.mjs +812 -0
- package/template/.agents/skills/design/impeccable/scripts/live-browser-session.js +123 -0
- package/template/.agents/skills/design/impeccable/scripts/live-browser.js +10316 -0
- package/template/.agents/skills/design/impeccable/scripts/live-commit-manual-edits.mjs +1241 -0
- package/template/.agents/skills/design/impeccable/scripts/live-complete.mjs +75 -0
- package/template/.agents/skills/design/impeccable/scripts/live-completion.mjs +19 -0
- package/template/.agents/skills/design/impeccable/scripts/live-copy-edit-agent.mjs +683 -0
- package/template/.agents/skills/design/impeccable/scripts/live-discard-manual-edits.mjs +51 -0
- package/template/.agents/skills/design/impeccable/scripts/live-event-validation.mjs +136 -0
- package/template/.agents/skills/design/impeccable/scripts/live-inject.mjs +557 -0
- package/template/.agents/skills/design/impeccable/scripts/live-insert-ui.mjs +458 -0
- package/template/.agents/skills/design/impeccable/scripts/live-insert.mjs +272 -0
- package/template/.agents/skills/design/impeccable/scripts/live-manual-edit-evidence.mjs +363 -0
- package/template/.agents/skills/design/impeccable/scripts/live-manual-edits-buffer.mjs +152 -0
- package/template/.agents/skills/design/impeccable/scripts/live-poll.mjs +379 -0
- package/template/.agents/skills/design/impeccable/scripts/live-resume.mjs +94 -0
- package/template/.agents/skills/design/impeccable/scripts/live-server.mjs +2322 -0
- package/template/.agents/skills/design/impeccable/scripts/live-session-store.mjs +289 -0
- package/template/.agents/skills/design/impeccable/scripts/live-status.mjs +61 -0
- package/template/.agents/skills/design/impeccable/scripts/live-svelte-component.mjs +826 -0
- package/template/.agents/skills/design/impeccable/scripts/live-sveltekit-adapter.mjs +274 -0
- package/template/.agents/skills/design/impeccable/scripts/live-ui-core.mjs +179 -0
- package/template/.agents/skills/design/impeccable/scripts/live-wrap.mjs +894 -0
- package/template/.agents/skills/design/impeccable/scripts/live.mjs +246 -0
- package/template/.agents/skills/design/impeccable/scripts/modern-screenshot.umd.js +14 -0
- package/template/.agents/skills/design/impeccable/scripts/palette.mjs +633 -0
- package/template/.agents/skills/design/impeccable/scripts/pin.mjs +214 -0
- package/template/.agents/skills/design/shadcn/SKILL.md +242 -0
- package/template/.agents/skills/design/shadcn/agents/openai.yml +5 -0
- package/template/.agents/skills/design/shadcn/assets/shadcn-small.png +0 -0
- package/template/.agents/skills/design/shadcn/assets/shadcn.png +0 -0
- package/template/.agents/skills/design/shadcn/cli.md +257 -0
- package/template/.agents/skills/design/shadcn/customization.md +202 -0
- package/template/.agents/skills/design/shadcn/evals/evals.json +47 -0
- package/template/.agents/skills/design/shadcn/mcp.md +94 -0
- package/template/.agents/skills/design/shadcn/rules/base-vs-radix.md +306 -0
- package/template/.agents/skills/design/shadcn/rules/composition.md +195 -0
- package/template/.agents/skills/design/shadcn/rules/forms.md +192 -0
- package/template/.agents/skills/design/shadcn/rules/icons.md +101 -0
- package/template/.agents/skills/design/shadcn/rules/styling.md +162 -0
- package/template/.agents/skills/find-skills/SKILL.md +142 -0
- package/template/.agents/skills/integrations/langfuse/SKILL.md +142 -0
- package/template/.agents/skills/integrations/langfuse/references/cli.md +52 -0
- package/template/.agents/skills/integrations/langfuse/references/error-analysis.md +100 -0
- package/template/.agents/skills/integrations/langfuse/references/instrumentation.md +134 -0
- package/template/.agents/skills/integrations/langfuse/references/judge-calibration.md +288 -0
- package/template/.agents/skills/integrations/langfuse/references/prompt-migration.md +234 -0
- package/template/.agents/skills/integrations/langfuse/references/sdk-upgrade.md +175 -0
- package/template/.agents/skills/integrations/langfuse/references/skill-feedback.md +52 -0
- package/template/.agents/skills/integrations/langfuse/references/user-feedback.md +88 -0
- package/template/.agents/skills/integrations/posthog/SKILL.md +102 -0
- package/template/.agents/skills/integrations/posthog/references/error-tracking-alerts.md +63 -0
- package/template/.agents/skills/integrations/posthog/references/error-tracking-assigning-issues.md +77 -0
- package/template/.agents/skills/integrations/posthog/references/error-tracking-fingerprints.md +57 -0
- package/template/.agents/skills/integrations/posthog/references/error-tracking-monitoring.md +140 -0
- package/template/.agents/skills/integrations/posthog/references/error-tracking-nextjs.md +490 -0
- package/template/.agents/skills/integrations/posthog/references/error-tracking-source-maps.md +45 -0
- package/template/.agents/skills/integrations/posthog/references/feature-flags-best-practices.md +139 -0
- package/template/.agents/skills/integrations/posthog/references/feature-flags-react.md +302 -0
- package/template/.agents/skills/integrations/posthog/references/identify-users.md +202 -0
- package/template/.agents/skills/integrations/posthog/references/integration-example.md +706 -0
- package/template/.agents/skills/integrations/posthog/references/integration-nextjs.md +385 -0
- package/template/.agents/skills/integrations/posthog/references/integration-step-1-begin.md +43 -0
- package/template/.agents/skills/integrations/posthog/references/integration-step-2-edit.md +37 -0
- package/template/.agents/skills/integrations/posthog/references/integration-step-3-revise.md +22 -0
- package/template/.agents/skills/integrations/posthog/references/integration-step-4-conclude.md +38 -0
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-anthropic.md +200 -0
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-basics.md +62 -0
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-costs.md +197 -0
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-manual-capture.md +397 -0
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-traces.md +98 -0
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-vercel-ai.md +120 -0
- package/template/.agents/skills/repo/repo-ci/SKILL.md +265 -0
- package/template/.agents/skills/repo/repo-init-next-js/SKILL.md +129 -0
- package/template/.agents/skills/repo/repo-init-next-js/references/file-contents.md +800 -0
- package/template/.agents/skills/repo/repo-init-next-js/scripts/setup.sh +47 -0
- package/template/.agents/skills/repo/repo-init-node/SKILL.md +196 -0
- package/template/.agents/skills/skill-creator/LICENSE.txt +202 -0
- package/template/.agents/skills/skill-creator/SKILL.md +485 -0
- package/template/.agents/skills/skill-creator/agents/analyzer.md +274 -0
- package/template/.agents/skills/skill-creator/agents/comparator.md +202 -0
- package/template/.agents/skills/skill-creator/agents/grader.md +223 -0
- package/template/.agents/skills/skill-creator/assets/eval_review.html +146 -0
- package/template/.agents/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/template/.agents/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/template/.agents/skills/skill-creator/references/schemas.md +430 -0
- package/template/.agents/skills/skill-creator/scripts/__init__.py +0 -0
- package/template/.agents/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/template/.agents/skills/skill-creator/scripts/generate_report.py +326 -0
- package/template/.agents/skills/skill-creator/scripts/improve_description.py +247 -0
- package/template/.agents/skills/skill-creator/scripts/package_skill.py +136 -0
- package/template/.agents/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/template/.agents/skills/skill-creator/scripts/run_eval.py +310 -0
- package/template/.agents/skills/skill-creator/scripts/run_loop.py +328 -0
- package/template/.agents/skills/skill-creator/scripts/utils.py +47 -0
- package/template/.agents/upstreams.json +80 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: langfuse-prompt-migration
|
|
3
|
+
description: Migrate hardcoded prompts to Langfuse for version control and deployment-free iteration. Use when user wants to externalize prompts, move prompts to Langfuse, or set up prompt management.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Langfuse Prompt Migration
|
|
7
|
+
|
|
8
|
+
Migrate hardcoded prompts to Langfuse for version control, A/B testing, and deployment-free iteration.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
Verify credentials are set before starting. Check existence only — never print the secret key, since the value would land in the agent's context and transcripts:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
[ -n "$LANGFUSE_PUBLIC_KEY" ] && echo "LANGFUSE_PUBLIC_KEY: set" || echo "LANGFUSE_PUBLIC_KEY: missing"
|
|
16
|
+
[ -n "$LANGFUSE_SECRET_KEY" ] && echo "LANGFUSE_SECRET_KEY: set" || echo "LANGFUSE_SECRET_KEY: missing"
|
|
17
|
+
[ -n "$LANGFUSE_BASE_URL" ] && echo "LANGFUSE_BASE_URL: $LANGFUSE_BASE_URL" || echo "LANGFUSE_BASE_URL: missing"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If not set, ask the user to configure them in their shell or a `.env` file. Do not ask them to paste keys into chat.
|
|
21
|
+
|
|
22
|
+
## Migration Flow
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
1. Scan codebase for prompts
|
|
26
|
+
2. Analyze templating compatibility
|
|
27
|
+
3. Propose structure (names, subprompts, variables)
|
|
28
|
+
4. User approves
|
|
29
|
+
5. Create prompts in Langfuse
|
|
30
|
+
6. Refactor code to use get_prompt()
|
|
31
|
+
7. Link prompts to traces (if tracing enabled)
|
|
32
|
+
8. Verify application works
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Step 1: Find Prompts and Build an Inventory
|
|
36
|
+
|
|
37
|
+
Before writing ANY code, make a complete list of every prompt you found. For each one, note:
|
|
38
|
+
|
|
39
|
+
- Name: descriptive, lowercase, hyphenated (e.g. chat-assistant, email-classifier)
|
|
40
|
+
- Source file: where the prompt text lives
|
|
41
|
+
- Code file to refactor: the Python/JS file that USES the prompt (for asset files like .txt/.yaml/.md, this is the file that reads/loads the asset — NOT the asset file itself)
|
|
42
|
+
- Type: chat (used as a message in a chat API) or text (used as a plain string)
|
|
43
|
+
- Variables: values interpolated into the prompt, converted to {{var}} syntax:
|
|
44
|
+
f-string {var} → {{var}}
|
|
45
|
+
.format(var=...) → {{var}}
|
|
46
|
+
${var} → {{var}}
|
|
47
|
+
String concatenation + var + → {{var}}
|
|
48
|
+
YAML {var} → {{var}}
|
|
49
|
+
- Prompt content: the actual text to upload, with variables converted to {{var}} syntax
|
|
50
|
+
|
|
51
|
+
Search for these patterns:
|
|
52
|
+
|
|
53
|
+
| Framework | Look for |
|
|
54
|
+
|-----------|----------|
|
|
55
|
+
| OpenAI | `messages=[{"role": "system", "content": "..."}]` |
|
|
56
|
+
| Anthropic | `system="..."` |
|
|
57
|
+
| LangChain | `ChatPromptTemplate`, `SystemMessage` |
|
|
58
|
+
| Vercel AI | `system: "..."`, `prompt: "..."` |
|
|
59
|
+
| Raw | Multi-line strings near LLM calls |
|
|
60
|
+
|
|
61
|
+
## Step 2: Check Templating Compatibility
|
|
62
|
+
|
|
63
|
+
**CRITICAL:** Langfuse only supports simple `{{variable}}` substitution. No conditionals, loops, or filters.
|
|
64
|
+
|
|
65
|
+
| Template Feature | Langfuse Native | Action |
|
|
66
|
+
|------------------|-----------------|--------|
|
|
67
|
+
| `{{variable}}` | ✅ | Direct migration |
|
|
68
|
+
| `{var}` / `${var}` | ⚠️ | Convert to `{{var}}` |
|
|
69
|
+
| `{% if %}` / `{% for %}` | ❌ | Move logic to code |
|
|
70
|
+
| `{{ var \| filter }}` | ❌ | Apply filter in code |
|
|
71
|
+
|
|
72
|
+
**CRITICAL — Variable syntax:** Langfuse uses DOUBLE curly braces for variables: `{{var}}`. When uploading prompt content, you MUST convert every single-brace `{var}` from the original code to double-brace `{{var}}`. Never upload `{var}` — it must be `{{var}}`.
|
|
73
|
+
|
|
74
|
+
### Decision Tree
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
Contains {% if %}, {% for %}, or filters?
|
|
78
|
+
├─ No → Direct migration
|
|
79
|
+
└─ Yes → Choose:
|
|
80
|
+
├─ Option A (RECOMMENDED): Move logic to code, pass pre-computed values
|
|
81
|
+
└─ Option B: Store raw template, compile client-side with Jinja2
|
|
82
|
+
└─ ⚠️ Loses: Playground preview, UI experiments
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Simplifying Complex Templates
|
|
86
|
+
|
|
87
|
+
**Conditionals** → Pre-compute in code:
|
|
88
|
+
```python
|
|
89
|
+
# Instead of {% if user.is_premium %}...{% endif %} in prompt
|
|
90
|
+
# Use {{tier_message}} and compute value in code before compile()
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Loops** → Pre-format in code:
|
|
94
|
+
```python
|
|
95
|
+
# Instead of {% for tool in tools %}...{% endfor %} in prompt
|
|
96
|
+
# Use {{tools_list}} and format the list in code before compile()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
For external templating details, fetch: https://langfuse.com/faq/all/using-external-templating-libraries
|
|
100
|
+
|
|
101
|
+
## Step 3: Propose Structure
|
|
102
|
+
|
|
103
|
+
### Naming Conventions
|
|
104
|
+
|
|
105
|
+
| Rule | Example | Bad |
|
|
106
|
+
|------|---------|-----|
|
|
107
|
+
| Lowercase, hyphenated | `chat-assistant` | `ChatAssistant_v2` |
|
|
108
|
+
| Feature-based | `document-summarizer` | `prompt1` |
|
|
109
|
+
| Hierarchical for related | `support/triage` | `supportTriage` |
|
|
110
|
+
| Prefix subprompts with `_` | `_base-personality` | `shared-personality` |
|
|
111
|
+
|
|
112
|
+
### Identify Subprompts
|
|
113
|
+
|
|
114
|
+
Extract when:
|
|
115
|
+
- Same text in 2+ prompts
|
|
116
|
+
- Represents distinct component (personality, safety rules, format)
|
|
117
|
+
- Would need to change together
|
|
118
|
+
|
|
119
|
+
### Variable Extraction
|
|
120
|
+
|
|
121
|
+
| Make Variable | Keep Hardcoded |
|
|
122
|
+
|---------------|----------------|
|
|
123
|
+
| User-specific (`{{user_name}}`) | Output format instructions |
|
|
124
|
+
| Dynamic content (`{{context}}`) | Safety guardrails |
|
|
125
|
+
| Per-request (`{{query}}`) | Persona/personality |
|
|
126
|
+
| Environment-specific (`{{company_name}}`) | Static examples |
|
|
127
|
+
|
|
128
|
+
## Step 4: Present Plan to User
|
|
129
|
+
|
|
130
|
+
Format:
|
|
131
|
+
```
|
|
132
|
+
Found N prompts across M files:
|
|
133
|
+
|
|
134
|
+
src/chat.py:
|
|
135
|
+
- System prompt (47 lines) → 'chat-assistant'
|
|
136
|
+
|
|
137
|
+
src/support/triage.py:
|
|
138
|
+
- Triage prompt (34 lines) → 'support/triage'
|
|
139
|
+
⚠️ Contains {% if %} - will simplify
|
|
140
|
+
|
|
141
|
+
Subprompts to extract:
|
|
142
|
+
- '_base-personality' - used by: chat-assistant, support/triage
|
|
143
|
+
|
|
144
|
+
Variables to add:
|
|
145
|
+
- {{user_name}} - hardcoded in 2 prompts
|
|
146
|
+
|
|
147
|
+
Proceed?
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Step 5: Create Prompts in Langfuse
|
|
151
|
+
|
|
152
|
+
Use `langfuse.create_prompt()` with:
|
|
153
|
+
- `name`: Your chosen name
|
|
154
|
+
- `prompt`: Template text (or message array for chat type)
|
|
155
|
+
- `type`: `"text"` or `"chat"`
|
|
156
|
+
- `labels`: `["production"]` (they're already live)
|
|
157
|
+
- `config`: Optional model settings
|
|
158
|
+
|
|
159
|
+
**Labeling strategy:**
|
|
160
|
+
- `production` → All migrated prompts
|
|
161
|
+
- `staging` → Add later for testing
|
|
162
|
+
- `latest` → Auto-applied by Langfuse
|
|
163
|
+
|
|
164
|
+
For full API: fetch https://langfuse.com/docs/prompts/get-started
|
|
165
|
+
|
|
166
|
+
## Step 6: Refactor Code
|
|
167
|
+
|
|
168
|
+
Replace hardcoded prompts with:
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
prompt = langfuse.get_prompt("name", label="production")
|
|
172
|
+
messages = prompt.compile(var1=value1, var2=value2)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Key points:**
|
|
176
|
+
- Always use `label="production"` (not `latest`) for stability
|
|
177
|
+
- Call `.compile()` to substitute variables
|
|
178
|
+
- For chat prompts, result is message array ready for API
|
|
179
|
+
|
|
180
|
+
For SDK examples (Python/JS/TS): fetch https://langfuse.com/docs/prompts/get-started
|
|
181
|
+
|
|
182
|
+
## Step 7: Link Prompts to Traces
|
|
183
|
+
|
|
184
|
+
If codebase uses Langfuse tracing, link prompts so you can see which version produced each response.
|
|
185
|
+
|
|
186
|
+
### Detect Existing Tracing
|
|
187
|
+
|
|
188
|
+
Look for:
|
|
189
|
+
- `@observe()` decorators
|
|
190
|
+
- `langfuse.trace()` calls
|
|
191
|
+
- `from langfuse.openai import openai` (instrumented client)
|
|
192
|
+
|
|
193
|
+
### Link Methods
|
|
194
|
+
|
|
195
|
+
| Setup | How to Link |
|
|
196
|
+
|-------|-------------|
|
|
197
|
+
| `@observe()` decorator | `langfuse_context.update_current_observation(prompt=prompt)` |
|
|
198
|
+
| Manual tracing | `trace.generation(prompt=prompt, ...)` |
|
|
199
|
+
| OpenAI integration | `openai.chat.completions.create(..., langfuse_prompt=prompt)` |
|
|
200
|
+
|
|
201
|
+
### Verify in UI
|
|
202
|
+
|
|
203
|
+
1. Go to **Traces** → select a trace
|
|
204
|
+
2. Click on **Generation**
|
|
205
|
+
3. Check **Prompt** field shows name and version
|
|
206
|
+
|
|
207
|
+
For tracing details: fetch https://langfuse.com/docs/prompts/get-started#link-with-langfuse-tracing
|
|
208
|
+
|
|
209
|
+
## Step 8: Verify Migration
|
|
210
|
+
|
|
211
|
+
### Checklist
|
|
212
|
+
|
|
213
|
+
- [ ] All prompts created with `production` label
|
|
214
|
+
- [ ] Code fetches with `label="production"`
|
|
215
|
+
- [ ] Variables compile without errors
|
|
216
|
+
- [ ] Subprompts resolve correctly
|
|
217
|
+
- [ ] Application behavior unchanged
|
|
218
|
+
- [ ] Generations show linked prompt in UI (if tracing)
|
|
219
|
+
|
|
220
|
+
### Common Issues
|
|
221
|
+
|
|
222
|
+
| Issue | Solution |
|
|
223
|
+
|-------|----------|
|
|
224
|
+
| `PromptNotFoundError` | Check name spelling |
|
|
225
|
+
| Variables not replaced | Use `{{var}}` not `{var}`, call `.compile()` |
|
|
226
|
+
| Subprompt not resolved | Must exist with same label |
|
|
227
|
+
| Old prompt cached | Restart app |
|
|
228
|
+
|
|
229
|
+
## Out of Scope
|
|
230
|
+
|
|
231
|
+
- Prompt engineering (writing better prompts)
|
|
232
|
+
- Evaluation setup
|
|
233
|
+
- A/B testing workflow
|
|
234
|
+
- Non-LLM string templates
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: langfuse-sdk-upgrade
|
|
3
|
+
description: Upgrade Langfuse SDKs from older versions to the latest. Use when migrating Python SDK v2/v3 to v4, or JS/TS SDK v3/v4 to v5.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Langfuse SDK Upgrade Guide
|
|
7
|
+
|
|
8
|
+
Assist users in upgrading their Langfuse SDK to the latest version. The Python and JS/TS SDKs share the same architectural changes but differ in syntax.
|
|
9
|
+
|
|
10
|
+
## Migration Docs
|
|
11
|
+
|
|
12
|
+
Always fetch the latest migration guide before starting — these pages are the source of truth:
|
|
13
|
+
|
|
14
|
+
- **Python (v3 → v4):** https://langfuse.com/docs/observability/sdk/upgrade-path/python-v3-to-v4
|
|
15
|
+
- **JS/TS (v4 → v5):** https://langfuse.com/docs/observability/sdk/upgrade-path/js-v4-to-v5
|
|
16
|
+
|
|
17
|
+
Fetch the relevant page as markdown before implementing any changes:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
curl -s "https://langfuse.com/docs/observability/sdk/upgrade-path/python-v3-to-v4.md"
|
|
21
|
+
curl -s "https://langfuse.com/docs/observability/sdk/upgrade-path/js-v4-to-v5.md"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Upgrade Checklist
|
|
25
|
+
|
|
26
|
+
Work through each item in order. Skip items that don't apply to the user's codebase.
|
|
27
|
+
|
|
28
|
+
### Both SDKs
|
|
29
|
+
|
|
30
|
+
- [ ] **Update the SDK package** to the latest version
|
|
31
|
+
- [ ] **Audit span filtering**: Non-LLM spans (HTTP, DB, queues) no longer export by default. If the user relied on these, configure a custom `should_export_span` / `shouldExportSpan` filter
|
|
32
|
+
- [ ] **Replace `update_current_trace()` / `updateActiveTrace()`**: Split into three calls:
|
|
33
|
+
- `propagate_attributes()` / `propagateAttributes()` for correlating attributes (`user_id`, `session_id`, `tags`, `metadata`, `trace_name`)
|
|
34
|
+
- `set_current_trace_io()` / `setActiveTraceIO()` for input/output (deprecated — prefer setting I/O on root observation directly)
|
|
35
|
+
- `set_current_trace_as_public()` / `setActiveTraceAsPublic()` for public flag
|
|
36
|
+
- [ ] **Replace `.update_trace()` / `.updateTrace()`** on observation objects (same decomposition as above)
|
|
37
|
+
- [ ] **Update API namespace references**: `observations_v_2` / `observationsV2` → `observations`, `score_v_2` / `scoreV2` → `scores`, `metrics_v_2` / `metricsV2` → `metrics`. Legacy v1 APIs moved to `api.legacy.*`
|
|
38
|
+
- [ ] **Validate metadata format**: Must be `dict[str, str]` / `Record<string, string>` with values ≤200 characters
|
|
39
|
+
- [ ] **Move `release` and `environment`** from code parameters to environment variables (`LANGFUSE_RELEASE`, `LANGFUSE_TRACING_ENVIRONMENT`)
|
|
40
|
+
- [ ] **Enable debug logging** during migration to catch issues (`debug=True` in Python, `LANGFUSE_DEBUG="true"` in JS/TS)
|
|
41
|
+
- [ ] **Test trace hierarchies** to verify no spans are unexpectedly dropped
|
|
42
|
+
|
|
43
|
+
### Python-specific
|
|
44
|
+
|
|
45
|
+
- [ ] **Replace `start_span()` / `start_generation()`** with `start_observation()` (use `as_type="generation"` for generations)
|
|
46
|
+
- [ ] **Replace `start_as_current_span()` / `start_as_current_generation()`** with `start_as_current_observation()`
|
|
47
|
+
- [ ] **Replace dataset `item.run()`** with `dataset.run_experiment(name=..., task=...)`
|
|
48
|
+
- [ ] **Remove `CallbackHandler(update_trace=...)`** parameter — use `propagate_attributes()` wrapper instead
|
|
49
|
+
- [ ] **Upgrade to Pydantic v2** — the SDK now requires it. Use `pydantic.v1` compatibility shim if migrating gradually
|
|
50
|
+
- [ ] **Update removed types**: `TraceMetadata`, `ObservationParams` removed from `langfuse.types`. Import `MapValue`, `ModelUsage`, `PromptClient` from `langfuse.model`
|
|
51
|
+
|
|
52
|
+
### JS/TS-specific
|
|
53
|
+
|
|
54
|
+
- [ ] **Update LangChain `CallbackHandler`** — `traceMetadata` now requires string values; internal behavior uses `propagateAttributes()` instead of direct trace updates
|
|
55
|
+
- [ ] **Update OpenAI integration** — `traceMethod` wrapper now uses `propagateAttributes()` internally; wrap entire execution in `propagateAttributes()` if relying on parent attribute inheritance
|
|
56
|
+
|
|
57
|
+
## Key API Changes Reference
|
|
58
|
+
|
|
59
|
+
### Correlating attributes (both SDKs)
|
|
60
|
+
|
|
61
|
+
**Before:**
|
|
62
|
+
```python
|
|
63
|
+
# Python
|
|
64
|
+
langfuse.update_current_trace(name="trace-name", user_id="user-123", session_id="session-abc", tags=["tag1"])
|
|
65
|
+
```
|
|
66
|
+
```typescript
|
|
67
|
+
// JS/TS
|
|
68
|
+
updateActiveTrace({ name: "trace-name", userId: "user-123", sessionId: "session-456", tags: ["prod"] });
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**After:**
|
|
72
|
+
```python
|
|
73
|
+
# Python
|
|
74
|
+
from langfuse import propagate_attributes
|
|
75
|
+
|
|
76
|
+
with propagate_attributes(trace_name="trace-name", user_id="user-123", session_id="session-abc", tags=["tag1"]):
|
|
77
|
+
result = call_llm("hello")
|
|
78
|
+
```
|
|
79
|
+
```typescript
|
|
80
|
+
// JS/TS
|
|
81
|
+
import { propagateAttributes } from "langfuse";
|
|
82
|
+
|
|
83
|
+
await propagateAttributes(
|
|
84
|
+
{ traceName: "trace-name", userId: "user-123", sessionId: "session-456", tags: ["prod"] },
|
|
85
|
+
async () => { /* traced code */ }
|
|
86
|
+
);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Span/Generation creation (Python)
|
|
90
|
+
|
|
91
|
+
**Before:**
|
|
92
|
+
```python
|
|
93
|
+
langfuse.start_span(name="x")
|
|
94
|
+
langfuse.start_generation(name="x", model="gpt-4")
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**After:**
|
|
98
|
+
```python
|
|
99
|
+
langfuse.start_observation(name="x")
|
|
100
|
+
langfuse.start_observation(name="x", as_type="generation", model="gpt-4")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Dataset experiments (Python)
|
|
104
|
+
|
|
105
|
+
**Before:**
|
|
106
|
+
```python
|
|
107
|
+
for item in dataset.items:
|
|
108
|
+
with item.run(run_name="my-run") as span:
|
|
109
|
+
result = my_llm(item.input)
|
|
110
|
+
span.update(output=result)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**After:**
|
|
114
|
+
```python
|
|
115
|
+
def my_task(*, item, **kwargs):
|
|
116
|
+
return my_llm(item.input)
|
|
117
|
+
|
|
118
|
+
dataset.run_experiment(name="my-run", task=my_task)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Span filtering (both SDKs)
|
|
122
|
+
|
|
123
|
+
To restore pre-upgrade "export all" behavior:
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
# Python
|
|
127
|
+
langfuse = Langfuse(should_export_span=lambda span: True)
|
|
128
|
+
```
|
|
129
|
+
```typescript
|
|
130
|
+
// JS/TS
|
|
131
|
+
const spanProcessor = new LangfuseSpanProcessor({ shouldExportSpan: () => true });
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
To extend defaults with custom scopes:
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
# Python
|
|
138
|
+
from langfuse.span_filter import is_default_export_span
|
|
139
|
+
|
|
140
|
+
langfuse = Langfuse(
|
|
141
|
+
should_export_span=lambda span: (
|
|
142
|
+
is_default_export_span(span)
|
|
143
|
+
or span.instrumentation_scope.name.startswith("my_framework")
|
|
144
|
+
)
|
|
145
|
+
)
|
|
146
|
+
```
|
|
147
|
+
```typescript
|
|
148
|
+
// JS/TS
|
|
149
|
+
import { isDefaultExportSpan } from "@langfuse/otel";
|
|
150
|
+
|
|
151
|
+
shouldExportSpan: ({ otelSpan }) =>
|
|
152
|
+
isDefaultExportSpan(otelSpan) || otelSpan.instrumentationScope.name.startsWith("my_framework")
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Common Pitfalls
|
|
156
|
+
|
|
157
|
+
| Pitfall | Impact | Fix |
|
|
158
|
+
| --- | --- | --- |
|
|
159
|
+
| Dropping intermediate spans via filtering | Breaks trace trees — child spans become orphaned | Use `is_default_export_span` as base and only add/remove specific scopes |
|
|
160
|
+
| Metadata with non-string values | Values silently coerced or dropped | Ensure all metadata values are strings ≤200 characters |
|
|
161
|
+
| Setting attributes outside `propagate_attributes()` callback | Attributes don't attach to observations | Wrap all traced code inside the callback |
|
|
162
|
+
| Using deprecated `set_current_trace_io()` for new code | Will be removed in future versions | Set input/output directly on the root observation |
|
|
163
|
+
| Forgetting Pydantic v2 upgrade (Python) | Import errors or runtime failures | Upgrade Pydantic or use `pydantic.v1` shim |
|
|
164
|
+
| `release`/`environment` still passed as parameters | Silently ignored | Use `LANGFUSE_RELEASE` and `LANGFUSE_TRACING_ENVIRONMENT` env vars |
|
|
165
|
+
| LangChain/OpenAI attribute propagation direction changed | Attributes propagate downward only, not upward to parent traces | Wrap outer call in `propagate_attributes()` |
|
|
166
|
+
|
|
167
|
+
## Best Practices
|
|
168
|
+
|
|
169
|
+
1. **Always fetch the migration docs first** — they are the canonical source and may have been updated since this guide was written
|
|
170
|
+
2. **Enable debug logging during migration** to surface dropped spans and trace hierarchy issues
|
|
171
|
+
3. **Use `propagate_attributes()` as the primary mechanism** for setting trace-level correlating attributes
|
|
172
|
+
4. **Set input/output on root observations directly** rather than using deprecated trace-level setters
|
|
173
|
+
5. **Compose custom span filters** with `is_default_export_span` / `isDefaultExportSpan` to extend defaults rather than replacing them entirely
|
|
174
|
+
6. **Test thoroughly** — run the application with debug logging, check the Langfuse UI for missing or orphaned spans, verify metadata appears correctly
|
|
175
|
+
7. **Migrate incrementally** — upgrade the SDK first, fix breaking changes, then adopt new patterns
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: langfuse-skill-feedback
|
|
3
|
+
description: Submit feedback about the Langfuse skill to its maintainers via GitHub Discussions. Use when the user indicates the skill gave incorrect guidance, is missing information, or could be improved.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill Feedback
|
|
7
|
+
|
|
8
|
+
Follow these steps exactly:
|
|
9
|
+
|
|
10
|
+
1. **Ask permission**: Ask the user if they'd like you to submit feedback to the skill maintainers. Make it clear this is about the skill (the agent instructions), not about Langfuse the product. If they decline, move on.
|
|
11
|
+
2. **Draft feedback**: Write the feedback using the form structure below. Present the draft to the user and ask if they'd like to change anything before submitting.
|
|
12
|
+
3. **Submit**: Once approved, submit via `gh` CLI as described below. Share the resulting discussion URL with the user.
|
|
13
|
+
|
|
14
|
+
## Feedback Form Structure
|
|
15
|
+
|
|
16
|
+
Draft the feedback using these two fields:
|
|
17
|
+
|
|
18
|
+
**Describe your idea or feedback** (required)
|
|
19
|
+
A clear description of what went wrong or what could be improved. Include:
|
|
20
|
+
- What the user was trying to do
|
|
21
|
+
- What the skill did vs what was expected
|
|
22
|
+
- Any specific instructions that were incorrect or missing
|
|
23
|
+
|
|
24
|
+
**What would the ideal outcome look like?** (optional)
|
|
25
|
+
What the correct behavior or guidance should be.
|
|
26
|
+
|
|
27
|
+
Format the body as markdown with the two field labels as headings.
|
|
28
|
+
|
|
29
|
+
## Submitting
|
|
30
|
+
|
|
31
|
+
Create a GitHub Discussion on the `langfuse/skills` repository using the GraphQL API:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
gh api graphql -f query='
|
|
35
|
+
mutation($repoId: ID!, $categoryId: ID!, $title: String!, $body: String!) {
|
|
36
|
+
createDiscussion(input: {repositoryId: $repoId, categoryId: $categoryId, title: $title, body: $body}) {
|
|
37
|
+
discussion { url }
|
|
38
|
+
}
|
|
39
|
+
}' \
|
|
40
|
+
-f repoId="$(gh api graphql -f query='{ repository(owner: "langfuse", name: "skills") { id } }' --jq '.data.repository.id')" \
|
|
41
|
+
-f categoryId="$(gh api graphql -f query='{ repository(owner: "langfuse", name: "skills") { discussionCategories(first: 10) { nodes { id name } } } }' --jq '.data.repository.discussionCategories.nodes[] | select(.name == "Ideas & Improvements") | .id')" \
|
|
42
|
+
-f title="<concise title>" \
|
|
43
|
+
-f body="<formatted feedback>"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If the `gh` CLI is not authenticated or the request fails, give the user this link to create the discussion manually:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
https://github.com/langfuse/skills/discussions/new?category=ideas-improvements
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
After submission, share the discussion URL with the user.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: langfuse-user-feedback
|
|
3
|
+
description: Wires up user feedback (thumbs up/down, ratings, comments) from an application's frontend to Langfuse scores. Use when user wants to capture end-user feedback, add ratings to traces, or connect user complaints to Langfuse.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# User Feedback
|
|
7
|
+
|
|
8
|
+
Tracing must already be set up — feedback is stored as scores on traces.
|
|
9
|
+
|
|
10
|
+
Docs: https://langfuse.com/docs/observability/features/user-feedback
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
### 1. Determine What Feedback to Capture
|
|
15
|
+
|
|
16
|
+
If the user has asked for something specific, go with that. Otherwise, look at the application and **present a few UX options** for how feedback could work, then ask the user which they prefer before implementing.
|
|
17
|
+
|
|
18
|
+
Common UX patterns to suggest:
|
|
19
|
+
|
|
20
|
+
| UX Pattern | Best for | How it works |
|
|
21
|
+
|------------|----------|--------------|
|
|
22
|
+
| Thumbs up/down | Chat apps, Q&A | Simple binary buttons next to each response |
|
|
23
|
+
| Star rating (1–5) | Content generation, summaries | Star row or dropdown after each output |
|
|
24
|
+
| "Was this helpful?" banner | Search, documentation assistants | Single yes/no prompt at the bottom of a response |
|
|
25
|
+
| Regenerate / copy tracking | Any app with these actions | Implicit — log when users retry (negative signal) or copy output (positive signal) |
|
|
26
|
+
| Free-text comment | Complex outputs, internal tools | Optional text field alongside a rating |
|
|
27
|
+
| Report button | Any user-facing app | Flag icon to report bad/harmful responses |
|
|
28
|
+
|
|
29
|
+
This table is not exhaustive — if the application suggests a different feedback pattern that fits better, propose that instead. Present 2–3 options that match the application's use case and ask the user which approach they'd like. This decision shapes everything downstream (score names, data types, frontend components), so it's important to align early.
|
|
30
|
+
|
|
31
|
+
Feedback can be **explicit** (user rates via thumbs, stars, etc.) or **implicit** (derived from behavior like copying output, retrying, or escalating to support). Both are stored as scores. Explicit feedback requires the trace ID to reach the frontend; implicit feedback is logged server-side where the event already happens.
|
|
32
|
+
|
|
33
|
+
### 2. Choose Score Names
|
|
34
|
+
|
|
35
|
+
Name reflects the signal source, not what you hope it measures (e.g., `user-thumbs` not `response-quality` — a thumbs down doesn't tell you *what* was wrong). Avoid generic names like `feedback` or `score`.
|
|
36
|
+
|
|
37
|
+
Rules:
|
|
38
|
+
- Lowercase with hyphens
|
|
39
|
+
- One consistent name per feedback type across the entire app
|
|
40
|
+
- If capturing multiple signals, each gets its own distinct name
|
|
41
|
+
|
|
42
|
+
### 3. Implement Score Creation
|
|
43
|
+
|
|
44
|
+
**For implicit feedback (server-side):** Use `langfuse.create_score()` / `langfuse.score.create()` wherever the event is already handled in application code. Fetch SDK docs for current API: https://langfuse.com/docs/evaluation/evaluation-methods/scores-via-sdk
|
|
45
|
+
|
|
46
|
+
**For explicit feedback (frontend):** Use `LangfuseWeb` in the browser. It uses the public key only — no secret key exposed.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { LangfuseWeb } from "langfuse";
|
|
50
|
+
|
|
51
|
+
const langfuse = new LangfuseWeb({
|
|
52
|
+
publicKey: process.env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY!,
|
|
53
|
+
baseUrl: process.env.NEXT_PUBLIC_LANGFUSE_HOST,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
langfuse.score({
|
|
57
|
+
traceId,
|
|
58
|
+
name: "user-thumbs",
|
|
59
|
+
value: 1, // 1 = positive, 0 = negative
|
|
60
|
+
dataType: "BOOLEAN",
|
|
61
|
+
comment: optionalUserComment,
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The trace ID must be available in the frontend for this to work. For Vercel AI SDK, the non-obvious pattern is using `generateMessageId`:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { getActiveTraceId } from "@langfuse/tracing";
|
|
69
|
+
|
|
70
|
+
// Inside route handler wrapped with observe()
|
|
71
|
+
return result.toUIMessageStreamResponse({
|
|
72
|
+
generateMessageId: () => getActiveTraceId() || crypto.randomUUID(),
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 4. Verify
|
|
77
|
+
|
|
78
|
+
Trigger a feedback action and check the trace's Scores tab in Langfuse. Confirm the score name, value, and data type are correct.
|
|
79
|
+
|
|
80
|
+
Point users to what they can do with feedback data: filter traces by low scores, use score analytics for trends, build annotation queues for team review.
|
|
81
|
+
|
|
82
|
+
## Common Mistakes
|
|
83
|
+
|
|
84
|
+
| Mistake | Problem | Fix |
|
|
85
|
+
|---------|---------|-----|
|
|
86
|
+
| Secret key in frontend code | Security risk | Use `LangfuseWeb` with public key only |
|
|
87
|
+
| Missing `dataType` on boolean scores | Value `1` inferred as `NUMERIC` | Always pass `dataType: "BOOLEAN"` explicitly |
|
|
88
|
+
| Inconsistent score names across the app | Can't aggregate or filter reliably | Pick one name per feedback type, use it everywhere |
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: posthog
|
|
3
|
+
description: Add and use PostHog in Next.js (App Router) applications. Use when needing to (1) integrate PostHog analytics, (2) set up LLM analytics for AI SDK / Anthropic generations, (3) add error tracking, or (4) implement feature flags. Covers SDK setup, user identification, event capture, exception tracking, source maps, and server/client flag evaluation. Curated for a Next.js + Vercel AI SDK stack.
|
|
4
|
+
license: MIT. Curated from PostHog's official skills (github.com/PostHog/skills).
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- WebFetch(domain:posthog.com)
|
|
7
|
+
- Bash(curl *posthog.com/*)
|
|
8
|
+
- Read(references/**)
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# PostHog
|
|
12
|
+
|
|
13
|
+
This skill helps you add and use PostHog effectively in Next.js App Router applications across four workflows: product analytics integration, LLM analytics, error tracking, and feature flags.
|
|
14
|
+
|
|
15
|
+
It is curated for a Next.js + Vercel AI SDK stack. For providers, frameworks, or surfaces not covered here, fetch the current docs (see "Documentation" below) before implementing.
|
|
16
|
+
|
|
17
|
+
## Core principles
|
|
18
|
+
|
|
19
|
+
Follow these for ALL PostHog work:
|
|
20
|
+
|
|
21
|
+
1. **Documentation first**: NEVER implement from memory. PostHog SDKs change frequently. Read the matching reference file below, and fetch current docs when something is unclear or unlisted.
|
|
22
|
+
2. **Environment variables**: Always read PostHog keys and host URLs from environment variables. Never hardcode them. The host is `https://us.i.posthog.com` (US) or `https://eu.i.posthog.com` (EU).
|
|
23
|
+
3. **Minimal changes**: Add PostHog code alongside existing logic. Don't replace or restructure existing code.
|
|
24
|
+
4. **No PII in event properties**: Never put emails, names, phone numbers, addresses, IPs, or user-generated content in `capture()` properties. PII belongs in `identify()` person properties. Safe event properties are metadata (e.g. `message_length`, `form_type`, boolean flags).
|
|
25
|
+
|
|
26
|
+
## Use-case specific references
|
|
27
|
+
|
|
28
|
+
Pick the workflow, then read the listed references before implementing.
|
|
29
|
+
|
|
30
|
+
### 1. Integration (product analytics)
|
|
31
|
+
|
|
32
|
+
Add PostHog analytics to a Next.js App Router app. Start here for any new setup.
|
|
33
|
+
|
|
34
|
+
- `references/integration-nextjs.md` — Next.js integration docs (init, pageviews, capture)
|
|
35
|
+
- `references/integration-example.md` — full example project showing the target pattern
|
|
36
|
+
- `references/identify-users.md` — identifying users on login/signup
|
|
37
|
+
- Setup workflow (in order): `references/integration-step-1-begin.md` → `references/integration-step-2-edit.md` → `references/integration-step-3-revise.md` → `references/integration-step-4-conclude.md`
|
|
38
|
+
|
|
39
|
+
Key guidelines:
|
|
40
|
+
- For Next.js 15.3+, initialize PostHog in `instrumentation-client.ts` for the simplest setup.
|
|
41
|
+
- Identify users during login and signup. If both frontend and backend exist, pass the client session and distinct ID via `X-POSTHOG-DISTINCT-ID` and `X-POSTHOG-SESSION-ID` headers to keep correlation.
|
|
42
|
+
- Add capture in event handlers where the user action occurs, NOT in `useEffect` reacting to state.
|
|
43
|
+
|
|
44
|
+
### 2. LLM analytics (Vercel AI SDK / Anthropic)
|
|
45
|
+
|
|
46
|
+
Instrument LLM generations to capture tokens, model, latency, and cost. Matches an AI SDK stack.
|
|
47
|
+
|
|
48
|
+
- `references/llm-analytics-basics.md` — concepts and what gets captured
|
|
49
|
+
- `references/llm-analytics-vercel-ai.md` — Vercel AI SDK setup via OpenTelemetry + `@posthog/ai` (primary path)
|
|
50
|
+
- `references/llm-analytics-anthropic.md` — Anthropic SDK instrumentation
|
|
51
|
+
- `references/llm-analytics-manual-capture.md` — generic fallback for any provider via manual `$ai_generation` events
|
|
52
|
+
- `references/llm-analytics-traces.md` — grouping generations into traces
|
|
53
|
+
- `references/llm-analytics-costs.md` — cost calculation
|
|
54
|
+
|
|
55
|
+
Key guidelines:
|
|
56
|
+
- The Vercel AI SDK path uses `@posthog/ai/otel` `PostHogTraceExporter` + OpenTelemetry; pass `experimental_telemetry` (with `posthog_distinct_id` metadata) on AI SDK calls. The SDKs do NOT proxy your LLM calls; they only send analytics in the background.
|
|
57
|
+
- Only instrument provider(s) actually present in the codebase. One provider at a time.
|
|
58
|
+
- Link generations to identified users via distinct IDs where possible.
|
|
59
|
+
|
|
60
|
+
### 3. Error tracking
|
|
61
|
+
|
|
62
|
+
Capture exceptions with resolved stack traces.
|
|
63
|
+
|
|
64
|
+
- `references/error-tracking-nextjs.md` — Next.js error tracking install
|
|
65
|
+
- `references/error-tracking-monitoring.md` — monitor and search issues
|
|
66
|
+
- `references/error-tracking-source-maps.md` — upload source maps so traces resolve to original source
|
|
67
|
+
- `references/error-tracking-alerts.md` — error tracking alerts
|
|
68
|
+
- `references/error-tracking-assigning-issues.md` — assign issues to teammates
|
|
69
|
+
- `references/error-tracking-fingerprints.md` — custom fingerprints for grouping
|
|
70
|
+
|
|
71
|
+
Key guidelines:
|
|
72
|
+
- Enable exception autocapture in SDK init before adding manual captures.
|
|
73
|
+
- Upload source maps, otherwise stack traces point at minified bundles.
|
|
74
|
+
- Use `captureException()` at error boundaries and catch blocks for errors that don't reach the global handler.
|
|
75
|
+
|
|
76
|
+
### 4. Feature flags
|
|
77
|
+
|
|
78
|
+
Evaluate boolean and multivariate flags, server- and client-side.
|
|
79
|
+
|
|
80
|
+
- `references/feature-flags-best-practices.md` — flag best practices
|
|
81
|
+
- `references/feature-flags-react.md` — React hooks (`useFeatureFlagEnabled`, `useFeatureFlagPayload`)
|
|
82
|
+
|
|
83
|
+
Key guidelines:
|
|
84
|
+
- Default to boolean flag checks unless multivariate is explicitly requested.
|
|
85
|
+
- Prefer server-side evaluation to avoid UI flicker: in Server Components / Route Handlers use the `posthog-node` SDK (`getFeatureFlag` / `getAllFlags`, then `await posthog.shutdown()`), and pass values to client components as props.
|
|
86
|
+
- The React hooks work WITHOUT `PostHogProvider` if `posthog-js` is already initialized (e.g. via `instrumentation-client.ts`). Don't add a provider just for flags.
|
|
87
|
+
- Client-side hooks may return `undefined` while flags load — handle the loading state.
|
|
88
|
+
- If a PostHog MCP server is connected, use its flag-management tools to create/list/update flags directly instead of asking the user to do it in the dashboard.
|
|
89
|
+
|
|
90
|
+
## Documentation
|
|
91
|
+
|
|
92
|
+
When a reference doesn't cover the case, fetch current PostHog docs. Prefer your native web fetch/search tools over `curl`.
|
|
93
|
+
|
|
94
|
+
- Browse `https://posthog.com/docs` or fetch a page as markdown by appending `.md` to its path:
|
|
95
|
+
```bash
|
|
96
|
+
curl -s "https://posthog.com/docs/libraries/next-js.md"
|
|
97
|
+
```
|
|
98
|
+
- The full doc index lives at `https://posthog.com/llms.txt`.
|
|
99
|
+
|
|
100
|
+
## Attribution
|
|
101
|
+
|
|
102
|
+
Curated from PostHog's official skills collection (`github.com/PostHog/skills`, MIT). Reference files are sourced from the `integration`, `llm-analytics`, `error-tracking`, and `feature-flags` skills, trimmed to the Next.js + AI SDK stack.
|