How to create custom Claude Skill and use it in VS Code Terminal using Claude CLI?

How to create custom Claude Skill and use it in VS Code Terminal using Claude CLI?

Supercharge Your CLI: How to Create Custom Claude Skills in Your VS Code Terminal?

Every developer and technical professional knows the tax of repetitive terminal tasks. Whether you are validating a deployment, checking branch diffs, or running specific scripts, you repeatedly type the same commands, consult internal wikis, or worry about missing a critical environment check.

With custom Claude Skills, you can teach your terminal AI assistant exactly how your workflows operate, feed it standard safety instructions, and run complex sequences with single commands or natural language triggers.

This step-by-step guide walks you through creating a custom Salesforce Deployment (sf-deploy) Skill and running it inside your VS Code terminal.

What is a Custom Claude Skill?

A custom Claude Skill is a localized set of Markdown-based instructions with YAML frontmatter that lives directly in your project folder.

  • YAML Frontmatter: Tells Claude when and how to activate the skill based on your text triggers or slash commands.
  • Markdown Body: Contains step-by-step instructions, pre-flight checks, exact code syntax, and safety guidelines.

By placing these in your local environment, you give Claude the context it needs to orchestrate CLI tools safely—saving you dozens of keystrokes while maintaining absolute consistency.

Step-by-Step: Creating Your Custom Claude Skill in VS Code

Follow this straightforward process to set up your directory structure and write your first deployment skill.

Step 1: Create the Skills Directory Structure

Open your VS Code terminal in the root directory of your project and create the default hidden folder where Claude scans for local skills:

mkdir -p .claude/skills

Step 2: Create Your Skill Folder

To keep your workspace organized and allow for supporting assets later, create a dedicated directory for your skill. We will name ours sf-deploy:

mkdir -p .claude/skills/sf-deploy

Step 3: Write the Skill Configuration (SKILL.md)

Now, create a file named SKILL.md inside that directory.

touch .claude/skills/sf-deploy/SKILL.md

Copy and paste the exact configuration and instruction template below into .claude/skills/sf-deploy/SKILL.md:

---
name: sf-deploy
description: Deploy metadata to Salesforce org (sandbox or production)
triggers:
  - salesforce deploy
  - sf deploy
  - sfdx deploy
runInstructions: ask
---

# Salesforce Deployment Skill

Deploy Salesforce metadata to target org using Salesforce CLI.

## When to use this skill
- Deploy code/metadata to Salesforce sandbox or production
- Run validation deployments
- Quick deploy validated change sets

## Pre-deployment checks
1. Verify Salesforce CLI is installed (`sf --version` or `sfdx --version`)
2. Check current org connection: `sf org list`
3. Run local tests if applicable
4. Confirm target org with user

## Deployment options

### Standard deployment
```bash
sf project deploy start --target-org [alias] --manifest manifest/package.xml

Deploy specific metadata

sf project deploy start --source-dir force-app/main/default/classes
--target-org [alias]

Validation only (check-only)

sf project deploy start --manifest manifest/package.xml --target-org [alias]
--dry-run

Quick deploy (after validation)

sf project deploy quick --job-id [validationId] --target-org [alias]

Deploy with tests

sf project deploy start --manifest manifest/package.xml --target-org [alias]
--test-level RunLocalTests

Safety guidelines

- Always confirm org before deployment (especially production)
- Run validation (--dry-run) first for production deployments
- Check test coverage requirements (75% for production)
- Never use --ignore-warnings without understanding the warnings
- Review deployment results before marking complete

Common test levels

- NoTestRun - Sandbox deployments
- RunLocalTests - Production deployments (default)
- RunAllTestsInOrg - Full test coverage
- RunSpecifiedTests - Specific test classes

Troubleshooting

- If authentication fails: sf org login web --alias [alias]
- Check deployment status: sf project deploy report --job-id [jobId]
- Cancel deployment: sf project deploy cancel --job-id [jobId]

Sample Prompt:

Use /sf-deploy to deploy the DemoClass Apex.

Leave a Reply