agentleFS
jbiscellajbiscella/skills-dungeon/skills/code/learned-operations/SKILL.md

learned-operations

Skill1 starsChanged 6 months ago0BSDView on GitHub

Self-teaching operation memory. Whenever you are about to perform a multi-step operation (a sequence of shell commands, a build, a deploy, an AWS/infra action, a repeatable diagnostic), use this skill FIRST. It tells you to check whether the operation was already crystallised into a reusable script, reuse it instead of regenerating the command sequence, and — for genuinely new operations — crystallise them after verifying they worked. Use it even when the user does not say "script" or "skill" — any repeatable multi-command operation qualifies.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    On load: Before any multi-step operation, list ~/.claude/skills/learned-operations/scripts/ and read each candidate's # operation: header.

    line 14
  2. Distinctive:

    Every script begins with exactly these three header lines:

    line 22
  3. Very specific:

    Read the # operation: header of candidates to find a semantic match for the request.

    line 42
  4. Distinctive:

    After running a brand-new operation manually and confirming it worked:

    line 55
  5. Distinctive:

    Put in the script only what the operation actually needed.

    line 58
  6. Very specific:

    Check the actual world against the # expectation: line.

    line 65
  7. Very specific:

    Only the user promotes to trusted.

    line 71
  8. Distinctive:

    Before creating a near-duplicate of an existing script, apply this test against the closest match:

    line 75

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Learned Operations

A self-teaching memory for repeatable operations. The point is to stop regenerating known command sequences from scratch (wastes tokens) and to stop silently reusing things that were never proven to work (causes regression).

Scripts live in this skill's own scripts/ directory: ~/.claude/skills/learned-operations/scripts/. They are bash. Each script carries its own state in a header comment — there is no separate index file, and the script is the single source of truth for its own state.

Minimum protocol

On load. Before any multi-step operation, list ~/.claude/skills/learned-operations/scripts/ and read each candidate's # operation: header. Match semantically, not by filename.

Stop and surface to the user on. Listed script unreadable or corrupted (treat as absent, tell the user, do not silently recreate). A new operation that needs a near-duplicate of an existing script — apply the parametrise-vs-clone table before writing anything. A trusted script whose context no longer matches — clone to a draft, do not edit in place.

Expected output shape. Match in trusted state — the body re-read can be skipped, not context matching or side-effect verification. Match in verified — re-read, confirm fit, invoke. Match in draft — re-read, run, re-verify side-effects before relying. No match — perform manually this turn, then crystallise a new script with the four-line state header and # state: draft.

State header

Every script begins with exactly these three header lines:

#!/usr/bin/env bash
# operation: <one line: what operation this performs>
# state: draft | verified | trusted
# expectation: <the side-effect that proves it worked>

State meanings:

statemeaningwho sets it
draftjust crystallised, not yet provenyou, at creation
verifiedside-effects were asserted against the expectation and matchedyou, after checking
trustedthe user approved skipping the body re-readthe user only

Before any multi-step operation

  1. List ~/.claude/skills/learned-operations/scripts/.
  2. Read the # operation: header of candidates to find a semantic match for the request. Do not match on filename alone.
  3. Decide:
SituationAction
Match, # state: trustedConfirm account, region, directory, target and intended effect; skip body reread only, verify side-effects afterward.
Match, # state: verifiedRe-read the body, confirm it fits this context, then invoke.
Match, # state: draftRe-read body, run it, then re-verify side-effects before relying on the result.
Listed file unreadable/brokenTreat as absent. Tell the user. Do not silently recreate.
No matchPerform the operation manually this turn, then crystallise it (below).

Crystallising a new operation

After running a brand-new operation manually and confirming it worked:

  1. Save the exact command sequence as a bash script in scripts/, with the four header lines above and # state: draft.
  2. Put in the script only what the operation actually needed. Do NOT add flags, logging, error handling, or options that were not used. The script reproduces what was just done — nothing more.

Verification (draft -> verified)

Verification is an external judgement you make AFTER execution. It is NOT code inside the script.

  • Judge by inspecting real side-effects (file created/modified, record present, resource in expected state), never by exit code alone — exit 0 is necessary, never sufficient.
  • Check the actual world against the # expectation: line.
  • Side-effects match -> rewrite the header to # state: verified.
  • They do not -> leave # state: draft and report the mismatch.

Promotion (verified -> trusted)

Only the user promotes to trusted. Never self-promote. trusted is what authorises skipping the body re-read, so it requires a human decision. When the user approves, rewrite the header to # state: trusted.

Parametrise vs duplicate

Before creating a near-duplicate of an existing script, apply this test against the closest match:

ConditionAction
Only a value differs (region, name, path) AND state is draft/verifiedAdd an argument to the existing script.
Only a value differs AND state is trustedClone to a new draft, parametrise the clone, leave the original untouched.
The command flow differs (different/reordered steps)New script. Do not parametrise.
The expected side-effect differsNew script. Do not parametrise.
Supporting the new case needs an if/case that branches behaviourNew script. Do not parametrise.

Immutability and declassing

  • A trusted script is immutable: never edit it in place. Need a variant? Clone to a new draft first.
  • Any edit to a draft/verified script — including adding an argument — rewrites its header to # state: draft and requires re-verification. A changed script has not been proven in its new form.

Context is not covered by trust

Trust approves the previously reviewed script body, not a future runtime context. Before every invocation, verify environment/account, target, required arguments, current directory and expected side effect. For destructive operations independently confirm the precise target and write authorization. If preconditions cannot be established, report UNVERIFIED and do not run. An optional # preconditions: header can record constraints without changing the existing state contract.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.