Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Guidance for developing custom slash commands for Claude Code plugins from the official Anthropic repository.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/marketplace-considerations.md
1# Marketplace Considerations for Commands23Guidelines for creating commands designed for distribution and marketplace success.45## Overview67Commands distributed through marketplaces need additional consideration beyond personal use commands. They must work across environments, handle diverse use cases, and provide excellent user experience for unknown users.89## Design for Distribution1011### Universal Compatibility1213**Cross-platform considerations:**1415```markdown16---17description: Cross-platform command18allowed-tools: Bash(*)19---2021# Platform-Aware Command2223Detecting platform...2425case "$(uname)" in26Darwin*) PLATFORM="macOS" ;;27Linux*) PLATFORM="Linux" ;;28MINGW*|MSYS*|CYGWIN*) PLATFORM="Windows" ;;29*) PLATFORM="Unknown" ;;30esac3132Platform: $PLATFORM3334<!-- Adjust behavior based on platform -->35if [ "$PLATFORM" = "Windows" ]; then36# Windows-specific handling37PATH_SEP="\\"38NULL_DEVICE="NUL"39else40# Unix-like handling41PATH_SEP="/"42NULL_DEVICE="/dev/null"43fi4445[Platform-appropriate implementation...]46```4748**Avoid platform-specific commands:**4950```markdown51<!-- BAD: macOS-specific -->52!`pbcopy < file.txt`5354<!-- GOOD: Platform detection -->55if command -v pbcopy > /dev/null; then56pbcopy < file.txt57elif command -v xclip > /dev/null; then58xclip -selection clipboard < file.txt59elif command -v clip.exe > /dev/null; then60cat file.txt | clip.exe61else62echo "Clipboard not available on this platform"63fi64```6566### Minimal Dependencies6768**Check for required tools:**6970```markdown71---72description: Dependency-aware command73allowed-tools: Bash(*)74---7576# Check Dependencies7778Required tools:79- git80- jq81- node8283Checking availability...8485MISSING_DEPS=""8687for tool in git jq node; do88if ! command -v $tool > /dev/null; then89MISSING_DEPS="$MISSING_DEPS $tool"90fi91done9293if [ -n "$MISSING_DEPS" ]; then94❌ ERROR: Missing required dependencies:$MISSING_DEPS9596INSTALLATION:97- git: https://git-scm.com/downloads98- jq: https://stedolan.github.io/jq/download/99- node: https://nodejs.org/100101Install missing tools and try again.102103Exit.104fi105106✓ All dependencies available107108[Continue with command...]109```110111**Document optional dependencies:**112113```markdown114<!--115DEPENDENCIES:116Required:117- git 2.0+: Version control118- jq 1.6+: JSON processing119120Optional:121- gh: GitHub CLI (for PR operations)122- docker: Container operations (for containerized tests)123124Feature availability depends on installed tools.125-->126```127128### Graceful Degradation129130**Handle missing features:**131132```markdown133---134description: Feature-aware command135---136137# Feature Detection138139Detecting available features...140141FEATURES=""142143if command -v gh > /dev/null; then144FEATURES="$FEATURES github"145fi146147if command -v docker > /dev/null; then148FEATURES="$FEATURES docker"149fi150151Available features: $FEATURES152153if echo "$FEATURES" | grep -q "github"; then154# Full functionality with GitHub integration155echo "✓ GitHub integration available"156else157# Reduced functionality without GitHub158echo "⚠ Limited functionality: GitHub CLI not installed"159echo " Install 'gh' for full features"160fi161162[Adapt behavior based on available features...]163```164165## User Experience for Unknown Users166167### Clear Onboarding168169**First-run experience:**170171```markdown172---173description: Command with onboarding174allowed-tools: Read, Write175---176177# First Run Check178179if [ ! -f ".claude/command-initialized" ]; then180**Welcome to Command Name!**181182This appears to be your first time using this command.183184WHAT THIS COMMAND DOES:185[Brief explanation of purpose and benefits]186187QUICK START:1881. Basic usage: /command [arg]1892. For help: /command help1903. Examples: /command examples191192SETUP:193No additional setup required. You're ready to go!194195✓ Initialization complete196197[Create initialization marker]198199Ready to proceed with your request...200fi201202[Normal command execution...]203```204205**Progressive feature discovery:**206207```markdown208---209description: Command with tips210---211212# Command Execution213214[Main functionality...]215216---217218💡 TIP: Did you know?219220You can speed up this command with the --fast flag:221/command --fast [args]222223For more tips: /command tips224```225226### Comprehensive Error Handling227228**Anticipate user mistakes:**229230```markdown231---232description: Forgiving command233---234235# User Input Handling236237Argument: "$1"238239<!-- Check for common typos -->240if [ "$1" = "hlep" ] || [ "$1" = "hepl" ]; then241Did you mean: help?242243Showing help instead...244[Display help]245246Exit.247fi248249<!-- Suggest similar commands if not found -->250if [ "$1" != "valid-option1" ] && [ "$1" != "valid-option2" ]; then251❌ Unknown option: $1252253Did you mean:254- valid-option1 (most similar)255- valid-option2256257For all options: /command help258259Exit.260fi261262[Command continues...]263```264265**Helpful diagnostics:**266267```markdown268---269description: Diagnostic command270---271272# Operation Failed273274The operation could not complete.275276**Diagnostic Information:**277278Environment:279- Platform: $(uname)280- Shell: $SHELL281- Working directory: $(pwd)282- Command: /command $@283284Checking common issues:285- Git repository: $(git rev-parse --git-dir 2>&1)286- Write permissions: $(test -w . && echo "OK" || echo "DENIED")287- Required files: $(test -f config.yml && echo "Found" || echo "Missing")288289This information helps debug the issue.290291For support, include the above diagnostics.292```293294## Distribution Best Practices295296### Namespace Awareness297298**Avoid name collisions:**299300```markdown301---302description: Namespaced command303---304305<!--306COMMAND NAME: plugin-name-command307308This command is namespaced with the plugin name to avoid309conflicts with commands from other plugins.310311Alternative naming approaches:312- Use plugin prefix: /plugin-command313- Use category: /category-command314- Use verb-noun: /verb-noun315316Chosen approach: plugin-name prefix317Reasoning: Clearest ownership, least likely to conflict318-->319320# Plugin Name Command321322[Implementation...]323```324325**Document naming rationale:**326327```markdown328<!--329NAMING DECISION:330331Command name: /deploy-app332333Alternatives considered:334- /deploy: Too generic, likely conflicts335- /app-deploy: Less intuitive ordering336- /my-plugin-deploy: Too verbose337338Final choice balances:339- Discoverability (clear purpose)340- Brevity (easy to type)341- Uniqueness (unlikely conflicts)342-->343```344345### Configurability346347**User preferences:**348349```markdown350---351description: Configurable command352allowed-tools: Read353---354355# Load User Configuration356357Default configuration:358- verbose: false359- color: true360- max_results: 10361362Checking for user config: .claude/plugin-name.local.md363364if [ -f ".claude/plugin-name.local.md" ]; then365# Parse YAML frontmatter for settings366VERBOSE=$(grep "^verbose:" .claude/plugin-name.local.md | cut -d: -f2 | tr -d ' ')367COLOR=$(grep "^color:" .claude/plugin-name.local.md | cut -d: -f2 | tr -d ' ')368MAX_RESULTS=$(grep "^max_results:" .claude/plugin-name.local.md | cut -d: -f2 | tr -d ' ')369370echo "✓ Using user configuration"371else372echo "Using default configuration"373echo "Create .claude/plugin-name.local.md to customize"374fi375376[Use configuration in command...]377```378379**Sensible defaults:**380381```markdown382---383description: Command with smart defaults384---385386# Smart Defaults387388Configuration:389- Format: ${FORMAT:-json} # Defaults to json390- Output: ${OUTPUT:-stdout} # Defaults to stdout391- Verbose: ${VERBOSE:-false} # Defaults to false392393These defaults work for 80% of use cases.394395Override with arguments:396/command --format yaml --output file.txt --verbose397398Or set in .claude/plugin-name.local.md:399\`\`\`yaml400---401format: yaml402output: custom.txt403verbose: true404---405\`\`\`406```407408### Version Compatibility409410**Version checking:**411412```markdown413---414description: Version-aware command415---416417<!--418COMMAND VERSION: 2.1.0419420COMPATIBILITY:421- Requires plugin version: >= 2.0.0422- Breaking changes from v1.x documented in MIGRATION.md423424VERSION HISTORY:425- v2.1.0: Added --new-feature flag426- v2.0.0: BREAKING: Changed argument order427- v1.0.0: Initial release428-->429430# Version Check431432Command version: 2.1.0433Plugin version: [detect from plugin.json]434435if [ "$PLUGIN_VERSION" < "2.0.0" ]; then436❌ ERROR: Incompatible plugin version437438This command requires plugin version >= 2.0.0439Current version: $PLUGIN_VERSION440441Update plugin:442/plugin update plugin-name443444Exit.445fi446447✓ Version compatible448449[Command continues...]450```451452**Deprecation warnings:**453454```markdown455---456description: Command with deprecation warnings457---458459# Deprecation Check460461if [ "$1" = "--old-flag" ]; then462⚠️ DEPRECATION WARNING463464The --old-flag option is deprecated as of v2.0.0465It will be removed in v3.0.0 (est. June 2025)466467Use instead: --new-flag468469Example:470Old: /command --old-flag value471New: /command --new-flag value472473See migration guide: /command migrate474475Continuing with deprecated behavior for now...476fi477478[Handle both old and new flags during deprecation period...]479```480481## Marketplace Presentation482483### Command Discovery484485**Descriptive naming:**486487```markdown488---489description: Review pull request with security and quality checks490---491492<!-- GOOD: Descriptive name and description -->493```494495```markdown496---497description: Do the thing498---499500<!-- BAD: Vague description -->501```502503**Searchable keywords:**504505```markdown506<!--507KEYWORDS: security, code-review, quality, validation, audit508509These keywords help users discover this command when searching510for related functionality in the marketplace.511-->512```513514### Showcase Examples515516**Compelling demonstrations:**517518```markdown519---520description: Advanced code analysis command521---522523# Code Analysis Command524525This command performs deep code analysis with actionable insights.526527## Demo: Quick Security Audit528529Try it now:530\`\`\`531/analyze-code src/ --security532\`\`\`533534**What you'll get:**535- Security vulnerability detection536- Code quality metrics537- Performance bottleneck identification538- Actionable recommendations539540**Sample output:**541\`\`\`542Security Analysis Results543=========================544545🔴 Critical (2):546- SQL injection risk in users.js:45547- XSS vulnerability in display.js:23548549🟡 Warnings (5):550- Unvalidated input in api.js:67551...552553Recommendations:5541. Fix critical issues immediately5552. Review warnings before next release5563. Run /analyze-code --fix for auto-fixes557\`\`\`558559---560561Ready to analyze your code...562563[Command implementation...]564```565566### User Reviews and Feedback567568**Feedback mechanism:**569570```markdown571---572description: Command with feedback573---574575# Command Complete576577[Command results...]578579---580581**How was your experience?**582583This helps improve the command for everyone.584585Rate this command:586- 👍 Helpful587- 👎 Not helpful588- 🐛 Found a bug589- 💡 Have a suggestion590591Reply with an emoji or:592- /command feedback593594Your feedback matters!595```596597**Usage analytics preparation:**598599```markdown600<!--601ANALYTICS NOTES:602603Track for improvement:604- Most common arguments605- Failure rates606- Average execution time607- User satisfaction scores608609Privacy-preserving:610- No personally identifiable information611- Aggregate statistics only612- User opt-out respected613-->614```615616## Quality Standards617618### Professional Polish619620**Consistent branding:**621622```markdown623---624description: Branded command625---626627# ✨ Command Name628629Part of the [Plugin Name] suite630631[Command functionality...]632633---634635**Need Help?**636- Documentation: https://docs.example.com637- Support: [email protected]638- Community: https://community.example.com639640Powered by Plugin Name v2.1.0641```642643**Attention to detail:**644645```markdown646<!-- Details that matter -->647648✓ Use proper emoji/symbols consistently649✓ Align output columns neatly650✓ Format numbers with thousands separators651✓ Use color/formatting appropriately652✓ Provide progress indicators653✓ Show estimated time remaining654✓ Confirm successful operations655```656657### Reliability658659**Idempotency:**660661```markdown662---663description: Idempotent command664---665666# Safe Repeated Execution667668Checking if operation already completed...669670if [ -f ".claude/operation-completed.flag" ]; then671ℹ️ Operation already completed672673Completed at: $(cat .claude/operation-completed.flag)674675To re-run:6761. Remove flag: rm .claude/operation-completed.flag6772. Run command again678679Otherwise, no action needed.680681Exit.682fi683684Performing operation...685686[Safe, repeatable operation...]687688Marking complete...689echo "$(date)" > .claude/operation-completed.flag690```691692**Atomic operations:**693694```markdown695---696description: Atomic command697---698699# Atomic Operation700701This operation is atomic - either fully succeeds or fully fails.702703Creating temporary workspace...704TEMP_DIR=$(mktemp -d)705706Performing changes in isolated environment...707[Make changes in $TEMP_DIR]708709if [ $? -eq 0 ]; then710✓ Changes validated711712Applying changes atomically...713mv $TEMP_DIR/* ./target/714715✓ Operation complete716else717❌ Changes failed validation718719Rolling back...720rm -rf $TEMP_DIR721722No changes applied. Safe to retry.723fi724```725726## Testing for Distribution727728### Pre-Release Checklist729730```markdown731<!--732PRE-RELEASE CHECKLIST:733734Functionality:735- [ ] Works on macOS736- [ ] Works on Linux737- [ ] Works on Windows (WSL)738- [ ] All arguments tested739- [ ] Error cases handled740- [ ] Edge cases covered741742User Experience:743- [ ] Clear description744- [ ] Helpful error messages745- [ ] Examples provided746- [ ] First-run experience good747- [ ] Documentation complete748749Distribution:750- [ ] No hardcoded paths751- [ ] Dependencies documented752- [ ] Configuration options clear753- [ ] Version number set754- [ ] Changelog updated755756Quality:757- [ ] No TODO comments758- [ ] No debug code759- [ ] Performance acceptable760- [ ] Security reviewed761- [ ] Privacy considered762763Support:764- [ ] README complete765- [ ] Troubleshooting guide766- [ ] Support contact provided767- [ ] Feedback mechanism768- [ ] License specified769-->770```771772### Beta Testing773774**Beta release approach:**775776```markdown777---778description: Beta command (v0.9.0)779---780781# 🧪 Beta Command782783**This is a beta release**784785Features may change based on feedback.786787BETA STATUS:788- Version: 0.9.0789- Stability: Experimental790- Support: Limited791- Feedback: Encouraged792793Known limitations:794- Performance not optimized795- Some edge cases not handled796- Documentation incomplete797798Help improve this command:799- Report issues: /command report-issue800- Suggest features: /command suggest801- Join beta testers: /command join-beta802803---804805[Command implementation...]806807---808809**Thank you for beta testing!**810811Your feedback helps make this command better.812```813814## Maintenance and Updates815816### Update Strategy817818**Versioned commands:**819820```markdown821<!--822VERSION STRATEGY:823824Major (X.0.0): Breaking changes825- Document all breaking changes826- Provide migration guide827- Support old version briefly828829Minor (x.Y.0): New features830- Backward compatible831- Announce new features832- Update examples833834Patch (x.y.Z): Bug fixes835- No user-facing changes836- Update changelog837- Security fixes prioritized838839Release schedule:840- Patches: As needed841- Minors: Monthly842- Majors: Annually or as needed843-->844```845846**Update notifications:**847848```markdown849---850description: Update-aware command851---852853# Check for Updates854855Current version: 2.1.0856Latest version: [check if available]857858if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then859📢 UPDATE AVAILABLE860861New version: $LATEST_VERSION862Current: $CURRENT_VERSION863864What's new:865- Feature improvements866- Bug fixes867- Performance enhancements868869Update with:870/plugin update plugin-name871872Release notes: https://releases.example.com/v$LATEST_VERSION873fi874875[Command continues...]876```877878## Best Practices Summary879880### Distribution Design8818821. **Universal**: Works across platforms and environments8832. **Self-contained**: Minimal dependencies, clear requirements8843. **Graceful**: Degrades gracefully when features unavailable8854. **Forgiving**: Anticipates and handles user mistakes8865. **Helpful**: Clear errors, good defaults, excellent docs887888### Marketplace Success8898901. **Discoverable**: Clear name, good description, searchable keywords8912. **Professional**: Polished presentation, consistent branding8923. **Reliable**: Tested thoroughly, handles edge cases8934. **Maintainable**: Versioned, updated regularly, supported8945. **User-focused**: Great UX, responsive to feedback895896### Quality Standards8978981. **Complete**: Fully documented, all features working8992. **Tested**: Works in real environments, edge cases handled9003. **Secure**: No vulnerabilities, safe operations9014. **Performant**: Reasonable speed, resource-efficient9025. **Ethical**: Privacy-respecting, user consent903904With these considerations, commands become marketplace-ready and delight users across diverse environments and use cases.905