/crowdstrike-falcon-foundry:functions-developmentfrom crowdstrike-falcon-foundry
Builds serverless Go or Python functions for Falcon Foundry apps. Handles FDK handler patterns, function creation, execution, debugging, logs, and testing.
Ships in crowdstrike-falcon-foundry. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Loading this skill is NOT a command to do anything. It only equips you with function-development knowledge. Do NOT run any
foundry functionscommand (especiallyexec,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:
- Use CrowdStrike SDKs (gofalcon/falconpy) for ALL API interactions
- Implement structured JSON responses with proper status codes
- 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.
Before writing a function, exhaust alternatives — each one avoids deployment complexity, cold start latency, and maintenance overhead:
foundry-js for client-side data fetchingThere is no secrets management in Falcon Foundry. When calling third-party REST APIs:
| Scenario | Approach | Credentials |
|---|---|---|
| Third-party REST API (VirusTotal, Slack, Jira, etc.) | API integration in manifest + APIIntegrations().execute_command_proxy() | Platform-managed at install time |
| CrowdStrike Falcon API | FalconPy zero-arg constructor (Alerts(), Hosts()) | Platform-managed automatically |
| Third-party GraphQL API (no OpenAPI spec) | Function with requests + env var | Visible 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.
This skill is split across multiple files. Consult these for full examples:
| Task | Reference |
|---|---|
| Python handler, collection CRUD, error class, lookup file uploads, LogScale ingestion | references/python-patterns.md |
| Go FDK handler, Falcon client auth, collection CRUD, alerts handler | references/go-patterns.md |
| Too many functions: build failures, consolidation | references/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 patterns | references/testing-patterns.md |
| Resource | Default | Maximum |
|---|---|---|
| JSON payload (input + output combined) | — | 1018 KB |
| Execution timeout | 15s | 900s |
| Memory | 256 MB | 1 GB |
| Package size (zipped, with dependencies) | — | 50 MB |
| Concurrent executions | — | 100 |
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.
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.
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 —
execandtestrun 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:
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
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.
⚠️ CRITICAL: Functions called from workflows MUST be created with
--input-schemaand--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.
The platform registers a handler's schemas with the workflow engine when the function is created. Without a response schema:
${data['my_function.output.field']} resolve to nothingPassing --wf-expose alone is not enough. It creates the workflow binding; the schema fields are still written as null.
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:
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:
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.
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:
manifest.yml and delete its directory--input-schema/--output-schema as shown aboveworkflow_integration.id changesWarning: 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.
| Feature | Go | Python |
|---|---|---|
| HTTP Methods | GET, POST, PUT, DELETE | GET, POST, PUT, PATCH, DELETE |
| FDK Package | github.com/CrowdStrike/foundry-fn-go | crowdstrike-foundry-function |
| CrowdStrike SDK | gofalcon | falconpy |
| PATCH support | No | Yes |
| UI Editor support | No | Yes |
Use Go for performance-critical workloads, concurrency, and type safety. Use Python for rapid development, PATCH support, and UI Editor development.
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.
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.
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 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:
opts := fdk.FalconClientOpts()
falconClient, err := falcon.NewClient(&falcon.ApiConfig{
AccessToken: r.AccessToken,
Cloud: falcon.Cloud(opts.Cloud),
Context: ctx,
UserAgentOverride: opts.UserAgent,
})
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()
Request ObjectNo 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.
FalconPy handles credential discovery automatically. Call Service Class constructors with zero arguments:
from falconpy import Alerts
falcon = Alerts() # Auth is automatic — do not pass credentials
FALCON_CLIENT_ID and FALCON_CLIENT_SECRET from environment variablesFalconPy 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()(orAPIHarnessV2(),CustomStorage(),APIIntegrations()) is built at import with no token and returns401on every call despite correct scopes.
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:
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:
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:
execute_command_proxy)execute_command variant)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__(/|$).
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:
# 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)
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:
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.
requests instead of CrowdStrike SDKs. The SDKs handle auth, retries, regions, and error parsing.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.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).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.{'items': [...]} not [...]).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.For real-world implementation patterns, see:
use-cases/python-functions.md — Python handler patterns, SDK usage, testinguse-cases/logscale-ingestion.md — Ingesting custom data into Falcon LogScaleuse-cases/api-pagination.md — Pagination strategies in functions and workflowsreferences/code-review-checklist.md (opens in a new tab)references/execution-and-testing.md (opens in a new tab)references/function-count-and-build-time.md (opens in a new tab)references/go-patterns.md (opens in a new tab)references/python-patterns.md (opens in a new tab)references/testing-patterns.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
foundry, serverless, function-development, fdk, handler-patterns
14 skills in this plugin
/ai-agents-developmentBuild AI agents and knowledge bases for Falcon Foundry apps. TRIGGER when user asks to "create an AI agent", "add a Foundry agent", "build a knowledge base", "give my agent documents", "expose a collection as an agent tool", "expose an API operation to an agent", "put my agent in Charlotte", "expose an agent as a tool for other agents", "delete an agent or knowledge base", runs `foundry agents create`, `foundry agents delete`, `foundry knowledge-bases create`, or `foundry knowledge-bases delete`, or needs help with the `ai.agents` / `ai.knowledge_bases` manifest blocks, agent system prompts, agent input/output formats, agent exposure, or agent tool references. DO NOT TRIGGER for Fusion SOAR workflow YAML — use workflows-development. DO NOT TRIGGER for serverless function handlers — use functions-development. DO NOT TRIGGER for designing a collection schema itself — use collections-development, then return here to wire the collection up as an agent tool./api-integrationsExpose external APIs to Falcon Foundry via OpenAPI specs. TRIGGER when user asks to "create an API integration", "adapt an OpenAPI spec for Foundry", "expose an API to workflows", "connect to a third-party API", or runs `foundry api-integrations create`. Also trigger when user has an OpenAPI/Swagger spec and wants it working in Falcon Foundry. DO NOT TRIGGER when user wants to call Falcon platform APIs from function code — use functions-falcon-api instead./app-auditAudit an existing Falcon Foundry app for documented anti-patterns and fix the safe ones, like npm audit. TRIGGER when user asks to "audit my Foundry app", "check my app for problems", "review this Foundry app", "scan for anti-patterns", "why might this deploy fail", or runs `audit_app.py`. DO NOT TRIGGER for creating a new app (use development-workflow) or for debugging an error the user already has (use debugging-workflows)./app-upgradesUpgrade a Falcon Foundry app that was installed from a template to a newer version of that template, in place. TRIGGER when user asks to "upgrade an app", "update an app installed from a template", "pull the latest template into my app", "update a sample app installed in my CID to the latest version", or gives an app ID plus a newer template archive, directory, or GitHub repo. DO NOT TRIGGER for creating a new app (use development-workflow) or for deploying changes to an app the user develops locally (use development-workflow's deploy steps)./collections-developmentDesign JSON Schema collections and CRUD patterns for Falcon Foundry apps. TRIGGER when user asks to "create a collection", "define a JSON schema", "store data in Foundry", runs `foundry collections create`, or needs help with indexable fields, FQL queries, or collection access patterns. DO NOT TRIGGER for workflow YAML, function handlers, or UI components — use the appropriate sub-skill./debugging-workflowsSystematic troubleshooting for Falcon Foundry CLI errors, manifest validation failures, deploy failures, artifact runtime errors, and development server issues. TRIGGER when user encounters CLI errors, `foundry ui run` not working, deploy failures, authentication issues, function execution failures, "debug my function", "why did this fail", or any unexpected behavior during Foundry app development. Also trigger for headless/CI environment setup failures.npx claudepluginhub crowdstrike/foundry-skills --plugin crowdstrike-falcon-foundryOther plugins' skills for the same job