Extension Best Practices
Follow these guidelines to create high-quality, maintainable, and user-friendly extensions.Extension Structure
Keep It Organized
Use a clear, logical directory structure:Name Things Clearly
Extension names:Manifest File (qwen-extension.json)
Complete and Accurate
Use Variables Properly
Semantic Versioning
Follow semver:- MAJOR: Breaking changes
- MINOR: New features (backwards compatible)
- PATCH: Bug fixes
MCP Servers
Tool Design
Clear, descriptive names:Performance
Add timeouts:Commands
Clear and Focused
Helpful Descriptions
Safe Shell Commands
Error Handling
Skills
Descriptive Frontmatter
Structured Instructions
Include Examples
Agents
Focused Expertise
Appropriate Tools
Clear Instructions
Context Files (QWEN.md)
Be Concise
Context consumes tokens. Be comprehensive but brief:Document Constraints
Provide Examples
Settings and Configuration
Clear Setting Descriptions
Sensitive Data Handling
Provide Defaults
Documentation
Comprehensive README
Include:- Overview: What does it do?
- Features: List of capabilities
- Installation: How to install
- Configuration: Required settings
- Usage: Examples of commands/tools
- Development: How to contribute
- License: License information
Keep CHANGELOG
Testing
Test Before Release
Test Edge Cases
- Empty inputs
- Invalid inputs
- Missing configuration
- Network failures (for API-based tools)
- Large inputs/outputs
- Special characters in inputs
Security
Validate User Input
Protect Sensitive Data
Use HTTPS
Error Messages
Be Helpful
Provide Context
Performance
Optimize Startup
- Don’t do heavy initialization in MCP server startup
- Lazy-load large dependencies
- Cache expensive computations
Minimize Context
- Keep QWEN.md concise
- Don’t include unnecessary information
- Use external docs for detailed information
Efficient Tools
Compatibility
Cross-Platform
Use path separators correctly:Node Version
Support LTS Node versions:Next Steps
- Creating Extensions - Build your first extension
- MCP Servers - Add custom tools
- Commands - Create custom commands
- Skills - Build AI capabilities
- Agents - Create specialized assistants
- Releasing - Publish your extension
