Claude Code Skills, Plugins, Rules Files and Slash Commands
👋 In plain words: Every team repeats the same instructions to Claude Code: how to write tests, how to triage a failure, how to prepare a release. Instead of typing them each time, you package them: as a Skill Claude loads when relevant, a slash command you type, a rule for certain folders, or a plugin that bundles everything for other teams. This lesson builds each one, step by step.
The CCDV-F skill “Claude Code Customization and Extension” asks you to analyse a repeatable team workflow, choose the extension mechanism that fits (Skill, plugin, Rules file, hook, subagent or slash command), and author and package it. In this lesson you will write a Skill and see Claude Code discover it, create a custom slash command, add a path-specific rules file, learn how plugins package them for distribution, and use a decision table to pick the right mechanism.
🔑 Key terms
- Skill: a folder with a
SKILL.md(name, description, instructions) plus optional scripts and files. Claude sees the description and loads the rest when a task matches. - Slash command: a reusable prompt you invoke by typing
/namein a session. - Rules file: a Markdown file in
.claude/rules/, optionally limited to certain paths, that adds instructions. - Plugin: a package of commands, Skills, subagents, hooks and MCP servers that can be installed from a marketplace.
🪜 Step 1: Write a Skill
A Skill packages know-how. Its description is what Claude reads to decide when the Skill applies, so write it like a good tool description: what it does and when to use it.
📄 .claude/skills/flaky-test-triage/SKILL.md
---
name: flaky-test-triage
description: Triage a failing UI test to decide whether it is flaky or a real bug, using our team's checklist. Use when a Playwright or Selenium test fails intermittently.
---
# Flaky test triage
1. Rerun the test 3 times with `pytest -q -p no:randomly <test> --count=3`.
2. If it passes at least once, check waits: no fixed sleeps, wait for the exact state.
3. Check shared test data: parallel workers must not share users or carts.
4. Record the result in docs/flaky-tests.md with the date and the cause.
5. Only open a product bug if it fails 3 out of 3 times with the same error.
Claude Code lists project Skills by name and description in what it sends to the model, and loads the full instructions only when needed. (Inspecting the request in this run showed the line flaky-test-triage: Triage a failing UI test…, and the /test-plan command from Step 2 listed the same way.) Ask a matching question:
⌨️ Terminal
claude -p "test_checkout_coupon failed once on CI but passed on rerun. What should I do?" --model claude-opus-5-5🖥️ Output (sample run)
This matches the flaky-test-triage skill: rerun it 3 times, check its waits and shared test data, record the result in docs/flaky-tests.md, and open a product bug only if it fails 3 out of 3 times.
- Keep
SKILL.mdfocused; put long references and scripts in the same folder and point to them. - Skills can also live in
~/.claude/skills/(personal) or come from plugins.
🪜 Step 2: Add a custom slash command
A slash command is a prompt you trigger explicitly. Put it in .claude/commands/; the file name becomes the command. $ARGUMENTS is replaced with what you type after the command:
📄 .claude/commands/test-plan.md
---
description: Draft a test plan for a feature
---
Write a test plan for: $ARGUMENTS
Include scope, 5 positive cases, 5 negative cases, test data needs and risks.
Use one table per section. Do not invent requirements; list open questions instead.
⌨️ Terminal
claude -p "/test-plan coupon codes at checkout" --model claude-opus-5-5🖥️ Output (sample run)
Test plan: coupon codes at checkout
Scope: applying, validating and removing coupon codes on the checkout page.
(tables for positive cases, negative cases, test data and risks follow)
Open questions: can two coupons be combined? Do coupons apply to shipping?
The run shows the command file was expanded: the request contained the command’s instructions with your argument filled in. Recent Claude Code versions treat custom commands and Skills as closely related; a Skill can also be invoked directly with /skill-name.
🪜 Step 3: Add a path-specific rules file
Rules files keep CLAUDE.md short by splitting instructions by topic, and can apply only to certain paths:
📄 .claude/rules/playwright.md
---
paths:
- "tests/ui/**/*.py"
---
# Playwright rules
- Locate elements by role or data-testid, never by CSS position or XPath index.
- Use expect(...) web-first assertions; never time.sleep().
When Claude works on files under tests/ui/, these rules apply; elsewhere they stay out of context.
🪜 Step 4: Package everything as a plugin
When several repositories or teams need the same Skills, commands, subagents, hooks or MCP servers, package them as a plugin. A plugin is a folder with a manifest:
📄 qa-toolkit/.claude-plugin/plugin.json
{
"name": "qa-toolkit",
"version": "1.2.0",
"description": "Team QA workflows: flaky test triage, test plans and a read-only reviewer agent."
}
📄 qa-toolkit/README.md
qa-toolkit/
.claude-plugin/plugin.json manifest (name, version, description)
skills/flaky-test-triage/SKILL.md
commands/test-plan.md
agents/test-reviewer.md
hooks/hooks.json e.g. block edits to migrations/
.mcp.json e.g. the team's QA results server
Teams publish plugins in a marketplace (a Git repository with a catalogue) and install them with /plugin in Claude Code. Version your plugin, list its dependencies, and treat updates like any other release, because a plugin can add hooks and MCP servers that run on every user’s machine.
🪜 Step 5: Choose the right mechanism
| The workflow is… | Use | Why |
|---|---|---|
| Know-how Claude should apply when relevant (triage checklist, house style) | Skill | Loaded on demand by description; can include scripts |
| A prompt people trigger deliberately with arguments | Slash command | Explicit, repeatable, parameterised |
| Instructions for one area of the codebase | Rules file with paths |
Only in context where it applies |
| A rule that must always be enforced (block edits, run formatters) | Hook (Lesson 40) | Deterministic, not model-dependent |
| Work that needs its own context, tools or model (review, log reading) | Subagent (Lesson 40) | Isolated context and permissions |
| All of the above shared across teams and repositories | Plugin | Versioned package from a marketplace |
| A live external system (Jira, CI database) | MCP server (Module 7) | Shared integration |
This helper encodes the table for quick decisions. It runs locally:
📄 choose_extension.py
def choose(must_always_happen: bool, needs_own_context: bool, explicit_trigger: bool,
limited_to_paths: bool, shared_across_repos: bool, live_system: bool) -> str:
if live_system:
return "MCP server"
if must_always_happen:
base = "hook"
elif needs_own_context:
base = "subagent"
elif explicit_trigger:
base = "slash command"
elif limited_to_paths:
base = "rules file"
else:
base = "Skill"
return base + (" packaged in a plugin" if shared_across_repos else "")
cases = {
"Block any edit to migrations/": (True, False, False, False, False, False),
"Team checklist for flaky UI tests, used in 12 repos": (False, False, False, False, True, False),
"/release-notes command with a version argument": (False, False, True, False, False, False),
"Playwright locator rules for tests/ui only": (False, False, False, True, False, False),
"Read 300 CI logs and summarise": (False, True, False, False, False, False),
}
for name, args in cases.items():
print(f"{name:<52} -> {choose(*args)}")⌨️ Terminal
python choose_extension.py🖥️ Output
Block any edit to migrations/ -> hook
Team checklist for flaky UI tests, used in 12 repos -> Skill packaged in a plugin
/release-notes command with a version argument -> slash command
Playwright locator rules for tests/ui only -> rules file
Read 300 CI logs and summarise -> subagent
🌍 Real-world example: Ravi’s QA toolkit
Ravi’s team kept pasting the same flaky-test checklist into Claude Code. He turned it into a Skill, added /test-plan and /bug-report commands, a rules file for tests/ui/, and a hook that blocks edits to migrations/. When two other teams asked for the same setup, he packaged it as the qa-toolkit plugin in the company marketplace, versioned it, and now ships updates through it.
🧪 Practice Questions
Question 1. A team wants Claude Code to follow its 10-step release checklist whenever someone asks about preparing a release, without anyone typing a command. Which mechanism fits?
- A. A Skill whose description says when to use it
- B. A PreToolUse hook
- C. A custom slash command only
- D. An MCP server
Show answer
Answer: A. Skills are discovered from their description and loaded when a task matches.
Question 2. Edits to files under infra/prod/ must never happen through Claude Code. Which mechanism enforces this?
- A. A rules file for infra/prod/
- B. A line in CLAUDE.md
- C. A hook (or deny permission rule) that blocks writes to that path
- D. A Skill describing the policy
Show answer
Answer: C. Only deterministic mechanisms (hooks, permission rules) enforce; instructions can be ignored or forgotten.
Question 3. Which two belong in a plugin manifest-based package? (Choose 2.)
- A. Skills and slash commands shared by many repositories
- B. The team’s API keys
- C. Hooks and MCP server configuration for the team’s workflow
- D. Each developer’s personal settings.local.json
Show answer
Answer: A and C. Plugins distribute shared extensions. Secrets and personal settings must not be packaged.
Question 4. Playwright-specific rules should apply only when Claude edits files in tests/ui/. What fits best?
- A. Add them to ~/.claude/CLAUDE.md
- B. A rules file in .claude/rules/ with a paths pattern for tests/ui
- C. A hook that prints the rules
- D. An MCP prompt
Show answer
Answer: B. Path-specific rules files keep instructions in context only where they apply.
📝 Assignment
- Task 1: Turn one checklist your team repeats into a Skill with a precise description.
✅ Done when: a matching question makes Claude Code use it without you mentioning the Skill. - Task 2: Create a
/bug-reportcommand that takes a test name as$ARGUMENTSand produces your team’s bug template.
✅ Done when:/bug-report test_login_lockoutproduces a filled template. - Stretch: Package your Skill and command as a plugin folder with
plugin.json, and install it in a second repository from a local marketplace.
✅ Done when: the second repository has the Skill without copying files.
❓ Frequently Asked Questions
🤔 What are Claude Code Skills?
Folders with a SKILL.md that describe a capability. Claude sees the name and description and loads the instructions and files when a task matches.
🤔 What is the difference between a Skill and a slash command?
A Skill is discovered and loaded by Claude when relevant; a slash command is triggered explicitly by you, often with arguments.
🤔 What is a Claude Code plugin?
An installable package that bundles Skills, commands, subagents, hooks and MCP servers, distributed through marketplaces.
🤔 Where do custom slash commands live?
In .claude/commands/ for a project, ~/.claude/commands/ for you personally, or inside a plugin.
🏁 Summary
- Skills: on-demand know-how, discovered by description.
- Slash commands: explicit, parameterised prompts in
.claude/commands/. - Rules files: topic or path-specific instructions in
.claude/rules/. - Plugins: versioned bundles of Skills, commands, agents, hooks and MCP servers from marketplaces.
- Hooks enforce, subagents isolate, MCP connects; choose by what the workflow needs.
Next, continue with Claude Code Hooks and Subagents Step by Step.
Independent study material by SQA Tools. Not affiliated with, endorsed by or sponsored by Anthropic. Claude is a trademark of Anthropic. Practice questions are original, not real exam content. Code outputs marked “sample run” come from running the exact code against a local stand-in for the Claude API, so real replies, IDs and token counts will differ. Exam facts checked against Anthropic’s official CCDV-F exam guide v1.1 on 24 Nov 2026.