skills/dnyoussef/when-creating-slash-commands-use-slash-command-encoder/SKILL.md
Create ergonomic slash commands for fast access to micro-skills with auto-discovery and parameter validation
npx skillsauth add aiskillstore/marketplace when-creating-slash-commands-use-slash-command-encoderInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create ergonomic slash commands (/command) for fast, unambiguous access to micro-skills with auto-discovery, intelligent routing, parameter validation, and command chaining.
Role: Command implementation and handler logic Responsibilities:
Role: Generate command templates and boilerplate Responsibilities:
Design command syntax, parameters, and behavior specifications.
# 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
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
# Store command definition
npx claude-flow@alpha memory store \
--key "commands/analyze/schema" \
--file command-schema.json
Implement command handler with validation, routing, and execution logic.
# 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
// 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);
}
};
Validate command functionality with comprehensive testing.
# 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
// 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);
});
});
Create comprehensive documentation for command usage.
# 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
# /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
Returns analysis report with:
/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
# 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
Symptoms: Command not recognized
Solution: Run command install and verify registry
Symptoms: Unexpected validation errors Solution: Check parameter types and validation rules
Symptoms: Command hangs Solution: Add timeout handling, check agent availability
development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.