> ## 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: defineSkill()

> Generated from the public TypeScript API.

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

Validate and preserve a programmatic skill definition.

## Type Parameters

### T

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

## Parameters

### def

`T`

Skill name, description, content and optional runtime constraints.

## Returns

`T`

The same definition with inferred literal types.

## Throws

Invalid required fields or model/tool policy.

## Example

```ts theme={null}
const definition = defineSkill({ name: "style", description: "Plain writing", content: "Use clear words." })
```


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