Collections development

From CrowdStrike/foundry-skills · View interactive version

Collections development is an AI agent skill from the GitHub repository CrowdStrike/foundry-skills. Design 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 TRIGG

How to use this skill

Skill file

Foundry Collections Development

Part of a suite. If development-workflow has not already run, and this is a new app or its first capability, load the development-workflow skill first — it owns the CLI prerequisite check, scaffolding order, and manifest coordination.

Falcon Foundry Collections are NoSQL document stores with JSON Schema validation. They provide persistent storage for app data with CRUD operations, FQL queries, and schema enforcement.

Collection Naming Constraints

| Constraint | Rule |

|-----------|------|

| Length | 5-200 characters |

| Start/end | Must begin and end with a letter or number |

| Special characters | Only underscores (_) allowed — no hyphens, spaces, or other chars |

| Case | Case-sensitive |

Collection Description Constraints

| Constraint | Rule |

|-----------|------|

| Length | 3-500 characters |

| Start | Must begin with an alphanumeric character |

| Allowed characters | Letters, numbers, spaces, dashes, periods, parentheses, and underscores only |

| Not allowed | Commas, colons, semicolons, quotes, slashes, or other special characters |

Check the description against this table before running collections create. The CLI accepts a comma (or any other disallowed character) in --description without complaint; the rejection only surfaces later, from foundry apps validate or deploy, by which time the collection is already in the manifest and has to be fixed by hand. Write the description with letters, numbers, spaces, dashes, periods, parentheses, and underscores only.

Collection Limits

| Resource | Limit |

|----------|-------|

| Single object size | ~50 MB |

| Schema size | 256 KB |

| Object key length | 1-1,000 characters |

| Indexed fields per schema | 10 |

| Objects per collection | No enforced limit |

| Collections per app | No enforced limit |

| Search results per page | 500 max (default 50) |

JSON Schema Requirements

CLI Scaffolding

# Write schema to /tmp/ first — the CLI copies it into collections/
foundry collections create \
  --name "my_collection" \
  --schema /tmp/schema.json \
  --description "App data store" \
  --no-prompt \
  --wf-expose \
  --wf-tags "tag1,tag2"

This creates the collection directory, copies the schema, and updates manifest.yml. Edit the project copy at collections/my_collection.json afterward to refine.

Exposing a Collection as an Agent Tool

Add --agent-tools-expose to let a Foundry AI agent read and write the collection:

foundry collections create --name "triage_notes" --schema /tmp/schema.json \
  --description "Agent triage notes" --agent-tools-expose --no-prompt

That writes one block onto the collection's manifest entry:

collections:
    - name: triage_notes
      agent_tools_integration:
        exposed: true

Exposure is only half the wiring. The agent must also name each operation it may call in its own tools list, using action:collections.<collection_name>.<Operation>. Without the action: prefix, the deploy fails with a bare 500:

ai:
    agents:
        - name: Detection Triage Agent
          tools:
            - action:collections.triage_notes.CreateObject
            - action:collections.triage_notes.SearchObjects

Valid operations, exact casing required: CreateObject, GetObject, DeleteObject, ListObjects, SearchObjects.

A collection exposed but not listed in tools is unreachable by the agent, and vice versa — neither case produces an error, just an agent that silently cannot use the data. agent_tools_integration is independent of workflow_integration; a collection can be exposed to agents, to Fusion, to both, or to neither.

Agents can also use the generic collection, action:mcp/gce/collections:generic:<Operation> — a scratch collection the platform creates per agent at runtime, needing no collection of your own. Use a named app collection when the data must outlive the agent or be readable by other capabilities. See ai-agents-development.

Collection API Access

Collections are managed via the CrowdStrike API or the foundry-js SDK. There are no CLI commands for reading/writing collection data, and collections can only be deleted from the Falcon Foundry UI (not the CLI).

PUT    /customobjects/v1/collections/{collection_name}/objects/{key}  — Create/update object
GET    /customobjects/v1/collections/{collection_name}/objects/{key}  — Get object by key
DELETE /customobjects/v1/collections/{collection_name}/objects/{key}  — Delete object
POST   /customobjects/v1/collections/{collection_name}/objects        — Search objects (FQL filter)

JSON Schema Patterns

Basic Schema

{
  "$schema": "https://json-schema.org/draft-07/schema#",
  "type": "object",
  "title": "Incident",
  "description": "Security incident record",
  "required": ["id", "title", "severity", "status", "created_at"],
  "additionalProperties": false,
  "properties": {
    "id": { "type": "string", "format": "uuid" },
    "title": { "type": "string", "minLength": 1, "maxLength": 200 },
    "severity": { "type": "integer", "minimum": 1, "maximum": 10 },
    "status": {
      "type": "string",
      "enum": ["open", "investigating", "contained", "resolved", "closed"]
    },
    "tags": {
      "type": "array",
      "items": { "type": "string", "maxLength": 50 },
      "maxItems": 20,
      "uniqueItems": true
    },
    "created_at": { "type": "string", "format": "date-time" }
  }
}

Indexable Fields

Make fields searchable via FQL by marking them indexable. Two patterns are supported:

Pattern A: Top-level array (preferred — used by most foundry-sample repos)

{
  "$schema": "https://json-schema.org/draft-07/schema",
  "x-cs-indexable-fields": [
    { "field": "/status", "type": "string", "fql_name": "status" },
    { "field": "/severity", "type": "integer", "fql_name": "severity" },
    { "field": "/created_at", "type": "string", "fql_name": "created_at" }
  ],
  "type": "object",
  "properties": {
    "status": { "type": "string" },
    "severity": { "type": "integer" },
    "created_at": { "type": "string", "format": "date-time" }
  }
}

Pattern B: Per-field annotation

{
  "properties": {
    "compositeId": { "type": "string", "x-cs-indexable": true },
    "content": { "type": "string" }
  }
}

Both patterns work. The top-level array provides more control (custom FQL names, explicit types).

Manifest Configuration

# manifest.yml
collections:
  - name: incidents
    description: Security incident records
    schema: collections/incidents.json
    permissions: []
    workflow_integration:
      system_action: true
      tags:
        - Collection

  - name: audit_logs
    description: Audit log entries
    schema: collections/audit_logs.json
    permissions: []
    workflow_integration:
      system_action: false
      tags: []

Indexing is controlled entirely by x-cs-indexable-fields or x-cs-indexable: true in the JSON schema files, not in the manifest.

CRUD Operations

Use a typed foundry-js Collection client from UI/TypeScript, and the CustomStorage service class (not the APIHarnessV2 Uber class) from Python functions. Full walkthroughs — the typed TypeScript IncidentCollection client and the Python CustomStorage CRUD/search/paginate example with its key points — are in references/advanced-patterns.md. Two behaviors that bite in both: a never-created key reads as a truthy not-found envelope on the JS side and a 404 on the Python side (gate on a real field, not truthiness), and FQL filters only work on fields marked x-cs-indexable: true.

FQL Search Syntax

Only fields marked with x-cs-indexable: true can be used in FQL queries.

| Operation | Syntax | Example |

|-----------|--------|---------|

| Equality | field:'value' | status:'open' |

| Numeric comparison | field:>=N | severity:>=5 |

| AND | field1:'a'+field2:'b' | status:'open'+severity:>=5 |

| OR | field:'a',field:'b' | status:'open',status:'investigating' |

| Wildcard | field:*'*pattern*' | title:*'*malware*' |

| Sorting | sort=field\|asc | sort=created_at\|desc |

The foundry-js SDK's search() method accepts a filter parameter for FQL queries. The search endpoint is POST /customobjects/v1/collections/{name}/objects, with filter, limit, offset, and sort sent as query parameters, not in the request body.

Workflow Share Settings

To make a collection accessible from workflows:

collections:
  - name: incidents
    schema: collections/incidents.json
    permissions: []
    workflow_integration:
      system_action: true           # true = app workflows only, false = also available as Fusion SOAR action
      tags:
        - Collection

| Setting | Behavior |

|---------|----------|

| workflow_integration.system_action: true | Available to app workflows only |

| workflow_integration.system_action: false | Available to both app workflows AND Falcon Fusion SOAR |

RBAC and Direct API Access

Collections can be accessed directly via the CrowdStrike API (outside of functions) using custom roles with specific collection permissions. Include the X-CS-APP-ID header to identify your Foundry app. Foundry CLI credentials cannot access collections directly; use a separate API client with Custom Storage read/write scope.

Common Pitfalls

Reading Guide

| Task | Reference |

|------|-----------|

| Migrations, testing, pagination, extended schemas, counter-rationalizations | references/advanced-patterns.md |

Use Cases

For real-world implementation patterns, see:

Reference Implementations

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.