> ## Documentation Index
> Fetch the complete documentation index at: https://cognitio-agent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Function: defineCommand()

> Generated from the public TypeScript API.

```ts theme={null}
function defineCommand<T>(def): T;
```

Validate a programmatic slash-command definition.

## Type Parameters

### T

`T` *extends* [`CommandDefinition`](../interfaces/CommandDefinition)

## Parameters

### def

`T`

Named template and optional model/agent/tool policy.

## Returns

`T`

The validated definition.

## Throws

Invalid command fields.

## Example

```ts theme={null}
const definition = defineCommand({ name: "review", template: "Review $ARGUMENTS" })
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.