Code Snippets
The Snippets feature lets you save, organize, and reuse code snippets across your projects. Build a personal library of commonly used patterns, utilities, and solutions.
Overview
Access Snippets from the ReformCode page by selecting the Snippets tab. Features include:
- Save snippets: Store code with metadata
- Organize: Tags and categories
- Search: Find snippets quickly
- Copy: One-click copy to clipboard
- Edit: Update snippets anytime
- Sync: Available across devices
Getting Started
Saving Your First Snippet
- Navigate to ReformCode
- Click the Snippets tab
- Click New Snippet
- Enter snippet details:
- Title: Descriptive name
- Language: Programming language
- Tags: Comma-separated keywords
- Code: Your snippet content
- Click Save
From the Editor
- Write or paste code in the Editor tab
- Select the code you want to save
- Right-click and select Save to Snippets
- Or use the Save Snippet button
- Add title and tags
- Save
Organizing Snippets
Using Tags
Tags help categorize and find snippets:
Tags: react, hooks, useEffect, cleanup
Tags: utility, string, formatting
Tags: api, fetch, error-handling
Best practices:
- Use consistent naming
- Include language tags
- Add context tags (frontend, backend, etc.)
- Include pattern names (singleton, factory, etc.)
Categories
Snippets are automatically grouped by language:
- JavaScript/TypeScript
- Python
- Go
- CSS
- SQL
- Other
Favorites
Star frequently used snippets for quick access:
- Hover over a snippet
- Click the star icon
- Find favorites at the top
Managing Snippets
Editing
- Click a snippet to expand
- Click Edit button
- Modify title, tags, or code
- Save changes
Deleting
- Click the snippet
- Click Delete button
- Confirm deletion
Duplicating
- Click a snippet
- Click Duplicate
- Modify the copy as needed
- Save as new snippet
Searching Snippets
Quick Search
Use the search bar to find snippets by:
- Title
- Tags
- Code content
- Language
Filters
Filter snippets by:
- Language: Show only Python, JavaScript, etc.
- Tags: Filter by specific tags
- Date: Recent or oldest first
- Favorites: Show starred only
Keyboard Shortcut
Press Cmd/Ctrl + K to quick search from anywhere in ReformCode.
Using Snippets
Copy to Clipboard
- Find your snippet
- Click Copy button
- Paste in your project
Insert in Editor
- In the Editor tab
- Open Snippets sidebar
- Click a snippet
- Code inserts at cursor
Export Snippets
- Select snippets to export
- Click Export
- Choose format:
- JSON (for backup/import)
- Markdown (for documentation)
- Plain text (for sharing)
Import Snippets
- Click Import
- Select JSON file
- Review snippets
- Confirm import
Snippet Templates
React Component
import React from 'react';
interface ${1:ComponentName}Props {
${2:// props}
}
export function ${1:ComponentName}({ ${3} }: ${1:ComponentName}Props) {
return (
<div>
${4:// content}
</div>
);
}
API Fetch
async function fetchData<T>(url: string): Promise<T> {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
}
Error Handler
function handleError(error: unknown): string {
if (error instanceof Error) {
return error.message;
}
return String(error);
}
Best Practices
Naming Conventions
Use clear, descriptive titles:
- "React useEffect Cleanup Pattern"
- "Python API Error Handler"
- "SQL Join with Aggregate"
Documentation
Add comments to explain usage:
/**
* Debounce function - delays execution until pause in calls
* @param fn - Function to debounce
* @param delay - Milliseconds to wait
* @returns Debounced function
*/
function debounce(fn, delay) {
// ...
}
Keep Snippets Focused
- One purpose per snippet
- Include only necessary code
- Remove project-specific details
- Make it reusable
Sync Across Devices
Snippets are saved to your account and available:
- On any browser when logged in
- Across computers
- After browser cache clears
Privacy & Storage
- Snippets are private by default
- Stored encrypted in our database
- Not shared with other users
- Deleted when you delete them
Troubleshooting
Snippets not saving
- Check your internet connection
- Ensure you're logged in
- Try refreshing the page
Search not finding snippets
- Check spelling
- Try different keywords
- Clear filters
Import failed
- Verify JSON format
- Check file size limit (1MB)
- Try smaller batches
Next Steps:
- Code Editor - Edit and analyze code
- Keyboard Shortcuts - Speed up your workflow
- Credits System - Understand pricing