Get startedGet started for free

Using Skills

1. Using Skills

Skills are most powerful in combination. This video introduces a refactoring skill and shows how two skills work together: unit tests protect the code, refactoring improves it

2. What Is Refactoring?

Refactoring is restructuring code without changing what it does. Extract a helper, rename a variable, simplify a condition. The before and after look different, but given the same input, they return the same output. Left unchecked, code becomes harder to read and extend over time. Refactoring keeps it clean, but only if behavior is preserved. That's exactly what the unit-tests skill protects.

3. Unit Tests Enable Safe Refactoring

Tests make refactoring safe. Before you change anything, run them. After Claude refactors, run them again. Green means behavior is preserved. This is where the two skills work together. The unit-tests skill builds the safety net first, generating consistent test coverage every time. The refactor skill then works through changes incrementally, using that net as its safety check. One sets up the conditions, the other operates within them.

4. The Project So Far

A refactor skill is being added to the project. The creation process is the same as in the previous video, so it won't be repeated here. What matters is that both skills are now in place: unit tests builds the safety net, refactor uses it. Together they form a complete workflow.

5. Two Ways to Invoke

With both skills in place, here's how to use them. There are two ways to invoke a skill. Manual invocation gives you control: type slash refactor and it runs when you say so. Automatic invocation lets Claude decide: say "refactor this" and Claude matches your request to the skill description and triggers it. Both paths lead to the same consistent execution. When you know which skill you need, invoke it directly. It's faster, more predictable, and removes any ambiguity about what Claude will do.

6. Refactoring Code with Skills

Invoke the unit tests skill on routes.py. Claude generates a full test suite following the defined steps: Flask test client, mocked dependencies, happy paths and edge cases. The safety net is in place.

7. Refactoring Code with Skills

Now invoke slash refactor. Claude works through the skill: verify tests exist, make targeted changes, stay incremental. Two helper functions extracted, duplicated logic removed, route handlers cleaned up. All 21 tests pass. The instructions drive the behavior, not the prompt and not Claude's judgment on the day. This is a workflow repeatable by design.

8. Skills Ensure Consistency

Without a skill, three developers refactor three different ways: one makes big changes, one forgets to test, one takes a completely different approach. With a skill, all three run slash refactor and follow the same steps. Consistency isn't about discipline. It's about making good decisions automatic.

9. Let's Practice!

You've seen the full workflow: unit tests as the safety net, refactoring as the process. Now run it yourself. Let's practice.

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.