Functions Development 标志

Functions Development

组织
CrowdStrike
functions-development

Build serverless Go or Python functions for Falcon Foundry apps. TRIGGER when user asks to "create a function", "write a serverless function", "build backend logic", runs `foundry functions create`, or needs help with FDK handler patterns, function testing, or collection integration from functions. Also TRIGGER when user asks to "execute a function", "run my function", "debug this function", "get function logs", "check execution status", "write function tests", "test my function handler", or "add test cases for my function". DO NOT TRIGGER for generic "write integration tests" or "write tests" without function context — ask which capability they want to test first. DO NOT TRIGGER for calling Falcon platform APIs from functions — use functions-falcon-api instead. DO NOT TRIGGER for workflow YAML or UI components. DO NOT TRIGGER for Playwright/e2e/browser tests — use e2e-testing instead.

概览

发布者CrowdStrike
代码仓库foundry-skills
技能名称functions-development
星标数
37
复刻数
7
附带文件
6
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载的 SKILL.md 文件,因此只有在请求确实匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 6 个随附文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 CrowdStrike 发布于 GitHub。请在安装前查看源内容。

安装

在 TypingMind 中安装 Functions Development AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/CrowdStrike/foundry-skills/tree/main/skills/functions-development
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/CrowdStrike/foundry-skills.git /tmp/foundry-skills
mkdir -p .claude/skills
cp -r /tmp/foundry-skills/skills/functions-development .claude/skills/functions-development
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Functions Development,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Functions Development。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Functions Development 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会获取指令,因此未使用的技能不会产生额外费用。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Foundry Functions Development

Loading this skill is NOT a command to do anything. It only equips you with function-development knowledge. Do NOT run any foundry functions command (especially exec, test, or a deploy) just because the skill loaded — wait for the user's actual request, and if their intent isn't clear yet, ask what they'd like to do. Never execute, test, or deploy a function unprompted.

When you implement or modify functions:

  1. Use CrowdStrike SDKs (gofalcon/falconpy) for ALL API interactions
  2. Implement structured JSON responses with proper status codes
  3. Apply input validation before processing any request

Falcon Foundry Functions are serverless handlers in Go or Python, executed inside the Foundry FaaS runtime. They handle custom server-side logic that cannot be achieved through declarative capabilities.

Functions as a Last Resort

Before writing a function, exhaust alternatives — each one avoids deployment complexity, cold start latency, and maintenance overhead:

  • Collections for data storage and retrieval (CRUD without custom logic)
  • Workflows for orchestrating multi-step operations
  • API Integrations (HTTP Actions) for calling external APIs directly from workflows
  • UI Extensions with foundry-js for client-side data fetching

Credential Management — No Secrets System Exists

There is no secrets management in Falcon Foundry. When calling third-party REST APIs:

ScenarioApproachCredentials
Third-party REST API (VirusTotal, Slack, Jira, etc.)API integration in manifest + APIIntegrations().execute_command_proxy()Platform-managed at install time
CrowdStrike Falcon APIFalconPy zero-arg constructor (Alerts(), Hosts())Platform-managed automatically
Third-party GraphQL API (no OpenAPI spec)Function with requests + env varVisible in app exports (⚠️ security risk)

CRITICAL: If the API has a REST endpoint and an OpenAPI spec exists, you MUST use an API integration. NEVER use os.environ with API keys, requests.get() with hardcoded URLs, or localStorage for credentials when an API integration can handle it. Raw HTTP with env vars technically works, but credentials are unencrypted and visible in app exports.

Reference Files

This skill is split across multiple files. Consult these for full examples:

TaskReference
Python handler, collection CRUD, error class, lookup file uploads, LogScale ingestionreferences/python-patterns.md
Go FDK handler, Falcon client auth, collection CRUD, alerts handlerreferences/go-patterns.md
Too many functions: build failures, consolidationreferences/function-count-and-build-time.md
Falcon console testing (Python editor), function logs (viewing logs in UI and Advanced Event Search), Go/Python tests, local testing, Docker vs direct, config file patternsreferences/testing-patterns.md

Resource Limits

ResourceDefaultMaximum
JSON payload (input + output combined)—1018 KB
Execution timeout15s900s
Memory256 MB1 GB
Package size (zipped, with dependencies)—50 MB
Concurrent executions—100

Runtime Environment

Python: develop on 3.14. The docs state only a minimum (3.9+) and the platform moves faster than them, so use the latest release. The runtime is manylinux_2_28 (glibc 2.28): pick requirements.txt versions with manylinux_2_17 or manylinux_2_28 wheels; wheels needing newer glibc (e.g., manylinux_2_39) may fail at import time. Run tests in a venv built like CI's, not the global interpreter — see testing-patterns.

CLI Scaffolding

bash
foundry functions create \
  --name "my-function" \
  --language python \
  --description "Process incoming data" \
  --handler-name process \
  --handler-method POST \
  --handler-path /api/process \
  --max-exec-duration-seconds 60 \
  --max-exec-memory-mb 256 \
  --no-prompt

The two --max-exec-* flags write the manifest's max_exec_duration_seconds / max_exec_memory_mb; set them at create time instead of hand-editing later.

Function Execution & Debugging

Requires Foundry CLI 2.1.0+. The commands below (foundry functions exec, test, logs) do not exist in CLI 2.0.x. If the user's CLI is below 2.1.0, inform them and offer to upgrade: brew upgrade crowdstrike/foundry-cli/foundry.

⚠️ DEPLOY FIRST — exec and test run against the deployed Lambda, not local code. Never deploy automatically; ask the user first.

For the full command reference, request-data confirmation workflow, tests.yml schema, and debugging steps, see references/execution-and-testing.md.

Key commands:

bash
foundry functions exec --handler <handler> '<json>' --no-prompt
foundry functions exec status <exec_id> --no-prompt
foundry functions logs <exec_id> --no-prompt
foundry functions test --no-prompt

Reviewing Function Code

Before recommending a deploy, review the handler for logging adequacy, sensitive data, and schema coverage. See references/code-review-checklist.md for the full checklist.

Function I/O Schemas — Required at Creation Time

⚠️ CRITICAL: Functions called from workflows MUST be created with --input-schema and --output-schema. Schemas bind only at creation time. A function created without an output schema produces no visible output in its Fusion action — the action completes, but downstream steps cannot reference any data from it.

Why This Matters

The platform registers a handler's schemas with the workflow engine when the function is created. Without a response schema:

  • The Fusion action shows zero output fields
  • Workflow references like ${data['my_function.output.field']} resolve to nothing
  • The workflow appears to run but produces empty results

Passing --wf-expose alone is not enough. It creates the workflow binding; the schema fields are still written as null.

Create the Function with Schemas

Write the two JSON Schema files first, then pass them to foundry functions create. The CLI copies them into the function directory and records them in the manifest:

bash
foundry functions create \
  --name "query-stats" \
  --language python \
  --description "Query execution statistics" \
  --handler-name query \
  --handler-method POST \
  --handler-path /api/query \
  --input-schema request_schema.json \
  --output-schema response_schema.json \
  --wf-expose \
  --no-prompt

The resulting manifest entry references the schemas by filename on the handler — not as inline JSON, and not under workflow_integration:

yaml
functions:
    - name: query-stats
      path: functions/query-stats
      handlers:
        - name: query
          method: POST
          api_path: /api/query
          request_schema: request_schema.json
          response_schema: response_schema.json
          workflow_integration:
            id: <generated>
            disruptive: false
            system_action: true
      language: python

Without --input-schema/--output-schema, both fields are written as null — including when --wf-expose is set. --wf-expose creates the workflow binding but does NOT generate schemas.

Fixing a Function Missing Schemas

Adding request_schema/response_schema to the manifest by hand and redeploying does NOT bind them. The binding happens only at creation time via the CLI flags. To fix a function that was created without them:

  1. Remove the function's entry from manifest.yml and delete its directory
  2. Recreate it with --input-schema/--output-schema as shown above
  3. Update any workflow YAML referencing it — the workflow_integration.id changes
  4. Redeploy

Warning: Step 3 matters. Recreating the function gives it a new workflow integration ID, so existing workflow YAML points at nothing. Edit the workflow YAML in place to reference the new ID — do NOT delete and recreate the workflows to force a refresh, which triggers 409 name must be unique for an app and can corrupt the app's dependency graph. See the workflows-development skill for details.

Language Comparison

FeatureGoPython
HTTP MethodsGET, POST, PUT, DELETEGET, POST, PUT, PATCH, DELETE
FDK Packagegithub.com/CrowdStrike/foundry-fn-gocrowdstrike-foundry-function
CrowdStrike SDKgofalconfalconpy
PATCH supportNoYes
UI Editor supportNoYes

Use Go for performance-critical workloads, concurrency, and type safety. Use Python for rapid development, PATCH support, and UI Editor development.

Manifest Structure

yaml
functions:
  - name: gather-evidence
    description: "Collect evidence from multiple sources"
    language: python
    path: "functions/gather-evidence"
    environment_variables:
      LOG_LEVEL: "info"
    max_exec_duration_seconds: 30
    max_exec_memory_mb: 256
    handlers:
      - name: process
        method: POST
        api_path: "/api/investigations/evidence"
      - name: healthcheck
        method: GET
        api_path: "/api/health"

Handler fields: name (5–64 chars, unique per function), method, api_path. One function can expose several endpoints; every function is a separate build, so keep the count low. The Python FDK matches api_path exactly (no {param} placeholders), so pass IDs in the body or query. Descriptions are length-checked only: 1024 characters per function, 512 per handler.

Adding a Handler to an Existing Function

No CLI command adds a handler to an existing function. Append an entry (name, method, api_path) to that function's handlers: list in manifest.yml and add the matching @func.handler(...) (or Go route). This is a narrow exception to the no-manifest-edits rule, like the ai.agents[].model carve-out: touch only that handlers: list. Hand-added handlers get no bound I/O schemas, so a handler that must be a Fusion action with visible outputs needs its own CLI-created function.

Go FDK Pattern

go
package main

import (
    "context"
    "log/slog"
    fdk "github.com/CrowdStrike/foundry-fn-go"
)

type greetingReq struct {
    Name string `json:"name"`
}

func newHandler(_ context.Context, _ *slog.Logger, _ fdk.SkipCfg) fdk.Handler {
    m := fdk.NewMux()
    m.Post("/greetings", fdk.HandleFnOf(func(ctx context.Context, r fdk.RequestOf[greetingReq]) fdk.Response {
        return fdk.Response{
            Code: 200,
            Body: fdk.JSON(map[string]string{"greeting": "Hello, " + r.Body.Name}),
        }
    }))
    return m
}

func main() {
    fdk.Run(context.Background(), newHandler)
}

Key FDK concepts: fdk.SkipCfg (no config file), fdk.NewMux() (router), fdk.HandleFnOf[T] (typed handler), fdk.RequestOf[T] (typed request with .Body, .Headers, .Queries, .Context, .URL, .Method, .AccessToken, .TraceID), fdk.JSON() (response body helper).

Go Authentication

Go requires explicit credential wiring through the FDK. Inside the handler, build the client from the request's token (r.AccessToken) and use fdk.FalconClientOpts() for correct cloud and user-agent configuration:

go
opts := fdk.FalconClientOpts()
falconClient, err := falcon.NewClient(&falcon.ApiConfig{
    AccessToken:       r.AccessToken,
    Cloud:             falcon.Cloud(opts.Cloud),
    Context:           ctx,
    UserAgentOverride: opts.UserAgent,
})

Python FDK Pattern

python
from logging import Logger
from typing import Any, Dict, Union
from crowdstrike.foundry.function import Function, Request, Response

func = Function.instance()

@func.handler(method='POST', path='/greetings')
def on_post(request: Request, config: Union[Dict[str, Any], None], logger: Logger) -> Response:
    name = request.body.get("name", "World")
    return Response(body={'greeting': f'Hello, {name}!'}, code=200)

@func.handler(method='GET', path='/health')
def on_get(request: Request, config: Union[Dict[str, Any], None], logger: Logger) -> Response:
    return Response(body={'status': 'ok'}, code=200)

if __name__ == '__main__':
    func.run()

The Request Object

No request.query, and request.params has no .get(): query params and headers are request.params.query / .header, both Dict[str, List[str]] (request.params.query.get("limit", ["50"])[0]). Field table: references/python-patterns.md.

Python Authentication

FalconPy handles credential discovery automatically. Call Service Class constructors with zero arguments:

python
from falconpy import Alerts
falcon = Alerts()  # Auth is automatic — do not pass credentials
  • In Foundry cloud: Uses context-based authentication (injected by the platform)
  • Locally: Reads FALCON_CLIENT_ID and FALCON_CLIENT_SECRET from environment variables

FalconPy already reads env vars internally, so writing a get_falcon_client() wrapper that manually reads credentials adds no value and breaks context auth in the cloud.

Construct FalconPy clients inside the handler, never at module scope. Context auth only has the request's bearer token while a request is being handled; a module-level falcon = Alerts() (or APIHarnessV2(), CustomStorage(), APIIntegrations()) is built at import with no token and returns 401 on every call despite correct scopes.

Calling Registered API Integrations from Functions

When your app has an API integration registered in manifest.yml, call it from functions using FalconPy's APIIntegrations class. Do NOT make raw HTTP calls (urllib/requests) to the third-party API — always go through the Foundry platform proxy:

python
from falconpy import APIIntegrations

api = APIIntegrations()  # Zero-arg auth, same as other FalconPy classes

# Call using definition_id + operation_id from your manifest
response = api.execute_command_proxy(
    body={
        "resources": [
            {
                "definition_id": "ZscalerAPI",      # matches manifest api_integrations name
                "operation_id": "urlLookup",        # matches OpenAPI spec operationId
            }
        ]
    },
)

For APIs that need a request body or query parameters:

python
response = api.execute_command_proxy(
    body={
        "resources": [
            {
                "definition_id": "Anomali API",
                "operation_id": "Intelligence",
                "request": {
                    "params": {
                        "query": {"type": "ip", "value": ip_address}
                    }
                },
            }
        ]
    },
)

Why the proxy? The platform manages OAuth tokens, rate limiting, and audit logging for registered integrations. Raw HTTP calls bypass all of this — while they can work with hardcoded or env-var credentials, those values are stored unencrypted and visible to anyone who exports the app.

Local testing note: When testing locally, you may need the UUID definition_id from manifest.yml (assigned by the platform). In production, the human-readable integration name (e.g., "ZscalerAPI") works as the definition_id value.

Reference implementations:

requirements.txt Best Practices

Pin all dependencies to exact versions (==) for reproducible builds and supply chain safety. The one exception is crowdstrike-falconpy, which should be left unpinned so functions always pick up the latest SDK (needed for context-based auth and new service classes). Ensure the file ends with a trailing newline.

crowdstrike-foundry-function==1.1.4
crowdstrike-falconpy

Local handler runs leave __pycache__/, which deploys unless ignored: has (^|/)__pycache__(/|$).

Workflow Array Output

When a function returns array data to a workflow, wrap the array in a JSON object. Direct array returns are not supported by the workflow engine:

python
# Correct — workflows can reference $step.output.items
return Response(body={'items': [{'id': 1}, {'id': 2}]}, code=200)

# Breaks workflow variable resolution
return Response(body=[{'id': 1}, {'id': 2}], code=200)

Error Handling

Return failures in errors as APIError(code, message), the shape the FDK and tests.yml expect.errors use (see the hello handler in foundry-sample-functions-python). MUST NOT leak raw stack traces:

python
from crowdstrike.foundry.function import APIError, Response

try:
    result = process(request.body)
    return Response(body={"data": result}, code=200)
except ValueError as e:
    return Response(code=400, errors=[APIError(code=400, message=str(e))])
except Exception:
    logger.exception("process failed")
    return Response(code=500, errors=[APIError(code=500, message="An unexpected error occurred")])

When a Falcon API call fails, return its status and errors[].message, not a generic message or a guessed cause. See references/code-review-checklist.md.

For a reusable FunctionError class, see references/python-patterns.md.

Common Pitfalls

  • Using requests instead of CrowdStrike SDKs. The SDKs handle auth, retries, regions, and error parsing.
  • Using APIHarnessV2 (Uber class) for collection operations. Use CustomStorage service class instead so the Foundry functions editor can auto-detect OAuth scopes. See the Collection CRUD Pattern in references/python-patterns.md.
  • Constructing FalconPy clients at module scope. falcon = Alerts() above the handler runs at import, before the FDK has a request token, so every call returns 401 Unauthorized. Construct clients inside the handler.
  • request.query or request.params.get(). Neither exists; use request.params.query["limit"][0] (values are lists).
  • Shared utility files across functions. sys.path.append("../") works locally but not in Foundry's FaaS runtime. Copy shared files into each function directory.
  • SearchObjects returns metadata, not objects. Follow up with GetObject to retrieve actual content. For bulk reads, use FQL filters to narrow the search rather than fetching all keys and reading them one by one in a loop.
  • Returning arrays directly to workflows. Wrap in a JSON object ({'items': [...]} not [...]).
  • Using PATCH with Go functions. Go only supports GET, POST, PUT, DELETE.
  • Making raw HTTP calls to third-party APIs. When an API integration is registered in the manifest, MUST use APIIntegrations().execute_command_proxy(). Raw urllib/requests calls can technically work with hardcoded credentials or env vars, but credentials are stored unencrypted and visible in app exports — a security risk. Always prefer the API integration path.

Use Cases

For real-world implementation patterns, see:

  • use-cases/python-functions.md — Python handler patterns, SDK usage, testing
  • use-cases/logscale-ingestion.md — Ingesting custom data into Falcon LogScale
  • use-cases/api-pagination.md — Pagination strategies in functions and workflows

Reference Implementations

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Functions Development AI 技能有什么作用?

Build serverless Go or Python functions for Falcon Foundry apps. TRIGGER when user asks to "create a function", "write a serverless function", "build backend logic", runs `foundry functions create`, or needs help with FDK handler patterns, function testing, or collection integration from functions. Also TRIGGER when user asks to "execute a function", "run my function", "debug this function", "get function logs", "check execution status", "write function tests", "test my function handler", or "add test cases for my function". DO NOT TRIGGER for generic "write integration tests" or "write tes...

为什么在 TypingMind 中使用 Functions Development?

因为您只需安装一次,就能搭配任何模型使用。Functions Development 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型,甚至可以在聊天中途切换模型,而不会影响技能正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Functions Development?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/CrowdStrike/foundry-skills/tree/main/skills/functions-development。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Functions Development?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Functions Development 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以搭配 Functions Development 使用,包括 GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等,都可在 TypingMind 中使用您自己的 API 密钥接入。

Functions Development AI 技能免费吗?

是的。该技能源自 CrowdStrike 在 GitHub 上以 MIT 许可证发布的项目。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇