{
  "schemaVersion": "1.0",
  "item": {
    "slug": "baml-codegen",
    "name": "baml-codegen",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/killerapp/baml-codegen",
    "canonicalUrl": "https://clawhub.ai/killerapp/baml-codegen",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/baml-codegen",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=baml-codegen",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "assets/agents/README.md",
      "assets/classification/README.md",
      "assets/extraction/README.md",
      "assets/integrations/README.md",
      "assets/rag/README.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T17:22:31.273Z",
      "expiresAt": "2026-05-14T17:22:31.273Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
        "contentDisposition": "attachment; filename=\"afrexai-annual-report-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/baml-codegen"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/baml-codegen",
    "agentPageUrl": "https://openagent3.xyz/skills/baml-codegen/agent",
    "manifestUrl": "https://openagent3.xyz/skills/baml-codegen/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/baml-codegen/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "BAML Code Generation",
        "body": "Generate type-safe LLM extraction code. Use when creating structured outputs, classification, RAG, or agent workflows."
      },
      {
        "title": "Golden Rules",
        "body": "NEVER edit baml_client/ - 100% generated, overwritten on every baml-cli generate; check baml_src/generators.baml for output_type (python, typescript, ruby, go)\nALWAYS edit baml_src/ - Source of truth for all BAML code\nRun baml-cli generate after changes - Regenerates typed client code for target language"
      },
      {
        "title": "Philosophy (TL;DR)",
        "body": "Schema Is The Prompt - Define data models first, compiler injects types\nTypes Over Strings - Use enums/classes/unions, not string parsing\nFuzzy Parsing Is BAML's Job - BAML extracts valid JSON from messy LLM output\nTranspiler Not Library - Write .baml → generate native code (Python/TypeScript/Ruby/Go), no runtime dependency\nTest-Driven Prompting - Use VS Code playground or baml-cli test to iterate"
      },
      {
        "title": "Workflow",
        "body": "Analyze → Pattern Match (MCP) → Validate → Generate → Test → Deliver\n         ↓ [IF ERRORS] Error Recovery (MCP) → Retry"
      },
      {
        "title": "BAML Syntax",
        "body": "ElementExampleClassclass Invoice { total float @description(\"Amount\") @assert(this > 0) @alias(\"amt\") }Enumenum Category { Tech @alias(\"technology\") @description(\"Tech sector\"), Finance, Other }Functionfunction Extract(text: string, img: image?) -> Invoice { client GPT5 prompt #\"{{ text }} {{ img }} {{ ctx.output_format }}\"# }Clientclient<llm> GPT5 { provider openai options { model gpt-5 } retry_policy Exponential }Fallbackclient<llm> Resilient { provider fallback options { strategy [FastModel, SlowModel] } }"
      },
      {
        "title": "Types",
        "body": "Primitives: string, int, float, bool | Multimodal: image, audio\nContainers: Type[] (array), Type? (optional), map<string, Type> (key-value)\nComposite: Type1 | Type2 (union), nested classes\nAnnotations: @description(\"...\"), @assert(condition), @alias(\"json_name\"), @check(name, condition)"
      },
      {
        "title": "Providers",
        "body": "openai, anthropic, gemini, vertex, bedrock, ollama + any OpenAI-compatible via openai-generic"
      },
      {
        "title": "Pattern Categories",
        "body": "PatternUse CaseModelFramework MarkersExtractionUnstructured → structuredGPT-5fastapi, next.jsClassificationCategorizationGPT-5-minianyRAGAnswers with citationsGPT-5langgraphAgentsMulti-step reasoningGPT-5langgraphVisionImage/audio data extractionGPT-5-Visionmultimodal"
      },
      {
        "title": "Resilience",
        "body": "retry_policy: retry_policy Exp { max_retries 3 strategy { type exponential_backoff } }\nfallback client: Chain models [FastCheap, SlowReliable] for cost/reliability tradeoff"
      },
      {
        "title": "MCP Indicators",
        "body": "Found patterns from baml-examples | Validated against BoundaryML/baml | Fixed errors using docs | MCP unavailable, using fallback"
      },
      {
        "title": "Output Artifacts",
        "body": "BAML Code - Complete .baml files (types, functions, clients, retry_policy)\nTests - pytest/Jest with 100% function coverage\nIntegration - Framework-specific client code (LangGraph nodes, FastAPI endpoints, Next.js API routes)\nMetadata - Pattern used, token count, cost estimate"
      },
      {
        "title": "References",
        "body": "providers.md - OpenAI, Anthropic, Google, Ollama, Azure, Bedrock, openai-generic\ntypes-and-schemas.md - Full type system, classes, enums, unions, map, image, audio\nvalidation.md - @assert, @check, @alias, block-level @@assert\npatterns.md - Pattern library with code examples\nphilosophy.md - BAML principles, golden rules\nmcp-interface.md - Query workflow, caching\nlanguages-python.md - Python/Pydantic, async\nlanguages-typescript.md - TypeScript, React/Next.js\nframeworks-langgraph.md - LangGraph integration"
      }
    ],
    "body": "BAML Code Generation\n\nGenerate type-safe LLM extraction code. Use when creating structured outputs, classification, RAG, or agent workflows.\n\nGolden Rules\nNEVER edit baml_client/ - 100% generated, overwritten on every baml-cli generate; check baml_src/generators.baml for output_type (python, typescript, ruby, go)\nALWAYS edit baml_src/ - Source of truth for all BAML code\nRun baml-cli generate after changes - Regenerates typed client code for target language\nPhilosophy (TL;DR)\nSchema Is The Prompt - Define data models first, compiler injects types\nTypes Over Strings - Use enums/classes/unions, not string parsing\nFuzzy Parsing Is BAML's Job - BAML extracts valid JSON from messy LLM output\nTranspiler Not Library - Write .baml → generate native code (Python/TypeScript/Ruby/Go), no runtime dependency\nTest-Driven Prompting - Use VS Code playground or baml-cli test to iterate\nWorkflow\nAnalyze → Pattern Match (MCP) → Validate → Generate → Test → Deliver\n         ↓ [IF ERRORS] Error Recovery (MCP) → Retry\n\nBAML Syntax\nElement\tExample\nClass\tclass Invoice { total float @description(\"Amount\") @assert(this > 0) @alias(\"amt\") }\nEnum\tenum Category { Tech @alias(\"technology\") @description(\"Tech sector\"), Finance, Other }\nFunction\tfunction Extract(text: string, img: image?) -> Invoice { client GPT5 prompt #\"{{ text }} {{ img }} {{ ctx.output_format }}\"# }\nClient\tclient<llm> GPT5 { provider openai options { model gpt-5 } retry_policy Exponential }\nFallback\tclient<llm> Resilient { provider fallback options { strategy [FastModel, SlowModel] } }\nTypes\nPrimitives: string, int, float, bool | Multimodal: image, audio\nContainers: Type[] (array), Type? (optional), map<string, Type> (key-value)\nComposite: Type1 | Type2 (union), nested classes\nAnnotations: @description(\"...\"), @assert(condition), @alias(\"json_name\"), @check(name, condition)\nProviders\n\nopenai, anthropic, gemini, vertex, bedrock, ollama + any OpenAI-compatible via openai-generic\n\nPattern Categories\nPattern\tUse Case\tModel\tFramework Markers\nExtraction\tUnstructured → structured\tGPT-5\tfastapi, next.js\nClassification\tCategorization\tGPT-5-mini\tany\nRAG\tAnswers with citations\tGPT-5\tlanggraph\nAgents\tMulti-step reasoning\tGPT-5\tlanggraph\nVision\tImage/audio data extraction\tGPT-5-Vision\tmultimodal\nResilience\nretry_policy: retry_policy Exp { max_retries 3 strategy { type exponential_backoff } }\nfallback client: Chain models [FastCheap, SlowReliable] for cost/reliability tradeoff\nMCP Indicators\nFound patterns from baml-examples | Validated against BoundaryML/baml | Fixed errors using docs | MCP unavailable, using fallback\nOutput Artifacts\nBAML Code - Complete .baml files (types, functions, clients, retry_policy)\nTests - pytest/Jest with 100% function coverage\nIntegration - Framework-specific client code (LangGraph nodes, FastAPI endpoints, Next.js API routes)\nMetadata - Pattern used, token count, cost estimate\nReferences\nproviders.md - OpenAI, Anthropic, Google, Ollama, Azure, Bedrock, openai-generic\ntypes-and-schemas.md - Full type system, classes, enums, unions, map, image, audio\nvalidation.md - @assert, @check, @alias, block-level @@assert\npatterns.md - Pattern library with code examples\nphilosophy.md - BAML principles, golden rules\nmcp-interface.md - Query workflow, caching\nlanguages-python.md - Python/Pydantic, async\nlanguages-typescript.md - TypeScript, React/Next.js\nframeworks-langgraph.md - LangGraph integration"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/killerapp/baml-codegen",
    "publisherUrl": "https://clawhub.ai/killerapp/baml-codegen",
    "owner": "killerapp",
    "version": "2.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/baml-codegen",
    "downloadUrl": "https://openagent3.xyz/downloads/baml-codegen",
    "agentUrl": "https://openagent3.xyz/skills/baml-codegen/agent",
    "manifestUrl": "https://openagent3.xyz/skills/baml-codegen/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/baml-codegen/agent.md"
  }
}