plugin-slash-command

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Navigator Slash Command Generator

Navigator斜杠命令生成器

Generate new slash commands for the Navigator plugin following established conventions and patterns.
为Navigator插件遵循既定规范和模式生成新的斜杠命令。

When to Invoke

调用时机

Auto-invoke when user says:
  • "Add a slash command for..."
  • "Create a new /nav:[name] command"
  • "Generate slash command..."
  • "Add /nav:[feature] command"
  • "New Navigator command for..."
当用户说出以下内容时自动调用:
  • "为……添加斜杠命令"
  • "创建新的/nav:[name]命令"
  • "生成斜杠命令……"
  • "添加/nav:[feature]命令"
  • "为……创建新的Navigator命令"

What This Does

功能说明

  1. Asks for command details (name, purpose, complexity)
  2. Analyzes existing commands for pattern matching
  3. Generates command markdown file with proper structure
  4. Validates YAML frontmatter and formatting
  5. Shows usage example
  1. 询问命令详情(名称、用途、复杂度)
  2. 分析现有命令以匹配模式
  3. 生成具有正确结构的命令Markdown文件
  4. 验证YAML前置元数据和格式
  5. 展示使用示例

Execution Steps

执行步骤

Step 1: Gather Command Requirements

步骤1:收集命令需求

Ask user:
  • Command name (kebab-case, without /nav: prefix)
    • Example: "marker", "compact", "update-doc"
  • Command purpose (one sentence description)
    • Example: "Create context markers to save conversation state"
  • Command complexity:
    • Simple: Single action, minimal steps (e.g., marker)
    • Medium: Multiple steps, some logic (e.g., compact)
    • Complex: Multi-phase execution, integrations (e.g., init, start)
  • User-facing or internal?
    • User-facing: Part of standard Navigator workflow
    • Internal: For plugin development/maintenance
询问用户:
  • 命令名称(kebab-case格式,无需/nav:前缀)
    • 示例:"marker", "compact", "update-doc"
  • 命令用途(一句话描述)
    • 示例:"创建上下文标记以保存对话状态"
  • 命令复杂度
    • 简单:单一操作,步骤极少(如marker)
    • 中等:多步骤,包含部分逻辑(如compact)
    • 复杂:多阶段执行,包含集成操作(如init、start)
  • 面向用户还是内部使用
    • 面向用户:属于Navigator标准工作流的一部分
    • 内部使用:用于插件开发/维护

Step 2: Analyze Similar Commands

步骤2:分析相似命令

Use Task agent to find similar commands:
"Find existing Navigator commands similar to [purpose]:
 - Commands in commands/*.md
 - Similar complexity level
 - Common structure patterns
 - Return 2-3 best examples"
What to extract from examples:
  • Section structure (What This Does, When to Use, etc.)
  • Tone and style (conversational, 2nd person)
  • Emoji usage patterns
  • Example format
  • Troubleshooting patterns
使用Task agent查找相似命令:
"Find existing Navigator commands similar to [purpose]:
 - Commands in commands/*.md
 - Similar complexity level
 - Common structure patterns
 - Return 2-3 best examples"
从示例中提取的内容
  • 章节结构(功能说明、使用时机等)
  • 语气和风格(口语化、第二人称)
  • 表情符号使用模式
  • 示例格式
  • 故障排查模式

Step 3: Design Command Structure

步骤3:设计命令结构

Based on complexity level:
Simple commands:
- YAML frontmatter (description)
- Title
- What This Does (2-3 sentences)
- Usage (basic syntax + examples)
- When to Use (2-3 scenarios)
- Expected Output
- Troubleshooting (2-3 common issues)
- Closing statement
Medium commands:
- YAML frontmatter
- Title + overview
- What This Does (detailed explanation)
- When to Use (5-6 scenarios with examples)
- Usage / Execution Steps
- Output Format
- Integration notes (if applicable)
- Troubleshooting (4-5 issues)
- Best Practices
- Closing statement
Complex commands:
- YAML frontmatter
- Title + comprehensive overview
- What This Does (with comparisons)
- Execution Plan (multi-step)
- Pre-flight checks
- Step-by-step implementation
- Validation steps
- Integration with PM tools (if applicable)
- Success criteria
- Troubleshooting (comprehensive)
- Edge cases
- Performance notes
- Closing statement
根据复杂度级别设计:
简单命令
- YAML前置元数据(描述)
- 标题
- 功能说明(2-3句话)
- 使用方法(基本语法+示例)
- 使用时机(2-3种场景)
- 预期输出
- 故障排查(2-3个常见问题)
- 结束语
中等命令
- YAML前置元数据
- 标题+概述
- 功能说明(详细解释)
- 使用时机(5-6种带示例的场景)
- 使用方法/执行步骤
- 输出格式
- 集成说明(如适用)
- 故障排查(4-5个问题)
- 最佳实践
- 结束语
复杂命令
- YAML前置元数据
- 标题+全面概述
- 功能说明(包含对比)
- 执行计划(多步骤)
- 预检检查
- 分步实现
- 验证步骤
- 与PM工具集成(如适用)
- 成功标准
- 故障排查(全面)
- 边缘情况
- 性能说明
- 结束语

Step 4: Generate Command File

步骤4:生成命令文件

Use predefined function:
functions/command_generator.py
python
undefined
使用预定义函数
functions/command_generator.py
python
undefined

Generates command markdown following Navigator conventions

Generates command markdown following Navigator conventions

generate_command( name="[command-name]", description="[one-line purpose]", complexity="simple|medium|complex", sections={ "what_this_does": "...", "when_to_use": [...], "usage": "...", "execution_steps": [...], "troubleshooting": [...] } )

**File location**: `commands/[command-name].md`

**Structure**:
1. YAML frontmatter with description
2. Title (# Command Name - Navigator Context)
3. Overview paragraph (what user is doing)
4. Content sections (based on complexity)
5. Closing statement (emoji + key takeaway)
generate_command( name="[command-name]", description="[one-line purpose]", complexity="simple|medium|complex", sections={ "what_this_does": "...", "when_to_use": [...], "usage": "...", "execution_steps": [...], "troubleshooting": [...] } )

**文件位置**:`commands/[command-name].md`

**结构**:
1. 带描述的YAML前置元数据
2. 标题(# 命令名称 - Navigator上下文)
3. 概述段落(用户正在执行的操作)
4. 内容章节(基于复杂度)
5. 结束语(表情符号+核心要点)

Step 5: Validate Generated Command

步骤5:验证生成的命令

Use predefined function:
functions/command_validator.py
Checks:
  • YAML frontmatter is valid
  • Description field exists and is clear
  • Markdown structure is correct
  • All sections have content
  • Code blocks are properly formatted
  • Examples are realistic
  • Troubleshooting addresses real issues
  • Tone matches Navigator style (conversational, helpful)
  • Emoji usage is consistent with other commands
  • File name matches command name (kebab-case)
使用预定义函数
functions/command_validator.py
检查项:
  • YAML前置元数据有效
  • 描述字段存在且清晰
  • Markdown结构正确
  • 所有章节均有内容
  • 代码块格式正确
  • 示例符合实际
  • 故障排查覆盖真实问题
  • 语气匹配Navigator风格(口语化、有帮助)
  • 表情符号使用与其他命令一致
  • 文件名与命令名称匹配(kebab-case格式)

Step 6: Show Usage Example

步骤6:展示使用示例

Display:
✅ Slash Command Created: /nav:[command-name]

File: commands/[command-name].md
Lines: [count]
Complexity: [simple/medium/complex]

Try it:
/nav:[command-name]

What it does:
[brief description]

Next steps:
1. Test the command manually
2. Update plugin documentation if public-facing
3. Add to CLAUDE.md command list if needed

显示:
✅ Slash Command Created: /nav:[command-name]

File: commands/[command-name].md
Lines: [count]
Complexity: [simple/medium/complex]

Try it:
/nav:[command-name]

What it does:
[brief description]

Next steps:
1. Test the command manually
2. Update plugin documentation if public-facing
3. Add to CLAUDE.md command list if needed

Example Workflows

示例工作流

Example 1: Simple Command

示例1:简单命令

User: "Add a slash command for showing Navigator version"
Execution:
  1. Gather requirements:
    Name: version
    Purpose: Display current Navigator plugin version
    Complexity: Simple
    Type: User-facing
  2. Analyze similar (via Task agent):
    Found similar: marker.md (simple, informational)
    Pattern: Short description → Usage → When to use → Output
  3. Design structure:
    - Frontmatter
    - Title: "Navigator Version Info"
    - What This Does: 1 paragraph
    - Usage: Basic syntax
    - When to Use: 2-3 scenarios
    - Output Format: Example
    - Closing statement
  4. Generate:
    commands/version.md
    markdown
    ---
    description: Display Navigator plugin version and system info
    ---
    
    # Navigator Version Info
    
    Check which version of Navigator you're running.
    
    ## What This Does
    
    Displays the current Navigator plugin version, Claude Code version, and system configuration.
    
    ## Usage
    
    ```bash
    /nav:version

    When to Use

    Reporting issues:
    • Include version info in bug reports
    • Help maintainers reproduce issues
    Checking updates:
    • See if you're on latest version
    • Compare with marketplace version
    System diagnostics:
    • Verify plugin installed correctly
    • Check configuration loaded

    Output Format

    Navigator Plugin
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    Version: 2.2.0
    Installed: /Users/you/.claude/plugins/jitd
    Config: .agent/.nav-config.json
    
    System:
    - Claude Code: 1.5.0
    - Project: /Users/you/project
    - Platform: darwin
    Keep your Navigator up to date for latest features 🚀
    undefined
  5. Validate: ✅ All checks pass
  6. Show usage:
    ✅ Slash Command Created: /nav:version
    
    File: commands/version.md
    Lines: 45
    Complexity: Simple
    
    Try it: /nav:version
用户:"Add a slash command for showing Navigator version"
执行过程
  1. 收集需求
    Name: version
    Purpose: Display current Navigator plugin version
    Complexity: Simple
    Type: User-facing
  2. 分析相似命令(通过Task agent):
    Found similar: marker.md (simple, informational)
    Pattern: Short description → Usage → When to use → Output
  3. 设计结构
    - Frontmatter
    - Title: "Navigator Version Info"
    - What This Does: 1 paragraph
    - Usage: Basic syntax
    - When to Use: 2-3 scenarios
    - Output Format: Example
    - Closing statement
  4. 生成
    commands/version.md
    markdown
    ---
    description: Display Navigator plugin version and system info
    ---
    
    # Navigator Version Info
    
    Check which version of Navigator you're running.
    
    ## What This Does
    
    Displays the current Navigator plugin version, Claude Code version, and system configuration.
    
    ## Usage
    
    ```bash
    /nav:version

    When to Use

    Reporting issues:
    • Include version info in bug reports
    • Help maintainers reproduce issues
    Checking updates:
    • See if you're on latest version
    • Compare with marketplace version
    System diagnostics:
    • Verify plugin installed correctly
    • Check configuration loaded

    Output Format

    Navigator Plugin
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    Version: 2.2.0
    Installed: /Users/you/.claude/plugins/jitd
    Config: .agent/.nav-config.json
    
    System:
    - Claude Code: 1.5.0
    - Project: /Users/you/project
    - Platform: darwin
    Keep your Navigator up to date for latest features 🚀
    undefined
  5. 验证:✅ 所有检查项通过
  6. 展示使用示例
    ✅ Slash Command Created: /nav:version
    
    File: commands/version.md
    Lines: 45
    Complexity: Simple
    
    Try it: /nav:version

Example 2: Medium Command

示例2:中等命令

User: "Create a command for archiving old task documentation"
Execution:
  1. Gather requirements:
    Name: archive-tasks
    Purpose: Move completed tasks to archive directory
    Complexity: Medium (file operations, validation)
    Type: User-facing
  2. Analyze similar:
    Found: markers.md (file management, user selection)
    Found: compact.md (multi-step process)
    Pattern: Overview → Execution Plan → Steps → Validation
  3. Design structure:
    - Frontmatter
    - Title + overview
    - What This Does (comparison with manual approach)
    - When to Use (5 scenarios)
    - Execution Plan (Step 1-4)
    - Output Format
    - Troubleshooting (4 issues)
    - Best Practices
    - Closing
  4. Generate:
    commands/archive-tasks.md
    (full content)
  5. Validate: ✅ All checks pass
  6. Show usage: Command ready to use

用户:"Create a command for archiving old task documentation"
执行过程
  1. 收集需求
    Name: archive-tasks
    Purpose: Move completed tasks to archive directory
    Complexity: Medium (file operations, validation)
    Type: User-facing
  2. 分析相似命令
    Found: markers.md (file management, user selection)
    Found: compact.md (multi-step process)
    Pattern: Overview → Execution Plan → Steps → Validation
  3. 设计结构
    - Frontmatter
    - Title + overview
    - What This Does (comparison with manual approach)
    - When to Use (5 scenarios)
    - Execution Plan (Step 1-4)
    - Output Format
    - Troubleshooting (4 issues)
    - Best Practices
    - Closing
  4. 生成
    commands/archive-tasks.md
    (完整内容)
  5. 验证:✅ 所有检查项通过
  6. 展示使用示例:命令已可使用

Output Format

输出格式

After generating command, show:
✅ Slash Command Created: /nav:[name]

Structure:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📄 commands/[name].md

Sections:
✅ YAML frontmatter
✅ Title and overview
✅ What This Does
✅ When to Use ([N] scenarios)
✅ Usage / Execution Plan
✅ [Additional sections based on complexity]
✅ Troubleshooting
✅ Closing statement
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Command: /nav:[name]
Purpose: [brief description]
Lines: [count]

Test it:
/nav:[name]

Documentation:
- Add to README.md if user-facing
- Update CLAUDE.md command list
- Add to plugin.json if needed

生成命令后显示
✅ Slash Command Created: /nav:[name]

Structure:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📄 commands/[name].md

Sections:
✅ YAML frontmatter
✅ Title and overview
✅ What This Does
✅ When to Use ([N] scenarios)
✅ Usage / Execution Plan
✅ [Additional sections based on complexity]
✅ Troubleshooting
✅ Closing statement
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Command: /nav:[name]
Purpose: [brief description]
Lines: [count]

Test it:
/nav:[name]

Documentation:
- Add to README.md if user-facing
- Update CLAUDE.md command list
- Add to plugin.json if needed

Best Practices

最佳实践

Command Naming

命令命名

  • Use kebab-case (marker, update-doc, archive-tasks)
  • Be specific but concise (not too generic, not too verbose)
  • Match feature purpose (nav:compact for compacting)
  • Avoid abbreviations unless very common
  • 使用kebab-case格式(marker、update-doc、archive-tasks)
  • 具体但简洁(不要太通用,也不要太冗长)
  • 匹配功能用途(nav:compact用于压缩操作)
  • 除非非常通用,否则避免使用缩写

Description Writing

描述撰写

  • One sentence, clear purpose
  • Action-oriented ("Create", "Display", "Update")
  • Mention key benefit or what it does
  • Under 100 characters
  • 一句话,清晰说明用途
  • 以动作开头(“Create”“Display”“Update”)
  • 提及核心优势或功能
  • 不超过100个字符

Content Structure

内容结构

  • Start with user perspective ("You are...")
  • Use 2nd person ("your task", "you can")
  • Include realistic examples
  • Show expected output
  • Address common issues in troubleshooting
  • 从用户视角出发(“You are...”)
  • 使用第二人称(“your task”“you can”)
  • 包含符合实际的示例
  • 展示预期输出
  • 在故障排查中覆盖常见问题

Tone and Style

语气和风格

  • Conversational and helpful
  • Use emojis for visual markers (✅❌📖🚀)
  • Bold key terms and actions
  • Code blocks for all commands/output
  • Bullet lists for readability
  • 口语化且有帮助
  • 使用表情符号作为视觉标记(✅❌📖🚀)
  • 加粗关键术语和操作
  • 所有命令/输出使用代码块
  • 使用项目符号列表提升可读性

Examples Quality

示例质量

  • Real-world scenarios (not toy examples)
  • Show before/after when relevant
  • Include expected output
  • Cover common use cases
  • Demonstrate Navigator benefits
  • 真实场景(而非玩具示例)
  • 相关时展示前后对比
  • 包含预期输出
  • 覆盖常见使用场景
  • 展示Navigator的优势

Troubleshooting Section

故障排查章节

  • Address real issues users might encounter
  • Provide specific solutions (not generic advice)
  • Include verification commands
  • Link to related docs if helpful

  • 覆盖用户可能遇到的真实问题
  • 提供具体解决方案(而非通用建议)
  • 包含验证命令
  • 如有帮助,链接到相关文档

Common Command Patterns

常见命令模式

Informational Commands

信息类命令

Pattern: Simple structure, quick output Examples: version, status, list Sections: Description → Usage → Output
模式:结构简单,输出快速 示例:version、status、list 章节:描述 → 使用方法 → 输出

Action Commands

动作类命令

Pattern: Execute something, show result Examples: marker, compact, archive Sections: Description → Execution → Validation → Result
模式:执行操作,展示结果 示例:marker、compact、archive 章节:描述 → 执行 → 验证 → 结果

Setup/Configuration Commands

设置/配置类命令

Pattern: Multi-step process, checks Examples: init, migrate, setup Sections: Pre-flight → Steps → Validation → Troubleshooting
模式:多步骤流程,包含检查 示例:init、migrate、setup 章节:预检 → 步骤 → 验证 → 故障排查

Management Commands

管理类命令

Pattern: User selection, operations, feedback Examples: markers (list/load), tasks (list/select) Sections: Overview → Modes → Operations → Results

模式:用户选择、操作、反馈 示例:markers(列表/加载)、tasks(列表/选择) 章节:概述 → 模式 → 操作 → 结果

Troubleshooting

故障排查

Generated Command Too Short

生成的命令过短

Problem: Command content is sparse, missing sections
Solutions:
  1. Increase complexity level (simple → medium)
  2. Add more scenarios to "When to Use"
  3. Expand troubleshooting section (more common issues)
  4. Add Best Practices section
  5. Include more examples
问题:命令内容稀疏,缺少章节
解决方案
  1. 提升复杂度级别(简单→中等)
  2. 为“使用时机”添加更多场景
  3. 扩展故障排查章节(增加更多常见问题)
  4. 添加最佳实践章节
  5. 包含更多示例

Command Doesn't Match Navigator Style

命令不符合Navigator风格

Problem: Tone or structure feels off
Solutions:
  1. Re-analyze example commands (marker.md, compact.md)
  2. Check emoji usage (should match existing patterns)
  3. Verify 2nd person perspective ("You are...")
  4. Ensure conversational tone (not technical manual)
  5. Add personality to closing statement
问题:语气或结构不符合要求
解决方案
  1. 重新分析示例命令(marker.md、compact.md)
  2. 检查表情符号使用(应与现有模式匹配)
  3. 验证第二人称视角(“You are...”)
  4. 确保语气口语化(而非技术手册风格)
  5. 为结束语添加个性

YAML Validation Fails

YAML验证失败

Problem: Invalid frontmatter
Solutions:
  1. Check YAML syntax (proper indentation)
  2. Ensure
    description
    field exists
  3. Verify no special characters break parsing
  4. Test with:
    python -c "import yaml; yaml.safe_load(open('commands/[name].md').read().split('---')[1])"
问题:前置元数据无效
解决方案
  1. 检查YAML语法(正确缩进)
  2. 确保
    description
    字段存在
  3. 验证没有特殊字符破坏解析
  4. 使用以下命令测试:
    python -c "import yaml; yaml.safe_load(open('commands/[name].md').read().split('---')[1])"

Examples Are Too Generic

示例过于通用

Problem: Examples don't feel realistic
Solutions:
  1. Base examples on actual Navigator usage
  2. Use real file paths (not /path/to/file)
  3. Show actual output format (not [output here])
  4. Include context (why user would run this)

问题:示例不符合实际
解决方案
  1. 基于实际Navigator使用场景构建示例
  2. 使用真实文件路径(而非/path/to/file)
  3. 展示实际输出格式(而非[output here])
  4. 包含上下文(用户为何要执行此命令)

Success Criteria

成功标准

This skill succeeds when:
  • Generated command file is syntactically valid
  • YAML frontmatter passes validation
  • All required sections present
  • Tone matches Navigator style (conversational, helpful)
  • Examples are realistic and useful
  • Troubleshooting addresses real issues
  • Command can be invoked in Claude Code
  • Minimal manual editing needed (<10% of content)

The plugin-slash-command skill automates Navigator command creation, ensuring consistency and saving development time 🔧
当满足以下条件时,此技能成功
  • 生成的命令文件语法有效
  • YAML前置元数据通过验证
  • 所有必需章节齐全
  • 语气匹配Navigator风格(口语化、有帮助)
  • 示例符合实际且有用
  • 故障排查覆盖真实问题
  • 命令可在Claude Code中调用
  • 所需手动编辑极少(<10%内容)

plugin-slash-command技能可自动创建Navigator命令,确保一致性并节省开发时间 🔧