# Rules, skills and hooks

Shape how CloudForge works in your project with files in the .cloudforge folder.

Source: https://docs.trycloudforge.com/customizations

## Manage them


Open the **Options** menu in the title bar and choose **Customizations**. From the Command Palette you can also run **New Rule**, **New Skill** and **Open hooks.json**.


Files in your project's `.cloudforge` folder apply to that project. You can also keep global ones that apply to every project.



## Rules


A rule is guidance CloudForge follows, such as "Use TypeScript strict mode" or "Tag every AWS resource with the project name". Each rule is a Markdown file in `.cloudforge/rules/`.


| Rule type | When it applies |
| --- | --- |
| Always | In every chat. |
| Smart | When CloudForge works on files that match the rule's file pattern, or when the task matches the rule's description. |
| On call | CloudForge sees a list of these rules and loads one when it is relevant. |


You can turn each rule on and off.



## Skills


A skill is a set of instructions for a task you repeat, such as "release a new version". Each skill is a folder with a `SKILL.md` file: `.cloudforge/skills/<name>/SKILL.md`. Skill names use lowercase letters, numbers and single hyphens, up to 64 characters.


Your skills also show up as slash commands in chat.



## Hooks


A hook runs a command of yours at a set moment, for example a formatter after each file is saved. Hooks live in `.cloudforge/hooks.json`.


Hooks can run when:


- a session starts or ends;
- you send a message;
- CloudForge is about to call a model;
- CloudForge is about to use a tool, or has just used one;
- CloudForge finishes its turn;
- a file is saved.


Your command gets the details as JSON in the `CLOUDFORGE_HOOK_PAYLOAD` environment variable, and the event name in `CLOUDFORGE_HOOK_EVENT`. A hook that runs before a tool or after you send a message can block it by exiting with code 2. Text your command prints is passed to CloudForge as extra context.
