Skip to main content

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:
Command files:
Skill/Agent 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:
Comprehensive descriptions:
Validate input thoroughly:
Handle errors gracefully:
Format output clearly:

Performance

Add timeouts:
Cache when appropriate:
Limit response sizes:

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:
  1. Overview: What does it do?
  2. Features: List of capabilities
  3. Installation: How to install
  4. Configuration: Required settings
  5. Usage: Examples of commands/tools
  6. Development: How to contribute
  7. 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