@ketecode/loom 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +516 -2
- package/agents/accessibility-reviewer/AGENT.md +70 -0
- package/agents/accessibility-reviewer/evals/triggers.json +15 -0
- package/agents/agent-evaluator/AGENT.md +74 -0
- package/agents/agent-evaluator/evals/triggers.json +15 -0
- package/agents/architect/AGENT.md +82 -0
- package/agents/architect/evals/triggers.json +17 -0
- package/agents/billing-reviewer/AGENT.md +68 -0
- package/agents/billing-reviewer/evals/triggers.json +16 -0
- package/agents/code-reviewer/AGENT.md +51 -0
- package/agents/code-reviewer/evals/triggers.json +14 -0
- package/agents/code-simplifier/AGENT.md +74 -0
- package/agents/code-simplifier/evals/triggers.json +15 -0
- package/agents/cpp-build-resolver/AGENT.md +73 -0
- package/agents/cpp-build-resolver/evals/triggers.json +16 -0
- package/agents/cpp-reviewer/AGENT.md +59 -0
- package/agents/cpp-reviewer/evals/triggers.json +16 -0
- package/agents/csharp-build-resolver/AGENT.md +84 -0
- package/agents/csharp-build-resolver/evals/triggers.json +17 -0
- package/agents/csharp-reviewer/AGENT.md +88 -0
- package/agents/csharp-reviewer/evals/triggers.json +17 -0
- package/agents/dart-build-resolver/AGENT.md +80 -0
- package/agents/dart-build-resolver/evals/triggers.json +17 -0
- package/agents/dart-reviewer/AGENT.md +66 -0
- package/agents/dart-reviewer/evals/triggers.json +17 -0
- package/agents/database-reviewer/AGENT.md +72 -0
- package/agents/database-reviewer/evals/triggers.json +16 -0
- package/agents/django-reviewer/AGENT.md +61 -0
- package/agents/django-reviewer/evals/triggers.json +15 -0
- package/agents/doc-updater/AGENT.md +92 -0
- package/agents/doc-updater/evals/triggers.json +14 -0
- package/agents/e2e-runner/AGENT.md +88 -0
- package/agents/e2e-runner/evals/triggers.json +16 -0
- package/agents/fastapi-reviewer/AGENT.md +63 -0
- package/agents/fastapi-reviewer/evals/triggers.json +15 -0
- package/agents/flutter-reviewer/AGENT.md +70 -0
- package/agents/flutter-reviewer/evals/triggers.json +15 -0
- package/agents/fsharp-build-resolver/AGENT.md +81 -0
- package/agents/fsharp-build-resolver/evals/triggers.json +15 -0
- package/agents/fsharp-reviewer/AGENT.md +77 -0
- package/agents/fsharp-reviewer/evals/triggers.json +15 -0
- package/agents/go-build-resolver/AGENT.md +85 -0
- package/agents/go-build-resolver/evals/triggers.json +16 -0
- package/agents/go-reviewer/AGENT.md +66 -0
- package/agents/go-reviewer/evals/triggers.json +16 -0
- package/agents/healthcare-reviewer/AGENT.md +65 -0
- package/agents/healthcare-reviewer/evals/triggers.json +16 -0
- package/agents/i18n-reviewer/AGENT.md +64 -0
- package/agents/i18n-reviewer/evals/triggers.json +16 -0
- package/agents/infra-reviewer/AGENT.md +93 -0
- package/agents/infra-reviewer/evals/triggers.json +15 -0
- package/agents/java-build-resolver/AGENT.md +82 -0
- package/agents/java-build-resolver/evals/triggers.json +16 -0
- package/agents/java-reviewer/AGENT.md +64 -0
- package/agents/java-reviewer/evals/triggers.json +16 -0
- package/agents/kotlin-build-resolver/AGENT.md +89 -0
- package/agents/kotlin-build-resolver/evals/triggers.json +16 -0
- package/agents/kotlin-reviewer/AGENT.md +75 -0
- package/agents/kotlin-reviewer/evals/triggers.json +16 -0
- package/agents/mle-reviewer/AGENT.md +68 -0
- package/agents/mle-reviewer/evals/triggers.json +16 -0
- package/agents/network-config-reviewer/AGENT.md +68 -0
- package/agents/network-config-reviewer/evals/triggers.json +17 -0
- package/agents/payments-reviewer/AGENT.md +64 -0
- package/agents/payments-reviewer/evals/triggers.json +16 -0
- package/agents/performance-optimizer/AGENT.md +86 -0
- package/agents/performance-optimizer/evals/triggers.json +16 -0
- package/agents/perl-build-resolver/AGENT.md +84 -0
- package/agents/perl-build-resolver/evals/triggers.json +15 -0
- package/agents/perl-reviewer/AGENT.md +77 -0
- package/agents/perl-reviewer/evals/triggers.json +15 -0
- package/agents/php-build-resolver/AGENT.md +88 -0
- package/agents/php-build-resolver/evals/triggers.json +16 -0
- package/agents/php-reviewer/AGENT.md +61 -0
- package/agents/php-reviewer/evals/triggers.json +15 -0
- package/agents/planner/AGENT.md +75 -0
- package/agents/planner/evals/triggers.json +17 -0
- package/agents/pr-test-analyzer/AGENT.md +82 -0
- package/agents/pr-test-analyzer/evals/triggers.json +16 -0
- package/agents/python-build-resolver/AGENT.md +87 -0
- package/agents/python-build-resolver/evals/triggers.json +16 -0
- package/agents/python-reviewer/AGENT.md +63 -0
- package/agents/python-reviewer/evals/triggers.json +15 -0
- package/agents/rag-reviewer/AGENT.md +71 -0
- package/agents/rag-reviewer/evals/triggers.json +16 -0
- package/agents/react-reviewer/AGENT.md +70 -0
- package/agents/react-reviewer/evals/triggers.json +16 -0
- package/agents/refactor-cleaner/AGENT.md +82 -0
- package/agents/refactor-cleaner/evals/triggers.json +16 -0
- package/agents/ruby-build-resolver/AGENT.md +93 -0
- package/agents/ruby-build-resolver/evals/triggers.json +16 -0
- package/agents/ruby-reviewer/AGENT.md +62 -0
- package/agents/ruby-reviewer/evals/triggers.json +16 -0
- package/agents/rust-build-resolver/AGENT.md +98 -0
- package/agents/rust-build-resolver/evals/triggers.json +16 -0
- package/agents/rust-reviewer/AGENT.md +78 -0
- package/agents/rust-reviewer/evals/triggers.json +15 -0
- package/agents/security-reviewer/AGENT.md +84 -0
- package/agents/security-reviewer/evals/triggers.json +16 -0
- package/agents/silent-failure-hunter/AGENT.md +66 -0
- package/agents/silent-failure-hunter/evals/triggers.json +16 -0
- package/agents/solidity-reviewer/AGENT.md +70 -0
- package/agents/solidity-reviewer/evals/triggers.json +16 -0
- package/agents/swift-build-resolver/AGENT.md +85 -0
- package/agents/swift-build-resolver/evals/triggers.json +15 -0
- package/agents/swift-reviewer/AGENT.md +75 -0
- package/agents/swift-reviewer/evals/triggers.json +15 -0
- package/agents/typescript-build-resolver/AGENT.md +76 -0
- package/agents/typescript-build-resolver/evals/triggers.json +15 -0
- package/agents/typescript-reviewer/AGENT.md +76 -0
- package/agents/typescript-reviewer/evals/triggers.json +15 -0
- package/agents/vue-reviewer/AGENT.md +75 -0
- package/agents/vue-reviewer/evals/triggers.json +15 -0
- package/bin/kete-loom.js +683 -0
- package/commands/aside.md +19 -0
- package/commands/build-fix.md +26 -0
- package/commands/campaign.md +19 -0
- package/commands/changelog.md +36 -0
- package/commands/checkpoint.md +26 -0
- package/commands/codemap.md +25 -0
- package/commands/commit.md +26 -0
- package/commands/deps-audit.md +32 -0
- package/commands/epic-decompose.md +21 -0
- package/commands/explain.md +37 -0
- package/commands/feature-dev.md +22 -0
- package/commands/hookify.md +23 -0
- package/commands/i18n-check.md +39 -0
- package/commands/issue-sync.md +22 -0
- package/commands/jira.md +19 -0
- package/commands/learn.md +23 -0
- package/commands/loom.md +21 -0
- package/commands/loop.md +20 -0
- package/commands/model-route.md +27 -0
- package/commands/onboard.md +35 -0
- package/commands/orchestrate.md +21 -0
- package/commands/plan-feature.md +36 -0
- package/commands/postmortem.md +42 -0
- package/commands/pr-describe.md +39 -0
- package/commands/pr.md +22 -0
- package/commands/prd.md +41 -0
- package/commands/project-init.md +21 -0
- package/commands/refactor-clean.md +24 -0
- package/commands/resume-session.md +22 -0
- package/commands/review.md +35 -0
- package/commands/save-session.md +37 -0
- package/commands/security-scan.md +32 -0
- package/commands/sessions.md +21 -0
- package/commands/skill-create.md +21 -0
- package/commands/tdd.md +36 -0
- package/commands/test-coverage.md +24 -0
- package/commands/threat-model.md +36 -0
- package/commands/update-docs.md +25 -0
- package/commands/verify.md +21 -0
- package/hooks/block-dangerous-commands/HOOK.md +30 -0
- package/hooks/block-dangerous-commands/cases.json +50 -0
- package/hooks/block-dangerous-commands/hook.js +75 -0
- package/hooks/block-no-verify/HOOK.md +25 -0
- package/hooks/block-no-verify/cases.json +30 -0
- package/hooks/block-no-verify/hook.js +43 -0
- package/hooks/format-on-edit/HOOK.md +24 -0
- package/hooks/format-on-edit/hook.js +89 -0
- package/hooks/guard-secrets/HOOK.md +19 -0
- package/hooks/guard-secrets/cases.json +110 -0
- package/hooks/guard-secrets/hook.js +44 -0
- package/hooks/load-session-context/HOOK.md +20 -0
- package/hooks/load-session-context/hook.js +56 -0
- package/hooks/protect-files/HOOK.md +24 -0
- package/hooks/protect-files/cases.json +27 -0
- package/hooks/protect-files/hook.js +39 -0
- package/hooks/run.js +132 -0
- package/mcp/atlassian.json +11 -0
- package/mcp/chrome-devtools.json +18 -0
- package/mcp/cloudflare.json +11 -0
- package/mcp/context7.json +11 -0
- package/mcp/fetch.json +17 -0
- package/mcp/figma.json +11 -0
- package/mcp/git.json +17 -0
- package/mcp/github.json +11 -0
- package/mcp/linear.json +11 -0
- package/mcp/memory.json +18 -0
- package/mcp/notion.json +11 -0
- package/mcp/playwright.json +18 -0
- package/mcp/sentry.json +11 -0
- package/mcp/stripe.json +11 -0
- package/mcp/supabase.json +11 -0
- package/mcp/time.json +17 -0
- package/package.json +59 -4
- package/profiles.json +165 -0
- package/rules/common.md +21 -0
- package/rules/cpp.md +29 -0
- package/rules/csharp.md +25 -0
- package/rules/dart.md +29 -0
- package/rules/fsharp.md +28 -0
- package/rules/git.md +26 -0
- package/rules/go.md +29 -0
- package/rules/java.md +29 -0
- package/rules/kotlin.md +27 -0
- package/rules/perl.md +26 -0
- package/rules/php.md +28 -0
- package/rules/python.md +30 -0
- package/rules/ruby.md +27 -0
- package/rules/rust.md +26 -0
- package/rules/security.md +29 -0
- package/rules/swift.md +28 -0
- package/rules/testing.md +25 -0
- package/rules/typescript.md +29 -0
- package/schemas/skill-frontmatter.schema.json +52 -0
- package/scripts/lib/audit.js +96 -0
- package/scripts/lib/frontmatter.js +65 -0
- package/scripts/lib/hooks-install.js +292 -0
- package/scripts/lib/i18n.js +51 -0
- package/scripts/lib/inventory.js +85 -0
- package/scripts/lib/lint.js +158 -0
- package/scripts/lib/mcp-install.js +284 -0
- package/scripts/lib/profiles.js +128 -0
- package/scripts/lib/render.js +86 -0
- package/scripts/lib/rules-install.js +118 -0
- package/scripts/lib/skills.js +86 -0
- package/scripts/lib/targets.js +113 -0
- package/skills/accounting-api-integration/SKILL.md +81 -0
- package/skills/accounting-api-integration/evals/triggers.json +17 -0
- package/skills/accounting-api-integration/references/quickbooks.md +48 -0
- package/skills/accounting-api-integration/references/xero.md +45 -0
- package/skills/agent-harness-design/SKILL.md +125 -0
- package/skills/agent-harness-design/evals/triggers.json +21 -0
- package/skills/ai-media-generation/SKILL.md +89 -0
- package/skills/ai-media-generation/evals/triggers.json +16 -0
- package/skills/ai-media-generation/references/job-pipeline.md +76 -0
- package/skills/angular-patterns/SKILL.md +122 -0
- package/skills/angular-patterns/evals/triggers.json +16 -0
- package/skills/api-design/SKILL.md +96 -0
- package/skills/api-design/evals/triggers.json +18 -0
- package/skills/api-design/references/conventions.md +133 -0
- package/skills/architecture-decision-records/SKILL.md +98 -0
- package/skills/architecture-decision-records/evals/triggers.json +17 -0
- package/skills/article-writing/SKILL.md +108 -0
- package/skills/article-writing/evals/triggers.json +16 -0
- package/skills/aspnet-core-patterns/SKILL.md +149 -0
- package/skills/aspnet-core-patterns/evals/triggers.json +16 -0
- package/skills/auth-patterns/SKILL.md +104 -0
- package/skills/auth-patterns/evals/triggers.json +17 -0
- package/skills/auth-patterns/references/oauth-oidc.md +64 -0
- package/skills/autonomous-loops/SKILL.md +99 -0
- package/skills/autonomous-loops/evals/triggers.json +14 -0
- package/skills/aws-patterns/SKILL.md +91 -0
- package/skills/aws-patterns/evals/triggers.json +16 -0
- package/skills/azure-patterns/SKILL.md +86 -0
- package/skills/azure-patterns/evals/triggers.json +16 -0
- package/skills/benchmark-methodology/SKILL.md +88 -0
- package/skills/benchmark-methodology/evals/triggers.json +16 -0
- package/skills/benchmark-methodology/references/language-harnesses.md +130 -0
- package/skills/bgp-diagnostics/SKILL.md +84 -0
- package/skills/bgp-diagnostics/evals/triggers.json +18 -0
- package/skills/bgp-diagnostics/references/bgp-reference.md +81 -0
- package/skills/bioinformatics-workflows/SKILL.md +108 -0
- package/skills/bioinformatics-workflows/evals/triggers.json +16 -0
- package/skills/bioinformatics-workflows/references/commands.md +71 -0
- package/skills/bioinformatics-workflows/references/formats.md +24 -0
- package/skills/bioinformatics-workflows/references/workflow-managers.md +107 -0
- package/skills/brand-voice/SKILL.md +112 -0
- package/skills/brand-voice/evals/triggers.json +16 -0
- package/skills/browser-qa/SKILL.md +99 -0
- package/skills/browser-qa/evals/triggers.json +16 -0
- package/skills/bun-runtime/SKILL.md +93 -0
- package/skills/bun-runtime/evals/triggers.json +16 -0
- package/skills/cisco-ios-config/SKILL.md +101 -0
- package/skills/cisco-ios-config/evals/triggers.json +18 -0
- package/skills/cisco-ios-config/references/verification.md +63 -0
- package/skills/clickhouse-patterns/SKILL.md +101 -0
- package/skills/clickhouse-patterns/evals/triggers.json +18 -0
- package/skills/clickhouse-patterns/references/engines-and-views.md +138 -0
- package/skills/clinical-decision-support/SKILL.md +90 -0
- package/skills/clinical-decision-support/evals/triggers.json +16 -0
- package/skills/clinical-decision-support/references/cds-hooks.md +76 -0
- package/skills/clinical-decision-support/references/regulatory-boundaries.md +37 -0
- package/skills/code-tour/SKILL.md +97 -0
- package/skills/code-tour/evals/triggers.json +14 -0
- package/skills/codebase-onboarding/SKILL.md +112 -0
- package/skills/codebase-onboarding/evals/triggers.json +14 -0
- package/skills/cold-outreach-sequences/SKILL.md +90 -0
- package/skills/cold-outreach-sequences/evals/triggers.json +16 -0
- package/skills/content-repurposing/SKILL.md +82 -0
- package/skills/content-repurposing/evals/triggers.json +16 -0
- package/skills/context-budget/SKILL.md +84 -0
- package/skills/context-budget/evals/triggers.json +14 -0
- package/skills/conventional-commits/SKILL.md +144 -0
- package/skills/conventional-commits/evals/triggers.json +16 -0
- package/skills/cpp-patterns/SKILL.md +129 -0
- package/skills/cpp-patterns/evals/triggers.json +16 -0
- package/skills/cpp-patterns/references/cmake-and-tooling.md +88 -0
- package/skills/cpp-patterns/references/undefined-behaviour.md +75 -0
- package/skills/cpp-testing/SKILL.md +131 -0
- package/skills/cpp-testing/evals/triggers.json +16 -0
- package/skills/csharp-patterns/SKILL.md +110 -0
- package/skills/csharp-patterns/evals/triggers.json +17 -0
- package/skills/csharp-patterns/references/analyzers.md +59 -0
- package/skills/csharp-testing/SKILL.md +85 -0
- package/skills/csharp-testing/evals/triggers.json +17 -0
- package/skills/csharp-testing/references/integration-tests.md +77 -0
- package/skills/css-architecture/SKILL.md +143 -0
- package/skills/css-architecture/evals/triggers.json +16 -0
- package/skills/customs-trade-compliance/SKILL.md +95 -0
- package/skills/customs-trade-compliance/evals/triggers.json +16 -0
- package/skills/customs-trade-compliance/references/incoterms-2020.md +42 -0
- package/skills/dart-patterns/SKILL.md +157 -0
- package/skills/dart-patterns/evals/triggers.json +18 -0
- package/skills/dart-testing/SKILL.md +164 -0
- package/skills/dart-testing/evals/triggers.json +18 -0
- package/skills/data-analysis-notebooks/SKILL.md +113 -0
- package/skills/data-analysis-notebooks/evals/triggers.json +16 -0
- package/skills/data-analysis-notebooks/references/dataframe-pitfalls.md +49 -0
- package/skills/data-analysis-notebooks/references/statistics-pitfalls.md +24 -0
- package/skills/data-pipelines/SKILL.md +90 -0
- package/skills/data-pipelines/evals/triggers.json +16 -0
- package/skills/data-pipelines/references/orchestrators.md +64 -0
- package/skills/database-migrations/SKILL.md +102 -0
- package/skills/database-migrations/evals/triggers.json +16 -0
- package/skills/database-migrations/references/recipes.md +98 -0
- package/skills/database-migrations/references/tools.md +21 -0
- package/skills/dbt-patterns/SKILL.md +96 -0
- package/skills/dbt-patterns/evals/triggers.json +16 -0
- package/skills/dbt-patterns/references/yaml-examples.md +114 -0
- package/skills/deep-research/SKILL.md +107 -0
- package/skills/deep-research/evals/triggers.json +14 -0
- package/skills/dependency-audit/SKILL.md +103 -0
- package/skills/dependency-audit/evals/triggers.json +16 -0
- package/skills/dependency-audit/references/tools.md +124 -0
- package/skills/deployment-strategies/SKILL.md +108 -0
- package/skills/deployment-strategies/evals/triggers.json +16 -0
- package/skills/django-patterns/SKILL.md +123 -0
- package/skills/django-patterns/evals/triggers.json +16 -0
- package/skills/docker-patterns/SKILL.md +132 -0
- package/skills/docker-patterns/evals/triggers.json +16 -0
- package/skills/docker-patterns/references/dockerfiles.md +105 -0
- package/skills/e2e-testing-playwright/SKILL.md +94 -0
- package/skills/e2e-testing-playwright/evals/triggers.json +16 -0
- package/skills/e2e-testing-playwright/references/config-and-ci.md +129 -0
- package/skills/ef-core-patterns/SKILL.md +117 -0
- package/skills/ef-core-patterns/evals/triggers.json +16 -0
- package/skills/email-deliverability/SKILL.md +99 -0
- package/skills/email-deliverability/evals/triggers.json +17 -0
- package/skills/email-deliverability/references/dns-records.md +85 -0
- package/skills/error-handling-patterns/SKILL.md +112 -0
- package/skills/error-handling-patterns/evals/triggers.json +18 -0
- package/skills/error-handling-patterns/references/language-idioms.md +49 -0
- package/skills/estimation-and-scoping/SKILL.md +97 -0
- package/skills/estimation-and-scoping/evals/triggers.json +14 -0
- package/skills/evm-dapp-integration/SKILL.md +73 -0
- package/skills/evm-dapp-integration/evals/triggers.json +16 -0
- package/skills/fastapi-patterns/SKILL.md +127 -0
- package/skills/fastapi-patterns/evals/triggers.json +16 -0
- package/skills/ffmpeg-media-processing/SKILL.md +94 -0
- package/skills/ffmpeg-media-processing/evals/triggers.json +16 -0
- package/skills/ffmpeg-media-processing/references/recipes.md +112 -0
- package/skills/fhir-integration/SKILL.md +81 -0
- package/skills/fhir-integration/evals/triggers.json +16 -0
- package/skills/fhir-integration/references/search-and-bundles.md +73 -0
- package/skills/fhir-integration/references/smart-on-fhir.md +50 -0
- package/skills/flask-patterns/SKILL.md +132 -0
- package/skills/flask-patterns/evals/triggers.json +16 -0
- package/skills/flutter-patterns/SKILL.md +99 -0
- package/skills/flutter-patterns/evals/triggers.json +16 -0
- package/skills/flutterwave-integration/SKILL.md +75 -0
- package/skills/flutterwave-integration/evals/triggers.json +16 -0
- package/skills/flutterwave-integration/references/api.md +73 -0
- package/skills/flutterwave-integration/references/webhooks.md +49 -0
- package/skills/fsharp-patterns/SKILL.md +133 -0
- package/skills/fsharp-patterns/evals/triggers.json +16 -0
- package/skills/fsharp-testing/SKILL.md +136 -0
- package/skills/fsharp-testing/evals/triggers.json +16 -0
- package/skills/gcp-patterns/SKILL.md +86 -0
- package/skills/gcp-patterns/evals/triggers.json +16 -0
- package/skills/git-workflow/SKILL.md +114 -0
- package/skills/git-workflow/evals/triggers.json +16 -0
- package/skills/github-actions-ci/SKILL.md +117 -0
- package/skills/github-actions-ci/evals/triggers.json +16 -0
- package/skills/github-api-automation/SKILL.md +101 -0
- package/skills/github-api-automation/evals/triggers.json +17 -0
- package/skills/go-patterns/SKILL.md +118 -0
- package/skills/go-patterns/evals/triggers.json +17 -0
- package/skills/go-patterns/references/concurrency.md +162 -0
- package/skills/go-testing/SKILL.md +154 -0
- package/skills/go-testing/evals/triggers.json +17 -0
- package/skills/hexagonal-architecture/SKILL.md +89 -0
- package/skills/hexagonal-architecture/evals/triggers.json +17 -0
- package/skills/hipaa-compliance/SKILL.md +91 -0
- package/skills/hipaa-compliance/evals/triggers.json +18 -0
- package/skills/hipaa-compliance/references/safeguards.md +68 -0
- package/skills/hl7v2-integration/SKILL.md +69 -0
- package/skills/hl7v2-integration/evals/triggers.json +16 -0
- package/skills/hl7v2-integration/references/messages-and-ack.md +78 -0
- package/skills/homelab-network-setup/SKILL.md +125 -0
- package/skills/homelab-network-setup/evals/triggers.json +18 -0
- package/skills/homelab-network-setup/references/firewall-and-dns.md +45 -0
- package/skills/homelab-network-setup/references/wireguard.md +72 -0
- package/skills/hubtel-integration/SKILL.md +77 -0
- package/skills/hubtel-integration/evals/triggers.json +16 -0
- package/skills/hubtel-integration/references/api.md +92 -0
- package/skills/i18n-localization/SKILL.md +114 -0
- package/skills/i18n-localization/evals/triggers.json +16 -0
- package/skills/i18n-localization/references/libraries.md +52 -0
- package/skills/incident-postmortem/SKILL.md +118 -0
- package/skills/incident-postmortem/evals/triggers.json +14 -0
- package/skills/inventory-demand-planning/SKILL.md +89 -0
- package/skills/inventory-demand-planning/evals/triggers.json +16 -0
- package/skills/inventory-demand-planning/references/formulas.md +62 -0
- package/skills/investor-materials/SKILL.md +127 -0
- package/skills/investor-materials/evals/triggers.json +16 -0
- package/skills/investor-materials/references/templates.md +74 -0
- package/skills/invoicing-and-tax/SKILL.md +84 -0
- package/skills/invoicing-and-tax/evals/triggers.json +17 -0
- package/skills/invoicing-and-tax/references/e-invoicing.md +24 -0
- package/skills/invoicing-and-tax/references/invoice-fields.md +38 -0
- package/skills/invoicing-and-tax/references/rounding.md +26 -0
- package/skills/java-patterns/SKILL.md +141 -0
- package/skills/java-patterns/evals/triggers.json +17 -0
- package/skills/java-testing/SKILL.md +142 -0
- package/skills/java-testing/evals/triggers.json +16 -0
- package/skills/jetpack-compose-patterns/SKILL.md +88 -0
- package/skills/jetpack-compose-patterns/evals/triggers.json +16 -0
- package/skills/jira-integration/SKILL.md +92 -0
- package/skills/jira-integration/evals/triggers.json +17 -0
- package/skills/jpa-hibernate/SKILL.md +92 -0
- package/skills/jpa-hibernate/evals/triggers.json +18 -0
- package/skills/jpa-hibernate/references/mapping.md +99 -0
- package/skills/kotlin-multiplatform/SKILL.md +97 -0
- package/skills/kotlin-multiplatform/evals/triggers.json +16 -0
- package/skills/kotlin-patterns/SKILL.md +128 -0
- package/skills/kotlin-patterns/evals/triggers.json +16 -0
- package/skills/kotlin-testing/SKILL.md +117 -0
- package/skills/kotlin-testing/evals/triggers.json +16 -0
- package/skills/ktor-patterns/SKILL.md +135 -0
- package/skills/ktor-patterns/evals/triggers.json +18 -0
- package/skills/kubernetes-patterns/SKILL.md +106 -0
- package/skills/kubernetes-patterns/evals/triggers.json +16 -0
- package/skills/kubernetes-patterns/references/manifests.md +115 -0
- package/skills/laravel-patterns/SKILL.md +136 -0
- package/skills/laravel-patterns/evals/triggers.json +16 -0
- package/skills/linear-integration/SKILL.md +98 -0
- package/skills/linear-integration/evals/triggers.json +17 -0
- package/skills/literature-review/SKILL.md +109 -0
- package/skills/literature-review/evals/triggers.json +16 -0
- package/skills/literature-review/references/appraisal.md +41 -0
- package/skills/literature-review/references/search-sources.md +39 -0
- package/skills/llm-app-patterns/SKILL.md +97 -0
- package/skills/llm-app-patterns/evals/triggers.json +17 -0
- package/skills/llm-evals/SKILL.md +98 -0
- package/skills/llm-evals/evals/triggers.json +16 -0
- package/skills/llm-evals/references/graders.md +66 -0
- package/skills/logistics-exception-management/SKILL.md +90 -0
- package/skills/logistics-exception-management/evals/triggers.json +16 -0
- package/skills/manim-animations/SKILL.md +106 -0
- package/skills/manim-animations/evals/triggers.json +16 -0
- package/skills/market-research/SKILL.md +117 -0
- package/skills/market-research/evals/triggers.json +16 -0
- package/skills/marketing-campaign/SKILL.md +111 -0
- package/skills/marketing-campaign/evals/triggers.json +16 -0
- package/skills/mcp-server-patterns/SKILL.md +127 -0
- package/skills/mcp-server-patterns/evals/triggers.json +18 -0
- package/skills/mcp-server-patterns/references/protocol-notes.md +68 -0
- package/skills/metrics-dashboards/SKILL.md +113 -0
- package/skills/metrics-dashboards/evals/triggers.json +16 -0
- package/skills/ml-experiment-workflow/SKILL.md +125 -0
- package/skills/ml-experiment-workflow/evals/triggers.json +16 -0
- package/skills/mongodb-patterns/SKILL.md +115 -0
- package/skills/mongodb-patterns/evals/triggers.json +18 -0
- package/skills/mongodb-patterns/references/indexes-and-aggregation.md +94 -0
- package/skills/mpesa-daraja-integration/SKILL.md +70 -0
- package/skills/mpesa-daraja-integration/evals/triggers.json +16 -0
- package/skills/mpesa-daraja-integration/references/api.md +103 -0
- package/skills/mpesa-daraja-integration/references/callbacks.md +74 -0
- package/skills/mtn-momo-integration/SKILL.md +66 -0
- package/skills/mtn-momo-integration/evals/triggers.json +16 -0
- package/skills/mtn-momo-integration/references/api.md +153 -0
- package/skills/mtn-momo-integration/references/callbacks.md +92 -0
- package/skills/mtn-momo-integration/references/sandbox-and-go-live.md +51 -0
- package/skills/mtn-momo-integration/scripts/sandbox-setup.js +79 -0
- package/skills/mysql-patterns/SKILL.md +96 -0
- package/skills/mysql-patterns/evals/triggers.json +16 -0
- package/skills/mysql-patterns/references/explain.md +34 -0
- package/skills/mysql-patterns/references/online-ddl.md +41 -0
- package/skills/nestjs-patterns/SKILL.md +114 -0
- package/skills/nestjs-patterns/evals/triggers.json +16 -0
- package/skills/nestjs-patterns/references/testing.md +68 -0
- package/skills/network-automation/SKILL.md +107 -0
- package/skills/network-automation/evals/triggers.json +18 -0
- package/skills/network-automation/references/tool-snippets.md +153 -0
- package/skills/network-troubleshooting/SKILL.md +152 -0
- package/skills/network-troubleshooting/evals/triggers.json +18 -0
- package/skills/network-troubleshooting/references/commands.md +33 -0
- package/skills/nextjs-patterns/SKILL.md +150 -0
- package/skills/nextjs-patterns/evals/triggers.json +18 -0
- package/skills/nextjs-patterns/references/caching.md +87 -0
- package/skills/node-backend-patterns/SKILL.md +103 -0
- package/skills/node-backend-patterns/evals/triggers.json +16 -0
- package/skills/node-backend-patterns/references/templates.md +122 -0
- package/skills/nuxt-patterns/SKILL.md +103 -0
- package/skills/nuxt-patterns/evals/triggers.json +16 -0
- package/skills/parallel-agent-orchestration/SKILL.md +106 -0
- package/skills/parallel-agent-orchestration/evals/triggers.json +14 -0
- package/skills/paystack-integration/SKILL.md +59 -0
- package/skills/paystack-integration/evals/triggers.json +14 -0
- package/skills/paystack-integration/references/api.md +73 -0
- package/skills/paystack-integration/references/mobile-money.md +50 -0
- package/skills/paystack-integration/references/webhooks.md +80 -0
- package/skills/pci-dss-scope/SKILL.md +103 -0
- package/skills/pci-dss-scope/evals/triggers.json +18 -0
- package/skills/pci-dss-scope/references/saq-and-data.md +36 -0
- package/skills/perl-patterns/SKILL.md +135 -0
- package/skills/perl-patterns/evals/triggers.json +18 -0
- package/skills/perl-testing/SKILL.md +126 -0
- package/skills/perl-testing/evals/triggers.json +17 -0
- package/skills/php-patterns/SKILL.md +116 -0
- package/skills/php-patterns/evals/triggers.json +16 -0
- package/skills/php-testing/SKILL.md +123 -0
- package/skills/php-testing/evals/triggers.json +16 -0
- package/skills/postgres-patterns/SKILL.md +103 -0
- package/skills/postgres-patterns/evals/triggers.json +17 -0
- package/skills/postgres-patterns/references/explain.md +59 -0
- package/skills/postgres-patterns/references/locks.md +53 -0
- package/skills/prd-writing/SKILL.md +124 -0
- package/skills/prd-writing/evals/triggers.json +15 -0
- package/skills/prisma-patterns/SKILL.md +83 -0
- package/skills/prisma-patterns/evals/triggers.json +18 -0
- package/skills/prisma-patterns/references/prisma-8.md +46 -0
- package/skills/prisma-patterns/references/workflow.md +50 -0
- package/skills/privacy-compliance/SKILL.md +121 -0
- package/skills/privacy-compliance/evals/triggers.json +18 -0
- package/skills/privacy-compliance/references/jurisdictions.md +51 -0
- package/skills/production-scheduling/SKILL.md +98 -0
- package/skills/production-scheduling/evals/triggers.json +16 -0
- package/skills/prompt-engineering/SKILL.md +92 -0
- package/skills/prompt-engineering/evals/triggers.json +16 -0
- package/skills/python-patterns/SKILL.md +107 -0
- package/skills/python-patterns/evals/triggers.json +16 -0
- package/skills/python-patterns/references/tooling.md +101 -0
- package/skills/python-testing/SKILL.md +126 -0
- package/skills/python-testing/evals/triggers.json +16 -0
- package/skills/python-testing/references/mocking.md +71 -0
- package/skills/pytorch-patterns/SKILL.md +139 -0
- package/skills/pytorch-patterns/evals/triggers.json +16 -0
- package/skills/pytorch-patterns/references/debugging.md +39 -0
- package/skills/quarkus-patterns/SKILL.md +93 -0
- package/skills/quarkus-patterns/evals/triggers.json +18 -0
- package/skills/rag-pipeline-patterns/SKILL.md +117 -0
- package/skills/rag-pipeline-patterns/evals/triggers.json +18 -0
- package/skills/rag-pipeline-patterns/references/evaluation.md +37 -0
- package/skills/rag-pipeline-patterns/references/retrieval-recipes.md +78 -0
- package/skills/rails-patterns/SKILL.md +132 -0
- package/skills/rails-patterns/evals/triggers.json +16 -0
- package/skills/react-native-patterns/SKILL.md +101 -0
- package/skills/react-native-patterns/evals/triggers.json +16 -0
- package/skills/react-patterns/SKILL.md +140 -0
- package/skills/react-patterns/evals/triggers.json +18 -0
- package/skills/react-performance/SKILL.md +107 -0
- package/skills/react-performance/evals/triggers.json +18 -0
- package/skills/redis-patterns/SKILL.md +109 -0
- package/skills/redis-patterns/evals/triggers.json +18 -0
- package/skills/redis-patterns/references/operations.md +61 -0
- package/skills/refactoring-safely/SKILL.md +107 -0
- package/skills/refactoring-safely/evals/triggers.json +17 -0
- package/skills/release-management/SKILL.md +141 -0
- package/skills/release-management/evals/triggers.json +16 -0
- package/skills/remotion-video/SKILL.md +91 -0
- package/skills/remotion-video/evals/triggers.json +16 -0
- package/skills/remotion-video/references/lambda.md +66 -0
- package/skills/returns-reverse-logistics/SKILL.md +97 -0
- package/skills/returns-reverse-logistics/evals/triggers.json +16 -0
- package/skills/ruby-patterns/SKILL.md +127 -0
- package/skills/ruby-patterns/evals/triggers.json +18 -0
- package/skills/ruby-testing/SKILL.md +113 -0
- package/skills/ruby-testing/evals/triggers.json +18 -0
- package/skills/runbook-writing/SKILL.md +101 -0
- package/skills/runbook-writing/evals/triggers.json +14 -0
- package/skills/rust-patterns/SKILL.md +118 -0
- package/skills/rust-patterns/evals/triggers.json +16 -0
- package/skills/rust-patterns/references/cargo-and-clippy.md +105 -0
- package/skills/rust-patterns/references/errors-and-traits.md +97 -0
- package/skills/rust-testing/SKILL.md +148 -0
- package/skills/rust-testing/evals/triggers.json +16 -0
- package/skills/rust-testing/references/fakes-proptest-async.md +113 -0
- package/skills/search-first/SKILL.md +73 -0
- package/skills/search-first/evals/triggers.json +14 -0
- package/skills/security-review/SKILL.md +58 -0
- package/skills/security-review/evals/triggers.json +14 -0
- package/skills/security-review/references/checklist.md +54 -0
- package/skills/security-review/scripts/scan-secrets.js +79 -0
- package/skills/seo-audit/SKILL.md +111 -0
- package/skills/seo-audit/evals/triggers.json +16 -0
- package/skills/seo-audit/references/checks.md +65 -0
- package/skills/session-handoff/SKILL.md +101 -0
- package/skills/session-handoff/evals/triggers.json +14 -0
- package/skills/skill-authoring/SKILL.md +87 -0
- package/skills/skill-authoring/evals/triggers.json +14 -0
- package/skills/skill-authoring/references/frontmatter.md +40 -0
- package/skills/slack-app-integration/SKILL.md +108 -0
- package/skills/slack-app-integration/evals/triggers.json +17 -0
- package/skills/smart-contract-security/SKILL.md +110 -0
- package/skills/smart-contract-security/evals/triggers.json +16 -0
- package/skills/smart-contract-security/references/vulnerability-checklist.md +79 -0
- package/skills/social-media-publishing/SKILL.md +84 -0
- package/skills/social-media-publishing/evals/triggers.json +17 -0
- package/skills/social-media-publishing/references/platform-apis.md +116 -0
- package/skills/solidity-patterns/SKILL.md +95 -0
- package/skills/solidity-patterns/evals/triggers.json +16 -0
- package/skills/spring-boot-patterns/SKILL.md +128 -0
- package/skills/spring-boot-patterns/evals/triggers.json +18 -0
- package/skills/spring-boot-patterns/references/testing.md +72 -0
- package/skills/stripe-integration/SKILL.md +69 -0
- package/skills/stripe-integration/evals/triggers.json +16 -0
- package/skills/stripe-integration/references/api.md +71 -0
- package/skills/stripe-integration/references/billing.md +58 -0
- package/skills/stripe-integration/references/webhooks.md +76 -0
- package/skills/subscription-billing-ops/SKILL.md +118 -0
- package/skills/subscription-billing-ops/evals/triggers.json +17 -0
- package/skills/subscription-billing-ops/references/proration.md +47 -0
- package/skills/subscription-billing-ops/references/revenue-metrics.md +38 -0
- package/skills/svelte-patterns/SKILL.md +122 -0
- package/skills/svelte-patterns/evals/triggers.json +16 -0
- package/skills/swift-patterns/SKILL.md +113 -0
- package/skills/swift-patterns/evals/triggers.json +16 -0
- package/skills/swift-patterns/references/concurrency-migration.md +40 -0
- package/skills/swift-testing/SKILL.md +121 -0
- package/skills/swift-testing/evals/triggers.json +16 -0
- package/skills/swift-testing/references/swift-testing-cheatsheet.md +81 -0
- package/skills/swiftui-patterns/SKILL.md +102 -0
- package/skills/swiftui-patterns/evals/triggers.json +16 -0
- package/skills/tdd-workflow/SKILL.md +67 -0
- package/skills/tdd-workflow/evals/triggers.json +14 -0
- package/skills/technical-writing/SKILL.md +95 -0
- package/skills/technical-writing/evals/triggers.json +14 -0
- package/skills/terraform-patterns/SKILL.md +122 -0
- package/skills/terraform-patterns/evals/triggers.json +16 -0
- package/skills/terraform-patterns/references/backends.md +67 -0
- package/skills/test-coverage-improvement/SKILL.md +107 -0
- package/skills/test-coverage-improvement/evals/triggers.json +16 -0
- package/skills/threat-modeling/SKILL.md +113 -0
- package/skills/threat-modeling/evals/triggers.json +16 -0
- package/skills/typescript-patterns/SKILL.md +122 -0
- package/skills/typescript-patterns/evals/triggers.json +16 -0
- package/skills/typescript-testing/SKILL.md +101 -0
- package/skills/typescript-testing/evals/triggers.json +16 -0
- package/skills/verification-loop/SKILL.md +70 -0
- package/skills/verification-loop/evals/triggers.json +14 -0
- package/skills/verification-loop/scripts/detect-checks.js +102 -0
- package/skills/vite-patterns/SKILL.md +117 -0
- package/skills/vite-patterns/evals/triggers.json +16 -0
- package/skills/vue-patterns/SKILL.md +104 -0
- package/skills/vue-patterns/evals/triggers.json +16 -0
- package/skills/web-accessibility/SKILL.md +119 -0
- package/skills/web-accessibility/evals/triggers.json +16 -0
- package/skills/web-performance/SKILL.md +107 -0
- package/skills/web-performance/evals/triggers.json +16 -0
- package/skills/web-scraping/SKILL.md +80 -0
- package/skills/web-scraping/evals/triggers.json +16 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: llm-app-patterns
|
|
3
|
+
description: Engineering patterns for shipping LLM-backed product features in application code, covering schema-validated structured output, timeouts and bounded retries, streaming responses, prompt caching and token budgets, choosing a model tier, defending against prompt injection from untrusted content, and logging each call so it can be evaluated later. Use when wiring a model API call into a backend or app, hardening an existing LLM feature for production, cutting its latency or cost, or handling tool output and user documents that reach the model.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Any Agent Skills host. Provider-neutral; applies to any model API or SDK in any backend language.
|
|
6
|
+
metadata:
|
|
7
|
+
kete-loom/version: "0.1.0"
|
|
8
|
+
kete-loom/category: ai
|
|
9
|
+
kete-loom/risk: writes-files
|
|
10
|
+
kete-loom/owner: "Kete-org"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# LLM app patterns
|
|
14
|
+
|
|
15
|
+
Treat a model call like any other unreliable network dependency that returns untrusted text. This skill covers the code around the call. For wording the prompt itself, use `prompt-engineering`; for measuring quality, use `llm-evals`; for retrieval pipelines, use `rag-pipeline-patterns`.
|
|
16
|
+
|
|
17
|
+
## 0. Before you write code
|
|
18
|
+
|
|
19
|
+
1. Find what the project already uses: search for the provider SDK import, an existing client wrapper, env vars holding API keys, and any logging or tracing of model calls. Extend that; don't add a second client.
|
|
20
|
+
2. Write down the feature contract in one or two lines: input, output shape, latency budget, and what the user sees when the model fails.
|
|
21
|
+
3. If there is no fallback behaviour for "model unavailable" and the feature is user-facing, **stop and ask the user** what should happen (hide the feature, show an error, use a non-LLM default).
|
|
22
|
+
|
|
23
|
+
## 1. Structured output
|
|
24
|
+
|
|
25
|
+
1. Define the output as a schema in code (JSON Schema, Zod, Pydantic, a typed struct). That schema is the source of truth for the prompt, the parser and the tests.
|
|
26
|
+
2. Use the provider's native structured output or tool/function calling with that schema when available. Otherwise ask for JSON only and parse strictly.
|
|
27
|
+
3. **Always validate** the parsed result against the schema in your code, even when the provider claims to enforce it. Reject unknown enum values and out-of-range numbers.
|
|
28
|
+
4. On a validation failure: retry once, sending the validation error back to the model. If it fails again, return the defined fallback. Never pass unvalidated model output to a database write, a shell, a SQL query, an HTML page or another tool.
|
|
29
|
+
5. Keep schemas flat and small. Add an explicit "unknown" or `null` option so the model is not forced to invent a value.
|
|
30
|
+
|
|
31
|
+
## 2. Timeouts, retries and failure
|
|
32
|
+
|
|
33
|
+
- Set a client timeout on every call. Streaming calls get a time-to-first-token timeout and an overall timeout.
|
|
34
|
+
- Check the SDK's own retry behaviour before adding yours. The official OpenAI and Anthropic SDKs already retry connection errors, 408, 409, 429 and 5xx (2 retries by default, configurable with `max_retries`). Wrapping your own retry loop around that multiplies the attempts; either tune the SDK setting or disable it and own the loop.
|
|
35
|
+
- Retry only transient failures: timeouts, connection errors, 408, 429, 5xx and provider "overloaded" errors. Use exponential backoff with jitter and honour a `retry-after` header if present. Cap the total at 2 to 3 attempts.
|
|
36
|
+
- Don't retry other 4xx errors (bad request, auth, permission, not found, request too large): fix the request instead.
|
|
37
|
+
- Put a per-user and global concurrency limit in front of the API so a traffic spike cannot burn the rate limit for everyone.
|
|
38
|
+
- If an action has side effects (sending an email, calling a tool that writes), make the retry idempotent or don't retry the step that has the side effect.
|
|
39
|
+
|
|
40
|
+
## 3. Streaming
|
|
41
|
+
|
|
42
|
+
- Stream when a human is waiting on long free text. Don't stream when the output must be validated as a whole before use (structured output feeding code).
|
|
43
|
+
- Forward chunks to the client as they arrive (SSE or WebSocket), and handle the stream ending early: show partial text as incomplete, never as final.
|
|
44
|
+
- Read the final usage and stop reason from the end of the stream and log them. A stop because of the max-token limit means the answer is truncated; treat it as a failure for structured output.
|
|
45
|
+
- Cancel the upstream request when the client disconnects so you stop paying for tokens nobody reads.
|
|
46
|
+
|
|
47
|
+
## 4. Cost and latency
|
|
48
|
+
|
|
49
|
+
1. Measure first: log input tokens, output tokens, cached tokens and latency per call (section 6). Optimise the call that costs the most, not the one you suspect.
|
|
50
|
+
2. **Prompt caching:** put stable content first (system prompt, tool definitions, long reference documents, few-shot examples) and variable content (the user's turn) last. Some providers cache matching prefixes automatically; others need an explicit cache marker on the stable block. Check the provider's docs for the minimum cacheable length and cache lifetime, and confirm hits in the usage fields.
|
|
51
|
+
3. Don't put timestamps, request IDs or per-user data at the top of the prompt: they break the cached prefix.
|
|
52
|
+
4. Set `max_tokens` (or the provider's equivalent) to what the feature needs, not the model maximum.
|
|
53
|
+
5. Trim context: send only the fields the task needs, summarise long histories, and cap retrieved documents.
|
|
54
|
+
6. Cache whole responses in your own store only for deterministic, non-personal requests, keyed on model + prompt version + normalised input.
|
|
55
|
+
7. Use batch APIs for offline jobs that can wait.
|
|
56
|
+
|
|
57
|
+
## 5. Model selection
|
|
58
|
+
|
|
59
|
+
- Start with the most capable model to prove the feature works and to build the eval set, then try a smaller, cheaper or faster tier and keep it only if it passes the same evals.
|
|
60
|
+
- Route by task: a small model for classification, extraction and routing; a larger one for multi-step reasoning or long writing.
|
|
61
|
+
- Pin an exact model version in config, not a floating alias, so behaviour doesn't change under you. Upgrading the model is a change that must re-run the evals.
|
|
62
|
+
- Keep the model name, temperature and max tokens in config next to the prompt version, not scattered through code.
|
|
63
|
+
|
|
64
|
+
## 6. Prompt injection and untrusted content
|
|
65
|
+
|
|
66
|
+
Anything the model reads that you did not write is untrusted: user messages, uploaded files, web pages, emails, retrieved documents and tool results.
|
|
67
|
+
|
|
68
|
+
1. Keep instructions in the system prompt. Put untrusted content in clearly delimited blocks (for example XML-style tags) and say in the instructions that text inside them is data, not instructions.
|
|
69
|
+
2. **Assume injection will sometimes succeed** and limit the damage: give the model only the tools the task needs, scope credentials to the current user, and enforce authorisation in your code, never by asking the model to check.
|
|
70
|
+
3. Require human confirmation before irreversible or external actions the model proposes (payments, sending messages, deleting data).
|
|
71
|
+
4. Never render model output as raw HTML or Markdown that can load remote images or links without sanitising; that is a data-exfiltration path.
|
|
72
|
+
5. Don't put secrets in prompts. Assume the system prompt can be extracted.
|
|
73
|
+
6. Add injection attempts to the eval set (`llm-evals`) so a prompt change cannot quietly remove a defence.
|
|
74
|
+
|
|
75
|
+
## 7. Logging for evaluation
|
|
76
|
+
|
|
77
|
+
Log one record per model call, with the project's normal logger or tracing system:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
{ request_id, feature, prompt_version, model, params, input_tokens, output_tokens,
|
|
81
|
+
cached_tokens, latency_ms, stop_reason, validation_ok, retry_count, error, user_feedback }
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- Log full prompts and outputs only where the project's privacy rules allow it. Redact or hash personal data and secrets before storage, and set a retention period. If unsure, **stop and ask the user**.
|
|
85
|
+
- Version prompts like code (a constant or file with a version string) and log the version, so a regression can be traced to a change.
|
|
86
|
+
- Capture explicit user feedback (thumbs, edits, retries) against the `request_id`. Those records become eval cases.
|
|
87
|
+
|
|
88
|
+
## Never
|
|
89
|
+
|
|
90
|
+
- Never trust model output as authorisation, as a safe identifier, or as already validated.
|
|
91
|
+
- Never send API keys to a browser or mobile client; call the model from your server.
|
|
92
|
+
- Never retry without a cap, or loop on tool calls without a maximum step count.
|
|
93
|
+
- Never ship a prompt or model change without re-running the evals.
|
|
94
|
+
|
|
95
|
+
## Report back
|
|
96
|
+
|
|
97
|
+
End with: the files changed, the schema and fallback chosen, timeout and retry settings, how caching is arranged, what is logged, and any risk left open (for example "no eval set yet").
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"should_trigger": [
|
|
3
|
+
"Our summarize endpoint calls the model and sometimes returns broken JSON, make it return a validated object every time",
|
|
4
|
+
"Add retries with backoff and a timeout around the OpenAI call in our ticket classifier",
|
|
5
|
+
"The chat feature is too expensive, help me restructure the prompt so prompt caching actually hits",
|
|
6
|
+
"Stream the assistant's reply to the browser over SSE and cancel the request if the user closes the tab",
|
|
7
|
+
"Users can upload PDFs that get sent to the LLM, how do we stop instructions inside those files from hijacking it?"
|
|
8
|
+
],
|
|
9
|
+
"should_not_trigger": [
|
|
10
|
+
"Rewrite this system prompt so the model stops ignoring the tone guidelines",
|
|
11
|
+
"Build a test set of 50 cases and a grader to score our extraction feature",
|
|
12
|
+
"Chunk our docs and set up vector search for the support bot",
|
|
13
|
+
"Write an MCP server that exposes our inventory database as tools",
|
|
14
|
+
"Fine-tune a PyTorch model on our labelled images",
|
|
15
|
+
"Design the planner and executor loop and tool permissions for our coding agent harness"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: llm-evals
|
|
3
|
+
description: Builds and runs evaluation suites that measure whether an LLM feature is good enough to ship, from assembling a versioned case set and choosing graders (exact match, code checks, rubrics, a judge model) to tracking scores across prompt and model changes, keeping test cases out of prompts and training data, and deciding when people must review outputs. Use when a team needs a pass/fail bar for an AI feature, wants to catch regressions before a prompt or model upgrade, or doubts whether its LLM-as-judge scores can be trusted.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Any Agent Skills host. Needs the project's language runtime to run the eval harness; graders using a judge model need model API access.
|
|
6
|
+
metadata:
|
|
7
|
+
kete-loom/version: "0.1.0"
|
|
8
|
+
kete-loom/category: ai
|
|
9
|
+
kete-loom/risk: runs-commands
|
|
10
|
+
kete-loom/owner: "Kete-org"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# LLM evals
|
|
14
|
+
|
|
15
|
+
An eval is a test suite for behaviour that isn't deterministic. It turns "seems better" into a number you can compare across prompt versions and models. This skill builds the suite. To grade one agent's existing outputs and report failure patterns, delegate to the `agent-evaluator` agent. To rewrite the prompt itself, use `prompt-engineering`.
|
|
16
|
+
|
|
17
|
+
## 0. Define what you measure
|
|
18
|
+
|
|
19
|
+
1. State the feature's job in one sentence and list 2 to 5 **criteria** that decide a good output (for example: correct label, cites a source, under 120 words, refuses out-of-scope requests).
|
|
20
|
+
2. For each criterion, decide if it can be checked by code. Prefer code. Use a model grader only where code can't decide.
|
|
21
|
+
3. Agree a ship bar with the user (for example "≥ 95% on correctness, 0 safety failures"). If the user can't give one, **stop and ask**; a suite with no bar can't block a release.
|
|
22
|
+
4. Search the codebase for an existing eval harness, test runner or dataset folder before creating a new one.
|
|
23
|
+
|
|
24
|
+
## 1. Build the case set
|
|
25
|
+
|
|
26
|
+
- **Sources, in order of value:** real production inputs (from logs, redacted), reported bugs and user complaints, hand-written edge cases, synthetic cases generated by a model and then reviewed by a person.
|
|
27
|
+
- **Coverage:** typical inputs, hard inputs, edge cases (empty, very long, wrong language, ambiguous), adversarial inputs (prompt injection, requests the feature must refuse), and one case per past bug.
|
|
28
|
+
- **Size:** 20 to 50 good cases beat 1,000 unreviewed ones. Grow it as failures appear.
|
|
29
|
+
- Each case is a record with an id, the input, the expected output or the facts a good answer must contain, tags (category, difficulty, source), and the date added. Store it in the repo as JSONL or similar, under version control.
|
|
30
|
+
- Never put real personal data or secrets in the case set; redact first. If unsure whether data may be used, **stop and ask the user**.
|
|
31
|
+
|
|
32
|
+
## 2. Avoid leakage
|
|
33
|
+
|
|
34
|
+
- Split the set: a **dev** portion you look at while editing prompts, and a **held-out** portion you only run to report results. Never copy held-out inputs into prompts as few-shot examples.
|
|
35
|
+
- When you add a production failure, put it in dev first; move a fresh sample into held-out periodically.
|
|
36
|
+
- Don't evaluate a model on cases it may have trained on (public benchmarks, text copied from the web) and call it generalisation.
|
|
37
|
+
- When a model generates synthetic cases, don't use the same prompt you are evaluating to create them.
|
|
38
|
+
|
|
39
|
+
## 3. Choose graders
|
|
40
|
+
|
|
41
|
+
Use the cheapest grader that decides the criterion correctly.
|
|
42
|
+
|
|
43
|
+
| Grader | Use for | Notes |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| Exact / normalised match | labels, IDs, numbers, yes/no | Normalise case, whitespace and number format first |
|
|
46
|
+
| Code check | JSON validity, schema, length, required keywords, regex, citation present, tool called with right args | Deterministic, fast, run on every case |
|
|
47
|
+
| Reference similarity | short factual answers | Only as a hint; similar text can be wrong |
|
|
48
|
+
| Rubric, model-graded | tone, helpfulness, faithfulness to a source, reasoning quality | Needs calibration (section 4) |
|
|
49
|
+
| Pairwise, model-graded | "is B better than A?" between two prompt versions | Randomise order to cancel position bias |
|
|
50
|
+
| Human review | ship decisions on subjective quality, safety, legal or medical content, calibrating judges | Slow; sample, don't review everything |
|
|
51
|
+
|
|
52
|
+
Grader templates and a judge prompt are in `references/graders.md`. Read it before writing a model-graded rubric.
|
|
53
|
+
|
|
54
|
+
## 4. Make model graders trustworthy
|
|
55
|
+
|
|
56
|
+
1. Grade one criterion per judge call, with a short rubric that defines each score level in concrete terms. Prefer pass/fail or a 1 to 3 scale over 1 to 10.
|
|
57
|
+
2. Ask the judge for its reasoning first, then the verdict in a fixed field your code parses.
|
|
58
|
+
3. Use a capable model as judge, and preferably not the exact model and prompt under test.
|
|
59
|
+
4. **Calibrate:** have a person label 20 to 50 outputs, run the judge on them, and measure agreement. Fix the rubric until agreement is acceptable to the user; report the agreement rate alongside every judged score.
|
|
60
|
+
5. Re-calibrate when you change the judge model or rubric.
|
|
61
|
+
|
|
62
|
+
## 5. Run and track
|
|
63
|
+
|
|
64
|
+
1. Run every case with the exact production config: model version, prompt version, temperature, tools.
|
|
65
|
+
2. Outputs vary between runs. Run each case several times (3 or more when results are close) and report the pass rate per case, not just the mean.
|
|
66
|
+
3. Store each run as a record: date, git commit, prompt version, model, per-case results, aggregate scores, cost and latency.
|
|
67
|
+
4. Compare against the last accepted run **case by case**. A higher average that breaks previously passing cases is a regression to report, not a win.
|
|
68
|
+
5. Wire the fast, code-graded portion into CI so prompt or model changes can't merge when it drops below the bar. Run expensive judge-graded suites on demand or nightly.
|
|
69
|
+
|
|
70
|
+
## 6. When to involve people
|
|
71
|
+
|
|
72
|
+
Bring in human review when:
|
|
73
|
+
- Setting or changing the ship bar.
|
|
74
|
+
- Calibrating a judge model (section 4).
|
|
75
|
+
- The domain is high-stakes (health, finance, legal, safety) or the output reaches users unreviewed.
|
|
76
|
+
- Judge scores and user feedback disagree.
|
|
77
|
+
- Labelling new production failures before they join the case set.
|
|
78
|
+
|
|
79
|
+
Give reviewers the rubric, blind them to which version produced the output, and record their labels in the case set.
|
|
80
|
+
|
|
81
|
+
## Never
|
|
82
|
+
|
|
83
|
+
- Never report a score without the case count, run count and grader type.
|
|
84
|
+
- Never tune a prompt on the held-out set.
|
|
85
|
+
- Never treat a judge model's score as ground truth before checking it against human labels.
|
|
86
|
+
- Never delete a failing case to raise the score. Fix the feature or mark the case as wrong, with a reason, after the user agrees.
|
|
87
|
+
|
|
88
|
+
## Report back
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Feature: <name> Prompt: <version> Model: <exact id>
|
|
92
|
+
Cases: <n dev> dev / <n held-out> held-out Runs per case: <k>
|
|
93
|
+
Criterion Grader Score Bar Δ vs last
|
|
94
|
+
<correctness> exact 47/50 ≥ 45 +2
|
|
95
|
+
<faithfulness> judge (κ=..) 44/50 ≥ 45 -1 ← regression
|
|
96
|
+
Newly failing: <case ids> Newly passing: <case ids>
|
|
97
|
+
Verdict: ship | don't ship, because <one line>
|
|
98
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"should_trigger": [
|
|
3
|
+
"We want to swap to a cheaper model, set up evals so we know if quality drops",
|
|
4
|
+
"Build a test set and graders for our support-ticket classifier",
|
|
5
|
+
"How do I check that my LLM-as-judge scores actually agree with humans?",
|
|
6
|
+
"Add an eval step to CI that fails the build if the summariser's accuracy regresses",
|
|
7
|
+
"Our eval cases keep ending up in the few-shot examples, how do we keep the held-out set clean?"
|
|
8
|
+
],
|
|
9
|
+
"should_not_trigger": [
|
|
10
|
+
"Make the extraction prompt handle missing dates better",
|
|
11
|
+
"Score these 40 agent transcripts against our rubric and tell me where it fails",
|
|
12
|
+
"Add a timeout and JSON schema validation to our model call",
|
|
13
|
+
"Benchmark the p99 latency of the search API under load",
|
|
14
|
+
"Increase unit test coverage for the billing module to 80 percent"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Grader templates
|
|
2
|
+
|
|
3
|
+
Read this when writing graders for an LLM eval suite. Adapt names to the project's language; the shapes matter, not the syntax.
|
|
4
|
+
|
|
5
|
+
## Case record (JSONL, one per line)
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{"id": "refund-017", "split": "dev", "input": {"message": "I was charged twice"}, "expected": {"label": "billing"}, "must_include": ["refund"], "tags": ["billing", "hard"], "source": "prod-log", "added": "2026-01-14"}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Code graders
|
|
12
|
+
|
|
13
|
+
Each grader takes `(case, output)` and returns `{ "pass": bool, "reason": str }`. Return a reason on failure so reports show why.
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
def grade_label(case, output):
|
|
17
|
+
got = (output.get("label") or "").strip().lower()
|
|
18
|
+
want = case["expected"]["label"]
|
|
19
|
+
return {"pass": got == want, "reason": f"got {got!r}, want {want!r}"}
|
|
20
|
+
|
|
21
|
+
from jsonschema import Draft202012Validator # pip package "jsonschema"
|
|
22
|
+
|
|
23
|
+
def grade_schema(case, output, schema):
|
|
24
|
+
errors = list(Draft202012Validator(schema).iter_errors(output))
|
|
25
|
+
return {"pass": not errors, "reason": "; ".join(e.message for e in errors[:3])}
|
|
26
|
+
|
|
27
|
+
def grade_must_include(case, output):
|
|
28
|
+
text = output["text"].lower()
|
|
29
|
+
missing = [w for w in case.get("must_include", []) if w.lower() not in text]
|
|
30
|
+
return {"pass": not missing, "reason": f"missing {missing}"}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Other useful code checks: word or token count within a range, no forbidden phrases, every cited ID exists in the retrieved documents, the expected tool was called with the expected arguments, the agent finished within N steps.
|
|
34
|
+
|
|
35
|
+
## Judge prompt (one criterion, pass/fail)
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
You are grading one output from an AI feature against one criterion.
|
|
39
|
+
|
|
40
|
+
<criterion>
|
|
41
|
+
Faithfulness: every factual claim in the answer is supported by the source.
|
|
42
|
+
PASS: all claims are supported, or the answer says the source doesn't cover it.
|
|
43
|
+
FAIL: any claim is missing from or contradicts the source.
|
|
44
|
+
</criterion>
|
|
45
|
+
|
|
46
|
+
<source>{source}</source>
|
|
47
|
+
<question>{input}</question>
|
|
48
|
+
<answer>{output}</answer>
|
|
49
|
+
|
|
50
|
+
First list each factual claim in the answer and whether the source supports it.
|
|
51
|
+
Then give your verdict on the last line exactly as: VERDICT: PASS or VERDICT: FAIL
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Parse only the last `VERDICT:` line. Treat a missing or malformed verdict as a grader error, not a pass.
|
|
55
|
+
|
|
56
|
+
## Pairwise judge
|
|
57
|
+
|
|
58
|
+
Show outputs A and B for the same input with the criterion, ask which is better or "tie". Run each pair twice with A and B swapped; count a win only when both orders agree, otherwise a tie.
|
|
59
|
+
|
|
60
|
+
## Measuring judge agreement
|
|
61
|
+
|
|
62
|
+
With human labels for the same outputs:
|
|
63
|
+
|
|
64
|
+
- Agreement rate = cases where judge and human agree / cases labelled.
|
|
65
|
+
- For pass/fail labels, also report Cohen's kappa, which corrects for agreement by chance: κ = (p_o − p_e) / (1 − p_e), where p_o is observed agreement and p_e is the agreement expected from each rater's pass rate.
|
|
66
|
+
- Look at the disagreements, not just the number. They usually point to a vague rubric line.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: logistics-exception-management
|
|
3
|
+
description: Shipment exception handling for parcels and freight that are late, damaged, lost, refused or stuck on a bad address, covering triage by exception type, evidence capture, carrier claim deadlines, customer messages, SLA clocks and a root-cause log that shows which lane, carrier or packaging keeps failing. Use when a delivery has gone wrong and someone must decide what to do, when building an exceptions queue or claims tracker, or when setting up rules and templates for delay, damage and loss cases.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Any Agent Skills host. Works from carrier tracking exports, a ticket or order system, or a spreadsheet tracker; carrier API calls need network access.
|
|
6
|
+
metadata:
|
|
7
|
+
kete-loom/version: "0.1.0"
|
|
8
|
+
kete-loom/category: business
|
|
9
|
+
kete-loom/risk: writes-files
|
|
10
|
+
kete-loom/owner: "Kete-org"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Logistics exception management
|
|
14
|
+
|
|
15
|
+
Turn every failed delivery into one tracked case with an owner, a deadline and a cause. Resolve the customer first, recover money from the carrier second, and fix the pattern third.
|
|
16
|
+
|
|
17
|
+
## 0. Before you act
|
|
18
|
+
|
|
19
|
+
1. Identify the shipment: order ID, tracking or waybill number, carrier and service, origin and destination, ship date, declared value, and the Incoterm or shipping terms if B2B.
|
|
20
|
+
2. Get the latest carrier scan events and the promised delivery date.
|
|
21
|
+
3. Find the policy that applies: your customer SLA (reship or refund rules), the carrier's contract or tariff, and any insurance.
|
|
22
|
+
|
|
23
|
+
If you cannot tell who bears the risk in transit (seller, buyer or carrier), **stop and ask the user**. That decides who files the claim.
|
|
24
|
+
|
|
25
|
+
## 1. Triage by exception type
|
|
26
|
+
|
|
27
|
+
| Type | Signals | First action |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| Delay | No scan for 2+ business days, missed promised date, weather or customs hold | Open a trace with the carrier; tell the customer with a new ETA |
|
|
30
|
+
| Address issue | "Address incomplete", "Recipient moved", return-to-sender pending | Contact the customer to confirm the address; request an address correction from the carrier before it returns |
|
|
31
|
+
| Damage | Customer photos, "damaged" scan, refused delivery | Collect evidence (below); decide reship or refund; keep the goods and packaging |
|
|
32
|
+
| Loss | Tracking stops, carrier confirms not found, or "delivered" but customer says not received | Open a trace; for "delivered not received" check GPS/photo proof of delivery and neighbours before claiming |
|
|
33
|
+
| Customs hold | "Clearance delay", duties unpaid, documents requested | Send the missing document or payment; route classification questions to the customs-trade-compliance skill |
|
|
34
|
+
| Refused / undeliverable | Recipient refused, unpaid COD or duties | Decide: return, abandon or re-deliver, by goods value vs return cost |
|
|
35
|
+
|
|
36
|
+
Set a severity: **P1** high value, perishable, medical or a key account; **P2** standard order past SLA; **P3** informational (delay inside SLA).
|
|
37
|
+
|
|
38
|
+
## 2. Evidence for damage and loss
|
|
39
|
+
|
|
40
|
+
Collect within the carrier's window, before anything is thrown away:
|
|
41
|
+
|
|
42
|
+
- Photos of the outer box (all sides, labels), inner packaging, and the damaged item with the serial or SKU visible.
|
|
43
|
+
- Weight at dispatch vs weight at delivery if available.
|
|
44
|
+
- Commercial invoice or proof of value, packing list, and proof of delivery (signature, notes, photo).
|
|
45
|
+
- For freight: the delivery receipt or bill of lading with exceptions written on it. A clean signature with no noted damage makes a claim much harder. Train receivers to write the specific damage (for example "3 cartons crushed, 1 wet") before signing; a generic "subject to inspection" note often does not protect the claim.
|
|
46
|
+
|
|
47
|
+
## 3. Carrier claims
|
|
48
|
+
|
|
49
|
+
1. Check the carrier's own terms for filing windows and liability limits. They vary by carrier, service and contract; read the current tariff instead of assuming.
|
|
50
|
+
2. Reference points that are set by law, not the carrier:
|
|
51
|
+
- US interstate motor freight (Carmack Amendment, 49 U.S.C. 14706): carriers may not set a claim filing period shorter than 9 months (standard bill of lading terms count it from delivery, or from when a reasonable time for delivery has passed), nor less than 2 years to sue after a claim is declined.
|
|
52
|
+
- International air cargo (Montreal Convention, Article 31): written complaint within 14 days of receipt for damage and within 21 days of being placed at disposal for delay. Any court action must start within 2 years (Article 35), which is the outer limit for a lost shipment.
|
|
53
|
+
3. Claim the provable value (invoice cost, or as the contract says) up to the liability limit; declared value or cargo insurance governs anything above it.
|
|
54
|
+
4. Record claim number, amount, date filed, deadline and status. Chase at fixed intervals.
|
|
55
|
+
|
|
56
|
+
Never miss a filing window to wait for a perfect evidence pack; file on time and add documents later if the carrier allows it.
|
|
57
|
+
|
|
58
|
+
## 4. Customer communication
|
|
59
|
+
|
|
60
|
+
- First message within your SLA (for example same business day for P1). Say what happened, what you are doing, and when they will next hear from you.
|
|
61
|
+
- Offer the resolution your policy allows: reship now, refund, or wait for trace. Do not make the customer wait for the carrier claim to finish.
|
|
62
|
+
- Never blame the carrier in a way that implies the customer must chase them; the seller owns the relationship.
|
|
63
|
+
- Use templates per exception type; keep the tracking link and case ID in every message.
|
|
64
|
+
|
|
65
|
+
## 5. SLA clocks
|
|
66
|
+
|
|
67
|
+
Track per case: opened at, first customer response at, carrier trace opened at, resolution offered at, claim filed at, closed at. Report breaches by type and carrier.
|
|
68
|
+
|
|
69
|
+
## 6. Root-cause log
|
|
70
|
+
|
|
71
|
+
Every closed case gets one primary cause from a fixed list: carrier handling, packaging, address data, warehouse pick/pack, customs documentation, weather/force majeure, customer unavailable, fraud suspected, unknown. Review weekly:
|
|
72
|
+
|
|
73
|
+
- Exception rate by carrier, service, lane and packaging type.
|
|
74
|
+
- Repeated "delivered not received" by address or customer, which may be fraud; send to a person, do not auto-block.
|
|
75
|
+
- Address errors traced to checkout validation.
|
|
76
|
+
|
|
77
|
+
## Rules
|
|
78
|
+
|
|
79
|
+
- Never promise a refund or reship outside written policy without the user's approval.
|
|
80
|
+
- Never discard damaged goods or packaging before the carrier says the claim does not need an inspection.
|
|
81
|
+
- Never file a claim or contact a carrier on the user's behalf without confirmation.
|
|
82
|
+
- Do not state a carrier's deadline or liability limit you have not read in its current terms.
|
|
83
|
+
|
|
84
|
+
## Case record and report
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
case_id | order_id | tracking | carrier/service | type | severity | opened | sla_due | customer_action | claim_no | claim_deadline | claim_amount | status | root_cause
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Summary for a review: open cases by type and age, SLA breaches, claims filed vs recovered, and the top three root causes with a proposed fix each.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"should_trigger": [
|
|
3
|
+
"Tracking has not updated in five days and the customer is angry, what should we do and say?",
|
|
4
|
+
"Help me put together a damage claim for a pallet that arrived crushed via our LTL carrier",
|
|
5
|
+
"Design a shipment exceptions queue with severities, SLA timers and root-cause codes",
|
|
6
|
+
"The carrier marked the parcel delivered but the customer says it never arrived, how do we handle it?",
|
|
7
|
+
"Write customer email templates for delayed, lost and wrong-address deliveries"
|
|
8
|
+
],
|
|
9
|
+
"should_not_trigger": [
|
|
10
|
+
"Customers want to send items back, design our returns portal and RMA numbering",
|
|
11
|
+
"Calculate the reorder point for SKU 1043 given a four week lead time",
|
|
12
|
+
"Which Incoterm should we quote to a buyer in Germany so they handle import duties?",
|
|
13
|
+
"Plan the shift schedule for our packing line around the bottleneck machine",
|
|
14
|
+
"Write a postmortem for yesterday's checkout outage"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manim-animations
|
|
3
|
+
description: Manim Community Edition (the manim Python package, not 3b1b manimgl) for math and explainer animations, covering Scene construct methods, Mobjects and VGroups, play with the .animate syntax, Transform versus ReplacementTransform, ValueTracker updaters and always_redraw, MathTex and Tex with a LaTeX install, and render quality flags from -ql drafts to -qk 4K. Use when writing or debugging a Manim scene, animating equations, graphs or geometry in Python, or fixing Manim LaTeX, updater or render-output problems.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Any Agent Skills host. Needs Python 3 with the manim package; MathTex and Tex also need a LaTeX distribution with dvisvgm.
|
|
6
|
+
metadata:
|
|
7
|
+
kete-loom/version: "0.1.0"
|
|
8
|
+
kete-loom/category: coding
|
|
9
|
+
kete-loom/risk: runs-commands
|
|
10
|
+
kete-loom/requires: "python3, manim"
|
|
11
|
+
kete-loom/owner: "Kete-org"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Manim animations
|
|
15
|
+
|
|
16
|
+
Manim Community (`pip install manim`, `from manim import *`) builds a video from Python: a `Scene` subclass whose `construct()` adds objects and plays animations. Iterate at low quality, check single frames, and only render high quality at the end.
|
|
17
|
+
|
|
18
|
+
## 0. Before you start
|
|
19
|
+
|
|
20
|
+
1. Confirm which Manim: `import manim` and `manim --version` mean Community Edition. Code with `from manimlib import *` or `manimgl` is 3Blue1Brown's version; its API differs (for example `ShowCreation` vs `Create`, `TexText` vs `Tex`). **Don't mix them**; ask the user which one if the repo doesn't say.
|
|
21
|
+
2. Run `manim checkhealth` once. If equations are planned, check `latex --version` and `dvisvgm --version`. Missing LaTeX is the most common setup failure.
|
|
22
|
+
3. Write the storyboard as a list of beats (what appears, what changes, how long) before code. Ask the user for the target length and resolution if unknown.
|
|
23
|
+
|
|
24
|
+
## 1. Scene structure
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from manim import *
|
|
28
|
+
|
|
29
|
+
class PythagorasProof(Scene):
|
|
30
|
+
def construct(self):
|
|
31
|
+
title = Text("a² + b² = c²").to_edge(UP)
|
|
32
|
+
tri = Polygon(ORIGIN, 3 * RIGHT, 3 * RIGHT + 2 * UP, color=BLUE)
|
|
33
|
+
self.play(Write(title))
|
|
34
|
+
self.play(Create(tri), run_time=2)
|
|
35
|
+
self.wait()
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- One scene class per beat or section; render sections separately and join them later. Long single scenes are slow to iterate on.
|
|
39
|
+
- Use `MovingCameraScene` to pan or zoom (`self.camera.frame.animate.scale(0.5)`), `ThreeDScene` for 3D (`self.set_camera_orientation(phi=..., theta=...)`).
|
|
40
|
+
- Group with `VGroup(a, b, c)` and lay out with `.arrange(DOWN, buff=0.4)`, `.next_to(obj, RIGHT)`, `.to_edge(UP)`, `.move_to(ORIGIN)`. The frame is about 14.2 by 8 units; keep content inside it.
|
|
41
|
+
|
|
42
|
+
## 2. Animations
|
|
43
|
+
|
|
44
|
+
- `self.play(Create(x))`, `Write(text)`, `FadeIn(x, shift=UP)`, `FadeOut(x)`, `GrowFromCenter(x)`, `Indicate(x)`, `Circumscribe(x)`.
|
|
45
|
+
- `.animate`: `self.play(square.animate.shift(RIGHT).set_color(RED))` animates the start-to-end difference of the chained calls. It interpolates positions, not paths, so a rotation by `.animate.rotate(PI)` can look like a squash; use `Rotate(square, angle=PI)` instead.
|
|
46
|
+
- Run several animations together by passing them to one `self.play(...)`; stagger with `LaggedStart(*anims, lag_ratio=0.2)` or `AnimationGroup`.
|
|
47
|
+
- Control timing with `run_time=` and `rate_func=` (`smooth` is the default, also `linear`, `there_and_back`, `rush_into`).
|
|
48
|
+
|
|
49
|
+
### Transform pitfalls
|
|
50
|
+
|
|
51
|
+
- `Transform(a, b)` morphs `a` into `b`'s shape but **`a` stays on screen as the object**; `b` is never added. Later code that animates `b` does nothing visible.
|
|
52
|
+
- `ReplacementTransform(a, b)` removes `a` and adds `b`; use it when the code later refers to `b`.
|
|
53
|
+
- `TransformMatchingTex(eq1, eq2)` (or `TransformMatchingShapes`) for equation steps where terms move to new places.
|
|
54
|
+
|
|
55
|
+
## 3. Updaters and changing values
|
|
56
|
+
|
|
57
|
+
- A `ValueTracker` holds a number you animate: `t = ValueTracker(0)`, `self.play(t.animate.set_value(5), run_time=3)`.
|
|
58
|
+
- Rebuild an object every frame from the tracker: `dot = always_redraw(lambda: Dot(axes.c2p(t.get_value(), f(t.get_value()))))`.
|
|
59
|
+
- Or attach an updater: `label.add_updater(lambda m: m.next_to(dot, UP))`. Use the `(m, dt)` signature for motion based on elapsed time.
|
|
60
|
+
- Remove updaters (`clear_updaters()`) when done, or they keep running in later animations and slow rendering.
|
|
61
|
+
- Updaters only run while the scene is playing or waiting; a `self.wait()` keeps them going.
|
|
62
|
+
|
|
63
|
+
## 4. Text and LaTeX
|
|
64
|
+
|
|
65
|
+
- `Text("...")` uses Pango, no LaTeX needed, supports non-Latin scripts and `font=`.
|
|
66
|
+
- `MathTex(r"\int_0^1 x^2\,dx")` is math mode; `Tex(r"Area is $\pi r^2$")` is text mode. Always use raw strings (`r"..."`), or backslashes break.
|
|
67
|
+
- Split an equation into parts to colour or transform them: `MathTex("a^2", "+", "b^2", "=", "c^2")`, then `eq[0].set_color(BLUE)` or `eq.set_color_by_tex("c^2", RED)`.
|
|
68
|
+
- Extra packages: a `TexTemplate` with `add_to_preamble(r"\usepackage{...}")`, passed as `tex_template=`.
|
|
69
|
+
- A LaTeX error prints the `.tex` file path under `media/Tex/`; read its `.log` for the real error.
|
|
70
|
+
|
|
71
|
+
## 5. Graphs and geometry
|
|
72
|
+
|
|
73
|
+
- `axes = Axes(x_range=[-3, 3, 1], y_range=[-1, 9, 1], axis_config={"include_numbers": True})`, `graph = axes.plot(lambda x: x**2, color=YELLOW)`, `axes.get_area(graph, x_range=[0, 2])`, `axes.c2p(x, y)` to convert coordinates.
|
|
74
|
+
- `NumberPlane()` for grids, `ParametricFunction` for curves, `Arrow`, `Brace(obj, DOWN)` with `.get_text("...")`.
|
|
75
|
+
|
|
76
|
+
## 6. Rendering
|
|
77
|
+
|
|
78
|
+
`manim [flags] file.py SceneName` (same as `manim render ...`).
|
|
79
|
+
|
|
80
|
+
| Flag | Output |
|
|
81
|
+
|---|---|
|
|
82
|
+
| `-ql` | 854x480, 15 fps: drafts |
|
|
83
|
+
| `-qm` | 1280x720, 30 fps |
|
|
84
|
+
| `-qh` | 1920x1080, 60 fps |
|
|
85
|
+
| `-qp` | 2560x1440, 60 fps |
|
|
86
|
+
| `-qk` | 3840x2160, 60 fps |
|
|
87
|
+
|
|
88
|
+
- `-p` opens the result; `-s` saves only the last frame as PNG (fast layout check); `-n 3,5` renders only a range of `play`/`wait` calls by index; `-a` renders all scenes in the file; `--format=png|gif|mp4|webm|mov` (`png` writes an image sequence); `-t` for a transparent background (`.mov`).
|
|
89
|
+
- Output goes to `media/videos/<file>/<resolution><fps>/SceneName.mp4`, for example `media/videos/proof/480p15/`.
|
|
90
|
+
- Partial-movie caching makes re-renders fast; if output looks stale after changing something outside `construct` (a template, an asset), add `--disable_caching` or delete the `media/` folder.
|
|
91
|
+
- Set defaults per project in `manim.cfg` (`[CLI]` section, for example `quality = low_quality`, `background_color = WHITE`).
|
|
92
|
+
|
|
93
|
+
## Never
|
|
94
|
+
|
|
95
|
+
- Never render the whole video at `-qh` or `-qk` while still changing it; draft at `-ql` and check frames with `-s`.
|
|
96
|
+
- Never mix ManimGL and Manim Community imports or examples from the other's docs.
|
|
97
|
+
- Never leave updaters attached to objects that are later faded out and re-added; they stack up.
|
|
98
|
+
|
|
99
|
+
## Stop and ask the user
|
|
100
|
+
|
|
101
|
+
- If LaTeX isn't installed and equations are needed: installing a TeX distribution is large; ask before doing it, and offer `Text` as a fallback for simple formulas.
|
|
102
|
+
- When the maths shown must be correct for teaching (proofs, statistics): show the user the formulas and steps for review before the final render.
|
|
103
|
+
|
|
104
|
+
## Report back
|
|
105
|
+
|
|
106
|
+
Scenes written, the exact render commands, output file paths and resolution, and a list of beats with their approximate durations.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"should_trigger": [
|
|
3
|
+
"Make a Manim scene that plots y = x^2 and shades the area from 0 to 2",
|
|
4
|
+
"My MathTex fails with LaTeX compilation error converting to dvi, what's wrong?",
|
|
5
|
+
"After Transform(a, b) in Manim, animating b does nothing on screen",
|
|
6
|
+
"Animate a dot moving along a sine curve with a ValueTracker and always_redraw",
|
|
7
|
+
"Render my Manim explainer at 1080p60 instead of the low quality draft"
|
|
8
|
+
],
|
|
9
|
+
"should_not_trigger": [
|
|
10
|
+
"Build an animated intro video in React with spring physics",
|
|
11
|
+
"Plot a matplotlib histogram of the survey results in a Jupyter notebook",
|
|
12
|
+
"Convert the rendered MP4 into an HLS stream for our website",
|
|
13
|
+
"Write a generative p5.js flow field sketch",
|
|
14
|
+
"Create a D3 chart that animates when the data changes"
|
|
15
|
+
]
|
|
16
|
+
}
|