> For the complete documentation index, see [llms.txt](https://docs.wornoffkeys.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wornoffkeys.com/validations/syntax-validations.md).

# Syntax validations

{% embed url="<https://youtu.be/_67r4wq23BA?t=622>" %}

You can provide your own syntax validations that will be ran against every command. This function should throw an error if the syntax is incorrect.

{% hint style="info" %}
Callback functions will be checked by WOKCommands automatically. There is no need to actually implement this functionality yourself.
{% endhint %}

{% tabs %}
{% tab title="JavaScript" %}
{% code title="no-callback.js" %}

```javascript
module.exports = (command) => {
  const { commandObject, commandName } = command;

  if (!commandObject.callback) {
    throw new Error(
      `Command "${commandName}" does not have a callback function.`
    );
  }
};
```

{% endcode %}
{% endtab %}

{% tab title="TypeScript" %}
{% code title="no-callback.ts" %}

```typescript
import { Command } from "wokcommands";

export default (command: Command) => {
  const { commandObject, commandName } = command;

  if (!commandObject.callback) {
    throw new Error(
      `Command "${commandName}" does not have a callback function.`
    );
  }
};
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wornoffkeys.com/validations/syntax-validations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
