Generation tokens are required to generate new snippets. Generation tokens can be purchased via subscription, or, as a one-time purchase with Pay As You Go tokens. Learn more about generation tokens here.
First, give your snippet a name and then select the language/framework that will be used to generate the snippet.
Next, optionally select the Rule Set that you’d like to use for the generation.
After you’ve selected a rule set, next, optionally select a project to add the snippet to (recommended for keeping things organized and making your snippets shareable with a project team).
Finally, provide a prompt to generate the snippet. Your prompt should:
- Use as specific language as possible. The generated result will only be as accurate as the prompt you provide. While you can get a good result with a simple prompt, the more detailed your expectaitons, the better.
- Use proper grammar and spelling. While the AI is pretty good about handling typos, if your prompt is difficult to reason through, it can have a negative effect on the result.
- If possible, provide examples of other code that can be used as a reference or starting point. For example, if you have a function written in Python that you’d like to use in Node.js, provide the Python code as an example, specifying that you’d like that code rewritten to work with JavaScript/Node.js.
Iterating on a Snippet
While the ideal outcome is that the generated snippet fits your needs on the first try, often, you will need to provide additional prompting after the first generation.
From the snippet editor, you can provide additional instructions and re-generate the snippet via the input at the bottom of the snippet editor. Type in your iteration instructions and then click the “Iterate” button to re-generate the snippet.
At the top of the editor, you can use the arrows next to the version label to toggle between versions of your snippet.