- Published on
Claude Code Skills: How to Build Custom Developer Workflows
Claude Code allows developers to automate terminal tasks and file edits using natural language in under 5 minutes. By using Claude Sonnet 4, you can teach the tool new "skills" (custom scripts or commands) to handle repetitive workflows like setting up test environments or cleaning up build artifacts.
What are "Skills" in Claude Code?
In the context of Claude Code, a skill is a custom command or script that you teach the AI to execute within your local environment. It acts as an extension of the model's native capabilities, allowing it to interact with your specific project structure.
Think of skills as a bridge between the AI's reasoning and your computer's terminal. Instead of manually typing long command sequences, you define a skill once, and Claude can trigger it whenever it detects a relevant task.
What do you need to get started?
Before building custom skills, you must have the basic environment ready. We recommend starting with a clean project folder to avoid any confusion while learning.
- Node.js 20+: The runtime (software that executes JavaScript code) required to run Claude Code.
- Claude Code CLI: The command-line interface (a text-based way to interact with software) installed via
npm install -g @anthropic-ai/claude-code. - Anthropic API Key: A unique code that allows your terminal to talk to Claude Sonnet 4.
- Git: A version control system (a tool that tracks changes to your files) to manage your code history.
How do you install and authorize Claude Code?
Setting up the tool is the first step toward teaching it skills. Follow these steps to get the environment running on your machine.
Step 1: Install the package
Open your terminal (Command Prompt or Terminal app) and run the installation command. This makes the claude command available everywhere on your computer.
npm install -g @anthropic-ai/claude-code
Step 2: Authenticate your account Run the auth command to link your terminal to your Anthropic account. A browser window will open asking you to sign in and grant permission.
claude auth login
Step 3: Navigate to your project Move into the folder where you want Claude to work. It is normal to feel a bit nervous about giving an AI access to your files, so start in a test directory first.
cd my-learning-project
claude
How can you teach Claude to edit your files?
Claude Code doesn't just suggest code; it can actually write to your disk. You give it permission to read your files, and it uses its "filesystem" skill to make changes.
When you ask Claude to "Fix the bug in index.js," it first reads the file content. It then proposes a diff (a list of specific changes between two versions of a file) for you to approve.
You can also ask it to create entirely new files. For example, telling Claude to "Create a basic React 19 component for a button" will result in a new .jsx file appearing in your folder automatically.
How do you create a custom skill for repetitive tasks?
Custom skills are usually shell scripts (files containing a series of terminal commands) that Claude learns to call. Let’s create a skill that automatically formats your code using Prettier (a tool that makes code look neat).
Step 1: Create a script folder
It is best practice to keep your custom scripts in a dedicated directory. Create a folder named .claude/skills in your project root.
mkdir -p .claude/skills
Step 2: Write the skill script
Create a file named format.sh inside that folder. This script will tell the computer to run the formatting tool on all files.
#!/bin/bash
# This line tells the computer to use the Bash shell
npx prettier --write .
# npx runs the prettier tool without needing a permanent installation
Step 3: Make the script executable
Computers need special permission to run scripts you write. Use the chmod command to grant this permission.
chmod +x .claude/skills/format.sh
Step 4: Tell Claude about the skill
Start a session by typing claude. Now, simply say: "When I ask you to tidy up, run the format script in the skills folder." Claude will remember this instruction for the duration of your session.
What are the common mistakes beginners make?
It is normal to run into errors when first using AI-driven terminal tools. Most issues stem from permission settings or pathing (telling the computer exactly where a file is located).
- Permission Denied: If Claude says it cannot run a script, you likely forgot the
chmod +xstep mentioned above. - Wrong Directory: Claude only sees the files in the folder where you started it. If you move to a different folder in your terminal, you need to restart the
claudecommand. - API Limits: If Claude stops responding, check your Anthropic dashboard. You might have hit your daily usage limit for the API.
We've found that keeping your scripts simple—doing one thing at a time—makes it much easier for the AI to understand when to use them.
How do you use Claude to run tests?
One of the most powerful skills is automated testing. You can teach Claude to run your test suite (a collection of scripts that check if your code works) and fix any errors it finds.
In a Python 3.12 project, you might have a command like pytest. You can tell Claude: "Run my tests, and if any fail, look at the error message and fix the code in the source folder."
Claude will execute the command, read the output in the terminal, and then start a loop of "Edit -> Test -> Edit" until the tests pass. This saves you from manually switching between your editor and the terminal dozens of times.
Next Steps
Now that you have the basics down, you should try creating a skill that automates your specific "boring" tasks. This might be clearing a cache, generating a database migration, or deploying to a staging site.
Start small and always review the changes Claude proposes before hitting "Enter." As you get more comfortable, you can combine multiple scripts into complex workflows.
For detailed guides, visit the official Claude documentation.