Get AI summaries of any video or article — Sign up free
How To Train Your AI Agent's Skills (Claude Code / OpenClaw) thumbnail

How To Train Your AI Agent's Skills (Claude Code / OpenClaw)

All About AI·
5 min read

Based on All About AI's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Create a new skill.md file for each site capability, starting empty and iterating until the agent can complete the action.

Briefing

Training an AI agent to perform new browser tasks gets dramatically faster once the successful steps are saved into reusable “skill” files. The workflow demonstrated centers on creating a new LinkedIn skill.md file, letting the agent brute-force the UI using JavaScript injection, then capturing the exact working sequence so later runs skip the trial-and-error.

On a dedicated Mac Mini, the agent’s capabilities are organized as Markdown “skills” that describe how to navigate specific sites and complete actions like composing posts, researching, or editing content. To add LinkedIn, the process starts in Cursor: a new file is created under the skills directory (e.g., LinkedIn skill.md), initially empty. Claude is then instructed to read a browser JavaScript helper so the agent can control Chrome via injected scripts. With the agent logged into LinkedIn on the machine, the first test is intentionally hands-off: it attempts to open the post composer and draft content on its own.

That first attempt takes time because LinkedIn’s editor elements don’t always match standard selectors. The agent uses CDP (Chrome DevTools Protocol) to inject JavaScript, searches for the right input fields, and keeps iterating until it finds a workable way to type into the post editor. After roughly six minutes of experimentation, it finally identifies the correct editor element, inserts text, and produces a draft.

The key step comes next: the working workflow is written back into LinkedIn skill.md. After restarting the agent and re-running the same “compose a draft post” task, the saved skill cuts the runtime from minutes down to about 40 seconds. The agent now loads the skill, runs the previously discovered selector-and-injection sequence on the first try, and leaves the post ready without repeated exploration. The practical payoff is reduced token usage, less compute time, and fewer costly retries.

The same pattern is repeated for additional LinkedIn skills. A new task trains the agent to search for employees at Anthropic, scroll through results, and extract names and roles from the interface. The workflow is then saved into the skill.md file so future searches can run quickly and consistently.

Finally, the agent is trained to send LinkedIn DMs. It first checks who it can message, locates the “send” option, and uses JavaScript injection to deliver a short greeting. A follow-up test—sending a “thanks for the connection” message—runs much faster because the successful messaging workflow has already been captured.

By the end, the demonstrated approach frames “training” as iterative UI discovery plus codifying the winning steps into reusable skill files. Those skills then combine into higher-level autonomy, such as running multi-step tasks across platforms (e.g., research, content creation, and posting) without starting from scratch each time. The creator also mentions maintaining a growing repository of working skill.md files for reuse by other agents.

Cornell Notes

The workflow trains an AI agent to perform LinkedIn actions by turning successful browser interactions into reusable skill.md files. A new skill starts empty, then the agent uses Chrome automation (via JavaScript injection and CDP) to brute-force the UI until it finds the right elements to type, search, or message. Once the agent achieves a working sequence, that exact workflow is saved into LinkedIn skill.md. Subsequent runs become far faster—about 6 minutes for the first post draft, then roughly 40 seconds after saving the working workflow. The same loop is applied to finding Anthropic employees and sending DMs, with later messaging tests improving in speed because the learned steps are reused.

How does the agent “learn” a new LinkedIn capability in this workflow?

It begins by creating an empty LinkedIn skill.md file under the skills directory, then instructs Claude to use a browser JavaScript helper so the agent can control Chrome. The agent attempts the target action (like opening the post editor) using JavaScript injection through CDP, iterating until it finds the correct UI elements. After it succeeds, the working selector-and-action sequence is written back into LinkedIn skill.md so future runs can execute the same steps immediately.

Why did the first LinkedIn post attempt take minutes, and what changed afterward?

LinkedIn’s post editor doesn’t reliably expose standard attributes, so the agent’s initial document.querySelector approach can fail. It then keeps trying alternative injection strategies and element-finding methods until it locates the correct editor input. After about six minutes, the successful workflow is saved into the skill.md file. The next run uses the saved workflow on the first attempt, dropping time to roughly 40 seconds.

What role does CDP play in making these skills reusable?

CDP (Chrome DevTools Protocol) enables the agent to inject and run JavaScript inside the Chrome session. That injection is how it types into the LinkedIn editor, clicks the right controls, and extracts or navigates UI elements. Once the agent discovers which injected script and selectors work, those steps become part of the skill.md workflow, eliminating repeated exploration.

How is the “find people” skill structured conceptually?

The agent searches LinkedIn for “Anthropic” using the site’s search bar, then scrolls through results to gather relevant profiles. It identifies people such as Tyler Quinn and captures details like job titles and locations shown in the results list. The successful browsing and extraction workflow is then saved into the LinkedIn skill.md file for faster reuse.

What’s the difference between training a DM skill and training a post skill here?

A post skill focuses on locating the post composer and injecting text into the editor. A DM skill adds extra steps: checking who the agent can message, navigating to the correct conversation or profile, locating the “send” control, and injecting the message content. The workflow is still saved after success, so a later test (e.g., sending “thanks for the connected”) runs quickly because the agent already knows the UI path and injection method.

Review Questions

  1. What specific mechanism turns a one-time UI discovery into a reusable skill for later runs?
  2. Why does saving a working workflow reduce token usage and runtime in these browser automation tasks?
  3. How would you design a new skill.md for a different LinkedIn action (e.g., commenting on a post) using the same iterative loop?

Key Points

  1. 1

    Create a new skill.md file for each site capability, starting empty and iterating until the agent can complete the action.

  2. 2

    Use Chrome automation via JavaScript injection and CDP to interact with complex UIs like LinkedIn’s post editor.

  3. 3

    Save the exact working selector-and-workflow sequence into the skill.md file after the first successful attempt.

  4. 4

    Re-running the same task with the saved skill sharply reduces runtime (minutes to seconds) by skipping repeated trial-and-error.

  5. 5

    Apply the same loop to multiple LinkedIn tasks: drafting posts, searching for employees, and sending DMs.

  6. 6

    Combine trained skills to enable more autonomous multi-step workflows across platforms without restarting from scratch.

Highlights

The first LinkedIn post draft required about six minutes of UI trial-and-error, but saving the working workflow cut the next run to roughly 40 seconds.
LinkedIn’s editor often lacks standard attributes, forcing the agent to rely on CDP-injected JavaScript and iterative element discovery.
Employee search and DM sending both follow the same pattern: brute-force once, then codify the winning steps into skill.md for faster future execution.

Topics

Mentioned

  • CDP