Chapter 13 of 26

A prompt you repeat every day should be written once

Back in the restaurant, I am now the manager, and the waiter is the agent. I am sick and tired of this waiter. Not because he is bad. He is smart and hardworking. Because every single morning I handwrite the menu for him. Starters, main dishes, desserts, by hand, every day. Why don't I print it once and put it where he can pick it up?

In software programming we call that a method. Your Playwright framework has a login method. Say login takes twenty lines of code, and you have two thousand test cases, so without a method you are writing forty thousand lines. Are you out of your mind? You write the twenty lines once and call them every time.

In agents we call it skills. You have a good prompt with good context engineering, and you notice you are typing the same thing to the agent over and over, until you are sick and tired of explaining it. So you write it once, as a skill: the name of the skill, a description of when to use it, and the instructions. When the agent meets that situation, it invokes the skill, the way your test calls a method.

Take a bug reproduction skill. To reproduce a bug means to make it happen again on purpose. During testing, the agent thinks it found a bug. The skill says: before you report it, try to reproduce it three times, and if it is consistent, then write the bug report. You never type that again.

You are writing your first skill. Can it have code inside it?

Yes, it can. In my experience a skill can be plain instructions, or it can say: there is a Python file here, execute it, this is where to find it. A skill can be a whole chunk of the work. Think of James Bond. Nobody gives him instructions in the field every time. He goes on the mission carrying a special watch with a GPS in it, and he uses it when the situation calls for it. A script inside a skill is that watch. It does its one job the same way every time, and the agent does not have to reason its way through it.