Extension Best Practices
This guide provides best practices for creating high-quality Radium extensions.
Naming Conventionsβ
Extension Namesβ
- Use kebab-case:
my-extension,code-review-agents - Be descriptive: Names should indicate the extension's purpose
- Avoid conflicts: Consider prefixing with your username or organization
- Start with a letter: Must start with a letter (not a number)
- No spaces: Use dashes or underscores instead
Good examples:
github-integrationrust-code-reviewercustom-workflows
Bad examples:
My Extension(spaces, uppercase)123-extension(starts with number)extension(too generic)
Component Namesβ
- Prompts: Use descriptive names like
code-review-agent.md - MCP Servers: Use server purpose, e.g.,
github-api.json - Commands: Use action verbs, e.g.,
deploy-production.toml - Hooks: Use descriptive names, e.g.,
metrics-hook.toml
Component Organizationβ
Directory Structureβ
Organize components logically:
my-extension/
βββ radium-extension.json
βββ prompts/
β βββ agents/ # Agent prompts
β β βββ reviewer.md
β βββ frameworks/ # Framework-specific prompts
β βββ react.md
βββ mcp/
β βββ api-server.json
βββ commands/
β βββ build.toml
β βββ deploy/
β βββ production.toml
βββ hooks/
βββ logging.toml
Categorizationβ
- Group related components: Use subdirectories for organization
- Consistent naming: Follow a consistent naming pattern
- Clear hierarchy: Keep directory depth reasonable (2-3 levels max)
Manifest Designβ
Required Fieldsβ
Always provide:
- name: Clear, descriptive extension name
- version: Semantic version (start with 1.0.0)
- description: Brief but informative description
- author: Your name or organization
Component Pathsβ
- Use glob patterns:
prompts/*.mdinstead of listing every file - Be specific:
prompts/agents/*.mdis better thanprompts/**/* - Document patterns: Explain glob patterns in README if complex
Dependenciesβ
- Declare dependencies: List all required extensions
- Version constraints: Specify version requirements if needed (future)
- Minimize dependencies: Only declare truly required dependencies
Dependency Managementβ
When to Declare Dependenciesβ
Declare a dependency when:
- Your extension requires another extension to function
- Components reference or extend another extension's components
- Your extension provides enhancements to another extension
Dependency Best Practicesβ
- Minimize dependencies: Fewer dependencies = easier installation
- Document why: Explain why each dependency is needed
- Test with dependencies: Ensure installation works with
--install-deps - Handle missing dependencies: Provide clear error messages
Backward Compatibilityβ
Versioning Strategyβ
- Semantic versioning: Follow semver (MAJOR.MINOR.PATCH)
- Breaking changes: Increment MAJOR version
- New features: Increment MINOR version
- Bug fixes: Increment PATCH version
Maintaining Compatibilityβ
- Don't remove components: Mark as deprecated instead
- Additive changes: Prefer adding new components over modifying existing
- Document changes: Include changelog for version updates
- Migration guides: Provide migration instructions for breaking changes
Security Best Practicesβ
No Hardcoded Secretsβ
Never include:
- API keys or tokens
- Passwords or credentials
- Private keys or certificates
- Personal information
Instead:
- Use environment variables
- Document required configuration
- Provide setup instructions
Path Validationβ
- No path traversal: Validate all file paths
- Relative paths: Use relative paths in manifests
- Safe globs: Avoid overly permissive glob patterns
Input Validationβ
If your extension processes user input:
- Validate all inputs
- Sanitize file paths
- Handle errors gracefully
- Don't execute arbitrary code
Performance Considerationsβ
Lazy Loadingβ
- Minimal dependencies: Only include what's needed
- Efficient globs: Use specific glob patterns
- Avoid large files: Keep individual files reasonable in size
Resource Usageβ
- Document requirements: List any system requirements
- Optimize components: Keep prompts and configs concise
- Test performance: Ensure extension doesn't slow down Radium
Documentationβ
README Requirementsβ
Your README should include:
- Clear title and description
- Installation instructions
- Usage examples
- Component documentation
- Configuration options
- Troubleshooting section
Code Commentsβ
- Document complex logic: Add comments for non-obvious code
- Explain decisions: Document why certain approaches were chosen
- Provide examples: Include usage examples in comments
Testingβ
Local Testingβ
Before distribution:
- Test installation from local directory
- Verify all components are discoverable
- Test with different Radium versions (if possible)
- Check for conflicts with other extensions
- Validate manifest and structure
Test Scenariosβ
Test these scenarios:
- Fresh installation
- Installation with dependencies
- Overwriting existing extension
- Uninstallation
- Component discovery and usage
Error Handlingβ
User-Friendly Errorsβ
- Clear messages: Provide actionable error messages
- Context: Include relevant context in errors
- Suggestions: Offer solutions or next steps
Validationβ
- Validate early: Check manifest and structure before installation
- Comprehensive checks: Validate all components
- Helpful errors: Point to specific issues
Examples and Templatesβ
Provide Examplesβ
Include example usage:
- Example agent configurations
- Example workflow usage
- Example command invocations
- Example MCP server setup
Template Extensionsβ
Consider creating template extensions:
- Minimal template for quick starts
- Full-featured template showing all patterns
- Language-specific templates
Community Guidelinesβ
Code of Conductβ
- Be respectful: Treat all users with respect
- Be helpful: Provide support and answer questions
- Be open: Accept feedback and contributions
Contribution Guidelinesβ
If accepting contributions:
- Document contribution process
- Set clear expectations
- Review contributions carefully
- Maintain code quality