Turn repeated code into reusable snippets
Finds the repeated patterns in code you paste and turns the three most useful ones into snippets with a trigger word and tab stops.
Task:
Find the code patterns I repeat in the code below and turn the three most useful ones into editor snippets.
Context:
The language is [language and framework] and my editor is [editor or snippet manager]. I type these patterns about [how often] and want to trigger them with short words.
Rules:
- Read all the code first and pick patterns that appear at least twice with only names or values changing.
- Replace the parts that change with numbered tab stops and a default value, and keep the rest exactly as written.
- Give each snippet a trigger word of at most 6 characters that does not clash with a common keyword of the language.
- Replace any real token, key, password or internal address in the code with a tab stop. Ask for no secrets in the chat.
- If you are unsure of the snippet format of my editor, say so and tell me which docs page to check.
Result:
For each of the three snippets, the pattern name, the trigger word and the snippet in the format of my editor in one code block. End with one sentence on how to install them.
Material:
[paste the code with the repeated patterns here]