when-creating-slash-commands-use-slash-command-encoder

Create ergonomic slash commands for fast access to micro-skills with auto-discovery and parameter validation

242 stars

Best use case

when-creating-slash-commands-use-slash-command-encoder is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Create ergonomic slash commands for fast access to micro-skills with auto-discovery and parameter validation

Create ergonomic slash commands for fast access to micro-skills with auto-discovery and parameter validation

Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.

Practical example

Example input

Use the "when-creating-slash-commands-use-slash-command-encoder" skill to help with this workflow task. Context: Create ergonomic slash commands for fast access to micro-skills with auto-discovery and parameter validation

Example output

A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.

When to use this skill

  • Use this skill when you want a reusable workflow rather than writing the same prompt again and again.

When not to use this skill

  • Do not use this when you only need a one-off answer and do not need a reusable workflow.
  • Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/when-creating-slash-commands-use-slash-command-encoder/SKILL.md --create-dirs "https://raw.githubusercontent.com/aiskillstore/marketplace/main/skills/dnyoussef/when-creating-slash-commands-use-slash-command-encoder/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/when-creating-slash-commands-use-slash-command-encoder/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How when-creating-slash-commands-use-slash-command-encoder Compares

Feature / Agentwhen-creating-slash-commands-use-slash-command-encoderStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Create ergonomic slash commands for fast access to micro-skills with auto-discovery and parameter validation

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Slash Command Encoder SOP

## Overview

Create ergonomic slash commands (/command) for fast, unambiguous access to micro-skills with auto-discovery, intelligent routing, parameter validation, and command chaining.

## Agents & Responsibilities

### coder
**Role:** Command implementation and handler logic
**Responsibilities:**
- Implement command handlers
- Create validation logic
- Build routing mechanisms
- Test command functionality

### base-template-generator
**Role:** Generate command templates and boilerplate
**Responsibilities:**
- Create command templates
- Generate documentation
- Build example commands
- Create test scaffolding

## Phase 1: Design Command Interface

### Objective
Design command syntax, parameters, and behavior specifications.

### Scripts

```bash
# Generate command template
npx claude-flow@alpha command template \
  --name "analyze" \
  --description "Analyze codebase for patterns" \
  --output commands/analyze.js

# Define command schema
cat > command-schema.json <<EOF
{
  "name": "analyze",
  "alias": "a",
  "description": "Analyze codebase for patterns",
  "parameters": [
    {
      "name": "path",
      "type": "string",
      "required": true,
      "description": "Path to analyze"
    },
    {
      "name": "depth",
      "type": "number",
      "required": false,
      "default": 3,
      "description": "Analysis depth"
    }
  ],
  "examples": [
    "/analyze ./src",
    "/analyze ./src --depth 5"
  ]
}
EOF

# Validate schema
npx claude-flow@alpha command validate --schema command-schema.json
```

### Command Design Patterns

**Simple Command:**
```
/deploy
```

**Command with Arguments:**
```
/analyze ./src
```

**Command with Flags:**
```
/test --watch --coverage
```

**Command with Subcommands:**
```
/git commit -m "message"
/git push origin main
```

### Memory Patterns

```bash
# Store command definition
npx claude-flow@alpha memory store \
  --key "commands/analyze/schema" \
  --file command-schema.json
```

## Phase 2: Generate Command Code

### Objective
Implement command handler with validation, routing, and execution logic.

### Scripts

```bash
# Generate command handler
npx claude-flow@alpha command generate \
  --schema command-schema.json \
  --output commands/analyze-handler.js

# Implement validation logic
npx claude-flow@alpha command add-validation \
  --command analyze \
  --rules validation-rules.json

# Add routing logic
npx claude-flow@alpha command add-routing \
  --command analyze \
  --route-to "task-orchestrator"

# Build command registry
npx claude-flow@alpha command registry build \
  --commands ./commands \
  --output command-registry.json
```

### Command Handler Template

```javascript
// commands/analyze-handler.js
module.exports = {
  name: 'analyze',
  alias: 'a',
  description: 'Analyze codebase for patterns',

  parameters: [
    {
      name: 'path',
      type: 'string',
      required: true,
      validate: (value) => {
        if (!fs.existsSync(value)) {
          throw new Error(`Path not found: ${value}`);
        }
        return true;
      }
    },
    {
      name: 'depth',
      type: 'number',
      required: false,
      default: 3,
      validate: (value) => {
        if (value < 1 || value > 10) {
          throw new Error('Depth must be between 1 and 10');
        }
        return true;
      }
    }
  ],

  async execute(args) {
    const { path, depth } = args;

    // Validate parameters
    this.validateParameters(args);

    // Route to appropriate agent
    const result = await this.routeToAgent('code-analyzer', {
      action: 'analyze',
      path,
      depth
    });

    return result;
  },

  validateParameters(args) {
    for (const param of this.parameters) {
      const value = args[param.name];

      if (param.required && value === undefined) {
        throw new Error(`Required parameter missing: ${param.name}`);
      }

      if (value !== undefined && param.validate) {
        param.validate(value);
      }
    }
  },

  async routeToAgent(agentType, payload) {
    // Implementation of agent routing
    return await claudeFlow.agent.execute(agentType, payload);
  }
};
```

## Phase 3: Test Command

### Objective
Validate command functionality with comprehensive testing.

### Scripts

```bash
# Test command registration
npx claude-flow@alpha command test-register --command analyze

# Test parameter validation
npx claude-flow@alpha command test \
  --command analyze \
  --input '{"path": "./src", "depth": 3}'

# Test error handling
npx claude-flow@alpha command test \
  --command analyze \
  --input '{"path": "./nonexistent"}' \
  --expect-error

# Run integration tests
npx claude-flow@alpha command test-suite \
  --commands ./commands \
  --output test-results.json
```

### Test Cases

```javascript
// tests/analyze-command.test.js
describe('analyze command', () => {
  it('should validate required parameters', async () => {
    await expect(
      commands.analyze.execute({})
    ).rejects.toThrow('Required parameter missing: path');
  });

  it('should validate path exists', async () => {
    await expect(
      commands.analyze.execute({ path: './nonexistent' })
    ).rejects.toThrow('Path not found');
  });

  it('should use default depth', async () => {
    const result = await commands.analyze.execute({ path: './src' });
    expect(result.config.depth).toBe(3);
  });

  it('should accept custom depth', async () => {
    const result = await commands.analyze.execute({
      path: './src',
      depth: 5
    });
    expect(result.config.depth).toBe(5);
  });
});
```

## Phase 4: Document Usage

### Objective
Create comprehensive documentation for command usage.

### Scripts

```bash
# Generate command documentation
npx claude-flow@alpha command docs \
  --command analyze \
  --output docs/commands/analyze.md

# Generate help text
npx claude-flow@alpha command help-text \
  --command analyze \
  --output commands/analyze-help.txt

# Build command catalog
npx claude-flow@alpha command catalog \
  --all \
  --output docs/command-catalog.md

# Generate usage examples
npx claude-flow@alpha command examples \
  --command analyze \
  --count 5 \
  --output docs/examples/analyze-examples.md
```

### Documentation Template

```markdown
# /analyze Command

## Description
Analyze codebase for patterns, complexity, and improvement opportunities.

## Syntax
```
/analyze <path> [--depth <number>]
```

## Parameters

### path (required)
- Type: string
- Description: Path to analyze
- Example: `./src`, `./components`

### --depth (optional)
- Type: number
- Default: 3
- Range: 1-10
- Description: Analysis depth level

## Examples

```bash
# Basic usage
/analyze ./src

# With custom depth
/analyze ./src --depth 5

# Analyze specific directory
/analyze ./components --depth 2
```

## Output

Returns analysis report with:
- Complexity metrics
- Pattern detection results
- Improvement recommendations
- File statistics

## Related Commands

- `/test` - Run tests on analyzed code
- `/optimize` - Apply optimization recommendations
- `/refactor` - Refactor based on analysis
```

## Phase 5: Deploy Command

### Objective
Install command to system and verify functionality.

### Scripts

```bash
# Build command package
npx claude-flow@alpha command build \
  --commands ./commands \
  --output dist/commands.bundle.js

# Install to system
npx claude-flow@alpha command install \
  --from dist/commands.bundle.js \
  --global

# Verify installation
npx claude-flow@alpha command list --installed

# Test installed command
npx claude-flow@alpha analyze ./src --depth 3

# Update command registry
npx claude-flow@alpha command registry update

# Generate shell completions
npx claude-flow@alpha command completions \
  --shell bash \
  --output ~/.bash_completion.d/claude-flow-commands
```

### Installation Validation

```bash
# Check command is registered
if npx claude-flow@alpha command exists analyze; then
  echo "✓ Command installed successfully"
else
  echo "✗ Command installation failed"
  exit 1
fi

# Test command execution
RESULT=$(npx claude-flow@alpha analyze ./src)
if [ $? -eq 0 ]; then
  echo "✓ Command execution successful"
else
  echo "✗ Command execution failed"
  exit 1
fi
```

## Success Criteria

- [ ] Command interface designed
- [ ] Handler implemented
- [ ] Tests passing
- [ ] Documentation complete
- [ ] Command deployed

### Performance Targets
- Command registration: <100ms
- Parameter validation: <50ms
- Command execution: <2s
- Help text generation: <100ms

## Best Practices

1. **Clear Naming:** Use descriptive command names
2. **Parameter Validation:** Validate all inputs
3. **Error Messages:** Provide helpful error messages
4. **Documentation:** Include examples and usage
5. **Testing:** Comprehensive test coverage
6. **Versioning:** Version commands properly
7. **Backwards Compatibility:** Maintain compatibility
8. **Auto-Discovery:** Support command discovery

## Common Issues & Solutions

### Issue: Command Not Found
**Symptoms:** Command not recognized
**Solution:** Run `command install` and verify registry

### Issue: Parameter Validation Fails
**Symptoms:** Unexpected validation errors
**Solution:** Check parameter types and validation rules

### Issue: Command Execution Timeout
**Symptoms:** Command hangs
**Solution:** Add timeout handling, check agent availability

## Integration Points

- **micro-skills:** Commands trigger micro-skills
- **task-orchestrator:** Route to orchestrator
- **memory-coordinator:** Store command history

## References

- CLI Design Patterns
- Command Interface Best Practices
- Parameter Validation Techniques

Related Skills

routeros-command-tree

242
from aiskillstore/marketplace

RouterOS command tree introspection via /console/inspect API. Use when: building tools that parse RouterOS commands, generating API schemas from RouterOS, working with /console/inspect, mapping CLI commands to REST verbs, traversing the RouterOS command hierarchy, or when the user mentions inspect, command tree, RAML, or OpenAPI generation for RouterOS.

command-creator

242
from aiskillstore/marketplace

This skill should be used when creating a Claude Code slash command. Use when users ask to "create a command", "make a slash command", "add a command", or want to document a workflow as a reusable command. Essential for creating optimized, agent-executable slash commands with proper structure and best practices.

pentest-commands

242
from aiskillstore/marketplace

This skill should be used when the user asks to "run pentest commands", "scan with nmap", "use metasploit exploits", "crack passwords with hydra or john", "scan web vulnerabilities with nikto", "enumerate networks", or needs essential penetration testing command references.

command-management

242
from aiskillstore/marketplace

Use PROACTIVELY this skill when you need to create or update custom commands following best practices

when-verifying-quality-use-verification-quality

242
from aiskillstore/marketplace

Comprehensive quality verification and validation through static analysis, dynamic testing, integration validation, and certification gates

when-validating-code-works-use-functionality-audit

242
from aiskillstore/marketplace

Validates that code actually works through sandbox testing, execution verification, and systematic debugging. Use this skill after code generation or modification to ensure functionality is genuine rather than assumed. The skill creates isolated test environments, executes code with realistic inputs, identifies bugs through systematic analysis, and applies best practices to fix issues without breaking existing functionality.

when-using-flow-nexus-platform-use-flow-nexus-platform

242
from aiskillstore/marketplace

Comprehensive Flow Nexus platform management covering authentication, sandboxes, storage, databases, app deployment, payments, and monitoring. This SOP provides end-to-end platform operations.

when-using-advanced-swarm-use-swarm-advanced

242
from aiskillstore/marketplace

Advanced swarm patterns with dynamic topology switching and self-organizing behaviors for complex multi-agent coordination

when-training-neural-networks-use-flow-nexus-neural

242
from aiskillstore/marketplace

This SOP provides a systematic workflow for training and deploying neural networks using Flow Nexus platform with distributed E2B sandboxes. It covers architecture selection, distributed training, ...

when-setting-network-security-use-network-security-setup

242
from aiskillstore/marketplace

Configure Claude Code sandbox network isolation with trusted domains, custom access policies, and environment variables for secure network communication.

when-reviewing-pull-request-orchestrate-comprehensive-code-revie

242
from aiskillstore/marketplace

Use when conducting comprehensive code review for pull requests across multiple quality dimensions. Orchestrates 12-15 specialized reviewer agents across 4 phases using star topology coordination. Covers automated checks, parallel specialized reviews (quality, security, performance, architecture, documentation), integration analysis, and final merge recommendation in a 4-hour workflow.

when-reviewing-github-pr-use-github-code-review

242
from aiskillstore/marketplace

Comprehensive GitHub pull request code review using multi-agent swarm with specialized reviewers for security, performance, style, tests, and documentation. Coordinates security-auditor, perf-analyzer, code-analyzer, tester, and reviewer agents through mesh topology for parallel analysis. Provides detailed feedback with auto-fix suggestions and merge readiness assessment. Use when reviewing PRs, conducting code audits, or ensuring code quality standards before merge.