Skip to main content

Doc Rules created by AI

Swimm's Regex-based Rules is a feature that links your codebase to relevant documentation using regex rules.

Using AI to create rules

In the Rules tab in your IDE plugin, you have the option to create a rule from scratch or use AI assistance. Choose the option "Create a rule using AI (Beta)". This feature is particularly useful if you are not sure about the use case and you would like to get some ideas.

Choose the relevant document: This document will be linked with your regex rule and will be displayed whenever the rule's conditions are met in the code.

Discover use cases: Swimm AI will generate the top 3 use cases relevant to your document. Not happy with the results? Click the Regenerate button.

Select a use case: Once you've identified your use case, select it - Swimm AI will now suggest a few regex options that are relevant to your use case. Once the results are back, select a regex that looks the most relevant.

Customize the regex to your needs: The suggested regex might be exactly what you were looking for, but you can also tweak it to your needs.

Save, test and commit

Save and test: Click Apply, and you will be able to see the highlighting in your code. We recommend testing in your IDE to see that the rule works the way you expect.

Commit: Rules are stored in your code under the .swm/rules.json file. Commit and push your changes to this file. Once your colleagues pull the latest version which includes your changes, everyone will share the same rules.

Need help?

Head over to our FAQ section.


This document is automatically kept up to date using Swimm.