# Teach lesson

> Your agent writes a five-minute lesson that ends with the reader applying the idea, not just reading it.

```sh
vp dlx skills add onmax/comark-ui
```

Pick `teach-lesson` from the list. The skill's example, `references/example.md`:

````md
# Keep both writers' changes

After this lesson, you can predict how a server handles two changes to the same record, with or without a version check.

## Why it matters

In this example, Ana and Ben open the same help article. Ana corrects a spelling error and saves the article. Ben adds a paragraph to his older copy and saves it. His save removes Ana's correction without a warning. This is a **lost update**.

## The idea

An **ETag** is a version label, such as `"v7"`, that the server sends with a resource. The **If-Match** header carries that label back to require the same version before saving a change. If the labels match, the server saves the change. If the labels differ, the server returns `412 Precondition Failed` and keeps the resource unchanged.

## Worked example

::steps
### Both load version 7

Ana and Ben each `GET /articles/42`, and both get `ETag: "v7"`.

### Ana saves first

```http
PUT /articles/42
If-Match: "v7"
```

The article is still at `"v7"`. The server saves Ana's change and returns `200 OK` with `ETag: "v8"`.

### Ben saves second

```http
PUT /articles/42
If-Match: "v7"
```

The article is now at `"v8"`. The labels differ, so the server returns `412 Precondition Failed`. Ana's correction stays.

### Ben reloads and merges

Ben's editor fetches `"v8"` and shows Ana's correction. Ben adds his paragraph to that version. He saves again with `If-Match: "v8"`.
::

## Check yourself

::question{#etag-no-if-match}
This API accepts requests without `If-Match`. Ben's editor sends his `PUT` without that header. The article is at `"v8"`. What happens?

- [x] The server saves Ben's version and removes Ana's correction
  > Without `If-Match`, the server has no version condition to check. The server saves Ben's version. This removes Ana's correction.
- [ ] The server refuses the save with a 412 status code
  > A 412 response requires a condition that failed. Ben sent no condition, so the server has no labels to compare.
- [ ] The server merges Ben's paragraph into version 8
  > The server does not combine the two versions. After a 412 response, the client must get the current version and combine the changes.

#explain
The client must send its original version label for `If-Match` to protect the change. An API can require that header. If the header is absent, that API can return `428 Precondition Required`.
::

::recall{#etag-412}
What does a server answer when `If-Match` names an old version?

#answer
`412 Precondition Failed`, and it leaves the resource unchanged.
::

## Read next

[RFC 9110, section 13.1.1](https://www.rfc-editor.org/rfc/rfc9110#name-if-match) defines `If-Match`.

The next lesson explains weak ETags and why `W/"v7"` never matches `If-Match`.
````

## What it does

The skill writes **one lesson on one concept** that takes five minutes. You get the outcome, the idea, a worked example, and a question that changes one input of that example.

It fits the depth to your question and what you know. A plain definition leads to how the concept works and why it solves your problem, and the example adds detail. When diagrams help, each one redraws the last with the next part added.

For an existing system, it checks behavior against the sources and looks for recorded design reasons. It labels reasons it inferred and says what's uncertain.

The lesson, its question, and the answer explanations follow the ASD-STE100 Simplified Technical English rules. Sentences are short, each term keeps one meaning, and technical names stay exact.

The skill keeps no record of what you've learned. A second concept gets its own lesson, linked at the end. Your browser or a host such as [Drop](https://drop.vitehub.dev/?utm_source=comark-ui&utm_medium=skills) can save answers.

## When to use it

Ask "Teach me how ETags prevent lost updates" or "Write a lesson on React keys for new hires." Your agent loads the skill when someone asks to learn or understand a concept. To be sure, say "Use the teach-lesson skill."

Choose by what you want:

- One idea, learned and checked in a few minutes: this skill.
- How a system works, with no check: [Visual explanation](https://comark-ui.onmax.me/skills/visual-explanation/).
- A course over many sessions that remembers what you've learned: a tutor skill such as Matt Pocock's [teach](https://github.com/mattpocock/skills/tree/main/skills/productivity/teach), which this skill draws on.

Its reader context, how-and-why explanation, evidence handling, and step-by-step diagrams draw on [pstack's teach skill](https://github.com/cursor/plugins/blob/main/pstack/skills/teach/SKILL.md). They're built in, so this skill installs on its own.

## It's working if

- The outcome under the title uses a verb a question can test, such as predict, explain, or choose.
- The idea starts with a plain definition and ties it to your case.
- The explanation separates verified behavior from inferred design reasons.
- Each step of the worked example shows the value that changed.
- Instructions are at most 20 words, and descriptive sentences at most 25.
- Each technical term is explained at first use and keeps one meaning.
- The question changes one input of the example instead of asking for the definition back.
- Each wrong option is a real mistake, and picking it says why it's tempting and why it's wrong.
- You can't spot the right answer by its length or place, since comark-quiz shuffles the options.
- The lesson ends with one primary source, linked to the exact section.

## Sitemap

See the full list of pages in [llms.txt](https://comark-ui.onmax.me/llms.txt).
