Back/Engineering/Claude/Claude Code
IntermediateEngineering

How to Generate and Use Custom Claude Skills via the Command Line with Claude Code

Use Claude Code inside a local skills repository to generate a task-specific skill, inspect and validate the files it creates, then test the skill on representative input and improve the reusable instructions.

How to Generate and Use Custom Claude Skills via the Command Line with Claude Code

Claire starts Claude Code inside her local skills folder, invokes the create-skill skill to build a changelog-to-newsletter skill, runs its validator, and tests it with an actual changelog.

Before you start

What you need

  • Claude Code installed and authenticated
  • A trusted local skills repository
  • A working create-skill meta-skill
  • A narrow recurring task with representative input
  • An expected output format and examples of unacceptable output

What you’ll make

A task-specific Claude skill that Claude Code can discover, validate, and apply consistently to representative inputs.

Tools used

Step by step

The workflow

Follow the sequence once, then adapt the prompts, checks, and handoffs to your own setup.

4 steps

Step01

Open Terminal and Start Claude Code

Open a terminal in the trusted skills repository and start Claude Code there. Confirm the current path, visible skills, pending Git changes, and permissions before asking it to create anything.

Step02

Prompt Claude Code to Use Your 'Meta-Skill'

Invoke the create-skill skill with one recurring task. Supply the real input shape, output format, tone or policy constraints, and examples that show when the skill should and should not run.

Example prompt
Use the create-skill skill to create [skill-name] for [recurring task]. Inputs look like: [representative input]. Produce: [exact output]. Follow: [constraints]. Trigger on: [matching examples]. Do not trigger on: [non-matching examples].
Step03

Observe the Automated Generation

Review the proposed folder and diff before running scripts. Check the metadata, instructions, referenced files, trigger description, output contract, and read-only validation behavior.

Example prompt
Show the generated file tree and summarize the purpose of each file. Run only the read-only validation checks defined in the trusted create-skill folder. Report warnings and do not modify unrelated files.
Step04

Test the New Skill Immediately

Test the new skill with representative input in a fresh turn, then try an ambiguous input and an unrelated request. Move recurring corrections into the skill and keep the improved example with it.

Example prompt
Here is the latest [input type]:

[input]

Apply the appropriate skill. Preserve source facts, follow the required format, and label missing information instead of inventing it.

If the output isn't perfect, you can easily open the `SKILL.md` file for the new skill in a text editor and tweak the instructions to refine the tone, format, or logic.

What good looks like

  • The generated folder contains only files the skill uses.
  • Claude discovers the skill for matching requests and ignores it for unrelated requests.
  • Validation is read-only and the generated output follows the required format.
  • Repeated corrections are made in the skill instructions and covered by a test example.

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

After the steps

Runbook notes

How to recover when the loop fails and where human judgment helps.

Recover

If it goes sideways

Claude Code cannot discover the meta-skill or the newly generated skill
Start it from the intended repository, confirm the supported skill path and metadata, and ask Claude to list the skills it can see.
A broad brief produces a generic skill that triggers on unrelated work
Narrow the task, add positive and negative trigger examples, specify the input shape, and define one expected output.
The validator passes structure but the skill still produces poor work
Add representative and adversarial examples, evaluate the actual output, and treat structural validation as one check rather than proof of quality.
A generated skill or script reads credentials or unrelated repository files
Inspect file access and scripts before running them, use synthetic inputs, constrain paths, and remove network or secret access that the task does not require.

Start shipping
better products.

Join 100,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start
No credit card
SOC 2 certified
Enterprise ready