Custom Slash Commands and Skills: Worked Example — Claude Code Configuration & Workflows (Claude Certified Architect)
Custom Slash Commands and Skills: A Worked Example In the Claude Certified Architect - Foundation certification, mastering custom slash commands and...
Custom Slash Commands and Skills: A Worked Example
In the Claude Certified Architect - Foundation certification, mastering custom slash commands and skills within Claude Code workflows is essential for creating efficient, modular, and scalable team applications. This worked example demonstrates how to design, configure, and implement custom commands and skills tailored to a realistic project scenario, illustrating the reasoning and step-by-step process.
Scenario Overview
Imagine a team developing a customer support assistant that automates ticket categorization and suggests relevant knowledge base articles. The goal is to create custom slash commands that allow team members to trigger specific tasks, such as /categorize_ticket and /suggest_articles, and to encapsulate reusable logic as skills for maintainability and extensibility.
Step 1: Define Project Memory and Instruction Files
Begin by organizing project memory files to provide context and instructions for the commands and skills. Use a modular hierarchy:
- memory/global_instructions.txt: Contains overall assistant guidelines and tone.
- memory/ticket_categorization.txt: Defines categories and rules.
- memory/article_suggestions.txt: Lists knowledge base metadata and retrieval criteria.
This separation ensures clarity and ease of updates.
Step 2: Create Custom Slash Commands
In the commands/ directory, define the slash commands with clear naming conventions and parameters:
- /categorize_ticket: Accepts ticket text input and returns a category label.
- /suggest_articles: Accepts ticket category and returns a ranked list of articles.
Each command file includes prompt templates that reference relevant memory files to provide context.
Step 3: Develop Skills for Reusable Logic
Skills encapsulate complex logic that multiple commands might share. For example, create a skills/text_classification.skill that implements the ticket categorization algorithm, and a skills/article_ranking.skill for ranking articles based on relevance.
Skills are invoked within command prompts using Claude Code’s skill invocation syntax, enabling modularity and easier maintenance.
Step 4: Apply Path-Specific Conventions and Iterative Refinement
Organize commands and skills in directories reflecting their function and usage frequency. Use iterative refinement by testing commands with sample tickets, adjusting prompt wording, and refining skill parameters to improve accuracy.
Worked Example: Implementing /categorize_ticket
- Design prompt template: Reference memory/ticket_categorization.txt to instruct Claude on category definitions.
- Invoke skill: Use text_classification.skill to analyze input text.
- Test: Run the command with sample ticket text, observe output.
- Refine: Adjust prompt instructions or skill parameters based on test results.
Step 5: Integrate with CI/CD Pipelines
To ensure reliability, integrate Claude Code commands and skills into CI/CD workflows:
- Automate testing of commands with predefined inputs and expected outputs.
- Use linting tools to enforce prompt and skill syntax conventions.
- Deploy updated commands and skills automatically upon passing tests.
This integration supports continuous improvement and team collaboration.
Summary
By methodically defining project memory, creating custom slash commands, encapsulating reusable logic in skills, and integrating iterative refinement and CI/CD practices, Claude Certified Architects can build robust, maintainable Claude Code workflows. This worked example highlights practical steps to configure and implement custom commands and skills tailored to team needs.
More in this topic
Ready to test your knowledge?
Put what you've learned into practice with a quick quiz and track your progress.
Test your knowledge →