codify-work
Latest: v1.0.0
Introduces codify-work, a reviewed process for turning proven session procedures into reusable skills.
- Defines rules for capturing verified methods, searching for existing skills, and choosing the right place for new knowledge.
- Adds steps to distil, draft, and test a skill in a fresh session before approval.
- Covers review and release safeguards, including checking staged files and verifying registry details.
- Lists anti-patterns and open questions for future revisions.
Codify Work — collect past effort for future work
A session ends and everything it learned leaves with it. This skill is the step that stops that: it takes the part of a session that worked, distils it, and puts it somewhere that loads automatically next time.
The invariant: only proven material is collected. A procedure enters this loop after it has succeeded, not because it sounded plausible. Nothing invented, nothing guessed, nothing half-tested.
Origin. Inspired by Hermes Agent's skill_manage, where the agent writes and patches its own skills mid-conversation. OpenCode has no such runtime tool — skills are plain files and the agent writes them with the normal file tools. The loop here is therefore reviewed rather than automatic, and that is a feature: a self-authored instruction that silently becomes public is worse than a slow one that a human approved.
Rules (immutable)
- Collect only what worked. The candidate is a procedure that has run to a good result, twice if possible. A clever idea, an unverified guess, or a plan are not candidates.
- Patch beats add. Search existing skill descriptions first. If one covers most of the case, edit it. A new skill costs every future session a slot in the routing table.
- The description is the routing table. It must state when, with the words that will appear in a real request. "Helps with configuration" never fires; "use when a symlinked config silently stops loading" does.
- Prove it from the file alone. Run the procedure in a fresh session following only the written text. Knowledge that stays in your head, or in the session that produced it, means the skill is unfinished.
- Review the description. Ask whether its trigger words match the requests the user wants the skill to handle.
- Get approval for each destination. Approval of the description does not authorize a commit, a push, or a registry release.
- One procedure per skill, and a checklist, not an essay. If the body needs more than roughly 150 lines, it is two skills or one article.
- No secrets, no private paths. These files are public. Keys, tokens, medical, financial or family material never enter a SKILL.md.
Where the knowledge goes
The most common mistake is collecting into the wrong container. Decide before writing:
| what you learned | where it belongs |
|---|---|
| a rule that governs a whole repo or every session | the relevant AGENTS.md — constitution, not procedure |
| a repeatable method with steps and failure modes | a SKILL.md — this skill's output |
| the reasoning, the history, the war story | an article in ai-thoughts/docs/ |
| a single fact about one machine or one day | nowhere, or a dated doc if it will be re-read |
| a raw transcript | nowhere — it expires; extract, then let it go |
If a rule and a procedure would say the same thing, write the procedure and reference the rule. Duplication between an AGENTS.md and a SKILL.md is how contradictions start.
Procedure
1. Harvest — what is worth keeping
Re-read the session with one question: what did this cost me? Collect the expensive parts only:
- the exact command or sequence that worked, including argument order that mattered
- the failure that ate the time, and the symptom that identified it
- a constraint discovered by breaking it (a limit, a permission, a silent failure)
- the check that proved the result, not just the action that produced it
- what the user corrected more than once — that is a missing rule
2. Search before writing
grep -ilF -- "topic to find" .opencode/skills/*/SKILL.md
grep -inF -- "topic to find" AGENTS.md
Run the search from the project root. Include any global skill directories and rule files configured for the project. Three outcomes: an existing skill covers it (patch it), a rule covers it (stop — it is not a procedure), or nothing does (continue).
3. Distil
Write the smallest text that a fresh session could follow without you. Prefer a checklist over prose. Name the failure modes, because those are the part that cost the time. Keep the trigger vocabulary — the words a future user will type.
4. Draft the file
<repo>/.opencode/skills/<slug>/SKILL.md
Frontmatter carries name and the description that ends in "Use when …". Supporting scripts or references live beside it and are named relative to SKILL.md. Keep the draft untracked while it is unproven.
5. Prove it
Open a new session in a different directory, load the skill by ID, and execute only what the file says. Every question that comes up is a gap to write down. This step is the difference between a useful skill and a plausible one.
6. Gate, then ship
Show the user the description and trigger words. Review the complete skill before requesting approval to commit and push. A push to the public repository shares the source. For an approved ClawHub release in ai-thoughts, use publish-skills to preview the selected skill at the exact commit. Publish the same revision through the manual workflow. Verify the owner and version through the registry API.
Anti-patterns
- Sprawl. A skill per session turns the routing table into noise. If the count grows without a retirement policy, the loop is failing.
- Shadow rules. A skill that restates an AGENTS.md rule in different words. The next edit will make them disagree.
- Guesses promoted to rules. The most dangerous failure: "this should work" written with the same confidence as "this worked".
- Capturing the environment instead of the method. Paths, hostnames and versions go stale; the method does not.
- Publishing by accident. Check the staged files before committing. Keep unrelated drafts out of the commit and the release.
Status
First drafted on 2026-11-19 after several decisions from a working session had to be recovered from its transcript.
Still open, to settle on the next pass:
- a retirement rule (when a skill should be merged or deleted, and by what measure)
- whether "worked twice" is the right threshold, or whether cost is a better trigger
- a small harvest checklist that can run at the end of a session without being asked
- where to keep a local-only counterpart for methods that must not be published
