Nine Niche Tool Station
Back to List

Claude Code Skills Build Complete Tutorials: Build Your AI Automation Commands from Scratch

Teach you step by step how to create Claude Code Skills (Slash Commands), covering SKILL.md writing, trigger condition design, parameter processing, and test optimization, with complete examples and best practices.

Claude Code Skills Slash Commands automation AI tools Development efficiency SKILL.md

Last Updated:2026-05-26

1. What are Claude Code Skills?

Skills (also called Slash Commands) is Claude Code's custom command system. You can encapsulate commonly used workflows into a command, and then just enter /command name to trigger the entire process. For example, /deploy for one-click deployment, /test for automatic test running, and /translate for automatic translation—these are all Skills.

  • Essence: A Markdown File (Skill.Md) In Which The Steps And Rules To Be Executed By Claude Are Written.
  • Trigger Method: Enter /Skill-Name In Claude Code Or Natural Language Trigger (If The Description Is Well Written)
  • Storage Location: .Claude/Skills/{Skill-Name}/Skill.Md
  • Scope Of Scope: Follow The Git Project, Team Members Will Automatically Have All Skills After Cloning

2. The first skill: Create Hello World in 5 minutes

Let's start with the simplest Skill and create a command that automatically generates a daily work summary.

  • Step 1 — Create Directory: Mkdir -P .Claude/Skills/Daily-Summary
  • Step 2 — Create Skill.Md: Create The Skill.Md File In This Directory
  • Step 3 — Write The Basic Structure: Frontmatter (---) Contains Name And Description, And Write Execution Instructions Below
  • Step 4 — Test: Enter /Daily-Summary In Claude Code To Confirm That The Skill Is Triggered Correctly
  • Step 5 — Iteration: Adjust The Instruction Content Based On Actual Usage Experience
flowchart LR A[Create directory] --> B[Write SKILL.md] B --> C[define name & description] C --> D [Write execution steps] D --> E[test/skill-name] E --> F{Triggered successfully?} F -->|Yes| G[Complete] F -->|No| C

3. Complete structural analysis of SKILL.md

SKILL.md consists of two parts: frontmatter (metadata) and body (execution instructions). Let’s analyze them one by one below.

  • Name (Required): The Identification Name Of The Skill, Use Kebab-Case. For Example Run-Tests, Check-Seo
  • Description (Required): Trigger Description. Claude Determines Whether To Trigger Automatically Based On This Text. The More Precise The Writing, The Fewer False Triggers
  • Argument_Hints (Optional): Parameter Hints. For Example '<Module> [--Coverage]' Prompts The User What Parameters Can Be Passed
  • Allowed_Tools (Optional): Restrict The Tools That The Skill Can Use. For Example, Only Read And Bash Are Allowed, Write Is Not Allowed
  • Body (Required): The Body Of The Skill—The Complete Command That Claude Wants To Execute. Can Include Steps, Rules, Examples, Checkpoints

Tip

  • description is the most important field - it determines whether the Skill will be triggered at the right time
  • The more specific body is, the better. Don't write "Run the test", write "Run the test with pytest in the wagtail_multisite/ directory, USE_SQLITE=true"
block-beta columns 1 block:fm["Frontmatter (---)"] A["name: skill-name"] B["description: trigger description"] C["argument_hints: parameter hints"] D["allowed_tools: Tool restrictions"] end block:bd["Body (Markdown)"] E["## Step instructions"] F["Specific execution instructions"] G["Error handling rules"] H["Output format definition"] end

4. How to write description? Trigger condition design

description is not just a description text, it is the basis for Claude to judge "when to trigger this Skill". Writing a good description is the most critical step in designing a skill.

  • Explicit Trigger Words: List Keywords That Users Might Say. For Example, "Triggered When The User Mentions Qa, Testing, Quality Inspection, And Running Tests."
  • Exclusion Conditions: Describe The Circumstances Under Which The Trigger Should Not Be Triggered. For Example, "Do Not Trigger When: Just Discuss The Concept Of Testing Rather Than Actually Running The Test."
  • Scenario Description: Describe The Applicable Scenarios Of The Skill. For Example, “It’S Suitable To Run Once To Confirm The Quality Before Submitting A Pr.”
  • Example Trigger Statements: List 2-3 Trigger Examples To Help Claude Judge More Accurately

Tip

  • If the Skill often triggers by mistake, add more DO NOT TRIGGER conditions
  • If the Skill is not easily triggered, add more trigger keywords and sample statements

5. How to write body? execution instruction design

The body is the core of the Skill and determines what Claude will actually do. A good body should be like a detailed SOP.

  • Clear Sequence Of Steps: Use Step 1, Step 2 Or ## Headings To Separate Sections And Claude Will Execute Them In Order
  • Specific Instructions: Don’T Write “Run Test”, Write “Cd Wagtail_Multisite && Use_Sqlite=True Python -M Pytest Tests/ -V”
  • Error Handling: Explain What To Do If It Fails. For Example "If A Test Fails, List The Failed Test Name And Error Message, Do Not Automatically Fix It"
  • Checkpoints: What To Confirm After Each Step Is Completed. For Example, "Confirm That All Json Verification Passes Before Entering The Translation Step."
  • Output Format: Define The Format Of The Final Output, Such As "List Results In A Table" And "Output Markdown Report"
  • Parameter Processing: Use Arguments Placeholder To Receive Parameters Passed In By The User

6. Practical combat: setting up a QA testing skill

The following is a complete QA testing Skill example, you can copy and modify it directly.

  • Name: Qa-Check
  • Purpose: Automatically Run Targeted Tests + Smoke Test Based On Recent Code Changes
  • Trigger Conditions: User Mentions Qa, Testing, Quality Inspection, Running Tests
  • Execution Process: 1. Use Git Diff To Find The Recently Modified Files → 2. Decide Which Test Modules To Run Based On The Modification Scope → 3. Execute Pytest → 4. Generate Test Report
  • Parameter Support: /Qa-Check Calculator Only Runs The Test Of The Calculation Tool
  • Error Handling: List Detailed Information When The Test Fails And Do Not Automatically Repair It
flowchart TD A[/qa-check module/] --> B[git diff to find modified files] B --> C{Judgement influence module} C -->|calculator| D[pytest calculator/tests/] C -->|quiz| E[pytest quiz/tests/] C -->|All| F[pytest all tests] D --> G[Output test report] E --> G F --> G G --> H{Passed?} H -->|Yes| I[✅ Show success summary] H -->|No| J[❌ List failure details]

7. Advanced Skills: Make Skills More Powerful

After mastering the basics, the following advanced techniques can make your Skill more practical.

  • Multi-Step Pipeline: A Skill Connects Multiple Steps In Series. For Example, /Content-Pipeline Executes Creation, Translation, And Seo Checks In Sequence
  • Conditional Branch: Determine The Execution Path Based On Parameters Or Environment. For Example, --Dry-Run Only Displays The Plan But Does Not Actually Execute It.
  • Memory And State: Skill Can Read And Write Files In Specific Directories To Save State. For Example, Post Records And Last Execution Results
  • Cross-Skill Reference: The Body Of A Skill Can Reference The Logic Of Other Skills To Create A Combined Workflow
  • Allowed_Tools Restrictions: Skills With High Security Requirements, Restricting The Use Of Specific Tools To Avoid Misoperations
  • Script Integration: Call Project Automation Scripts (Such As ./Scripts/Run_Tests.Sh) In Skill Instead Of Directly Writing Long Instructions

8. Common errors and debugging

The most common problems and solutions when building skills.

  • Skill Not Triggered: Description Keyword Is Not Clear Enough. Add More Trigger Words And Example Sentences
  • Skill Falsely Triggered: Description Is Too Broad. Add Do Not Trigger Exclusions
  • The Execution Result Is Not As Expected: The Body Instruction Is Not Specific Enough. Change "Run Test" To The Complete Command Path And Parameters
  • Skill Stops Midway Through Execution: Error Handling Is Missing In The Body. Add The Logic Of "If X Fails, Execute Y"
  • Team Members Cannot See The Skill: Confirm That The .Claude/Skills/ Directory Has Been Added To Git And Pushed
  • Skill Is Too Long And Complex: Split It Into Multiple Small Skills, Or Use Scripts To Encapsulate Complex Logic. Skills Are Only Responsible For Calling Scripts.

9. Team Skill Management Best Practices

When a team has more and more Skills, good management strategies are needed.

  • Naming Convention: Use A Unified Naming Style. Suggested Verb-Noun Format, Such As Run-Tests, Check-Seo, Add-Article
  • Documentation: Maintain Skill List And Usage Instructions In Claude.Md So New Members Can Get Started Quickly
  • Version Control: Skills And Code Are Managed Together With Git, And Changes To Skills Are Also Reviewed During Pr Review.
  • Regular Cleaning: Delete Skills That Are No Longer Used To Avoid Confusion Caused By Accumulation Of Useless Instructions.
  • Shared Vs. Individual: Skills Shared By The Team Are Placed In .Claude/Skills/ Of The Project, And Personal Skills Are Placed In ~/.Claude/Skills/
  • Performance Monitoring: Use /Skill-Creator To Test And Optimize Skill Triggering Accuracy And Execution Efficiency

Key Takeaways

  • 1 Skills is Claude Code's custom command system. Use /command name to trigger preset complex workflows
  • 2 Each Skill only requires one SKILL.md file to define the name, trigger description and execution instructions
  • 3 A good skill can compress 30 minutes of repetitive work into a single instruction, which is a multiplier for team efficiency.
  • 4 This tutorial starts from scratch and takes you through the establishment, testing and optimization of your first Skill.
ℹ️

General Disclaimer

The information provided on this site is for reference only. We do not guarantee its completeness or accuracy. Users should determine the applicability of the information on their own.

Feedback