Skip to main content
All CollectionsRule documentation
Adding your own custom rules
Adding your own custom rules

Creating a custom rule on Clayton

Anthony Farino avatar
Written by Anthony Farino
Updated this week

Along with the plethora of rulesets that we offer on Clayton as mentioned here, we also offer the ability to create your own custom rules that you can integrate into your workflows. Combined with the ability to create policies, development supported by Clayton has never been more extensive in providing an optimal code analysis in your DevOps process.

Before getting started, make sure that you're an admin on your team. You can check this by navigating to the general team settings panel and selecting the Users tab (https://app.clayton.io/settings/users):

Step 1: Navigating to the Custom Rules workflow

In the bottom right corner of Clayton, you should see a tab called Admin tools. If you expand it, you can select the Rules option.

Upon arriving at the resulting Rules page, you can begin the process of adding your own rule by selecting the add button as shown here:

Step 2: Adding a new rule

At this stage, Clayton walks you through the process of adding a new rule via the completion of 4 tasks:

  • Details: Filling out all metadata associated with the rule

  • Logic: Adding the logic in Clayton needed to detect Apex in question

    • This logic follows an in-house language called Clay -- you can learn more about this code style here.

  • Fields: Adding customizable fields to the rule

  • Resources: Adding resources to documentation for where developers can go to learn more about it

  • Tags: Adding tags for within Clayton to make the rule easier to find

At this point, you've created your first rule! You can now add this to a policy as described here πŸŽ‰

Did this answer your question?