Lesson 20Automation

Skills & Commands

Slash commands

Slash Commands

Slash commands (/command) are quick actions called by name:

/helpShow help
/clearClear history
/compactCompress context
/modelSwitch model
/costShow usage
/memoryAdd to memory
Creating Custom Commands (SKILL.md)

Create a .claude/skills/SKILL_NAME.md file for your command:

---
name: pr
description: Create a pull request for current changes
arguments:
  - name: title
    description: PR title
    required: true
  - name: base
    description: Base branch
    default: main
---

Create a pull request with the following:
- Title: $1
- Base branch: $2
- Include all uncommitted changes
- Write a detailed description based on the changes

Steps:
1. Commit any uncommitted changes with a good message
2. Push the current branch
3. Create PR using gh cli
4. Return the PR URL
# Usage:
> /pr "Fix authentication bug" develop
Command Arguments

Commands can accept arguments via $1, $2 or $ARGUMENTS:

$ARGUMENTSAll arguments as string
$1, $2, $3...Positional arguments
default: valueDefault value in YAML
Agent Skills (Automatic)

Agent skills are called automatically by Claude when the task matches the description:

---
name: security-audit
description: Run security audit on the codebase
agent: true
model: sonnet
tools:
  - Read
  - Grep
  - Glob
---

You are a security auditor. Scan the codebase for:
1. SQL injection vulnerabilities
2. XSS vulnerabilities
3. Hardcoded secrets
4. Authentication issues

For each issue found, report:
- File and line number
- Vulnerability type
- Risk level
- Suggested fix

With agent: true the command runs as a sub-agent with isolated context

Skill vs Agent Skill

Skill (agent: false)

  • Called by user via /command
  • Executes in main context
  • Sees full history

Agent Skill (agent: true)

  • Can be called automatically
  • Isolated context
  • Can specify model and tools
Skill Scoping
.claude/skills/For current project
~/.claude/skills/For all projects

Command Ideas

  • /deploy— deploy current branch
  • /test-file— write tests for file
  • /review— code review current changes
  • /migrate— create DB migration

Lesson Quiz

1 of 1

1.What are skills (slash commands) in Claude Code?

This lesson is part of a structured LLM course.

My Learning Path