agentleFS
CloudflareKnown publishercloudflare/realtimekit-ui/.agents/skills/strict-naming/SKILL.md

strict-naming

Skill76 starsChanged 7 days agoApache-2.0View on GitHub

Use when naming a new UI Kit component prop, event, state, config key, helper, variable, type, or file. Choose clear names; avoid new single-letter names while keeping existing public API names stable.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do this for every new name.

    line 21
  2. Distinctive:

    Write one sentence: what does it hold, or what does it do?

    line 23
  3. Distinctive:

    Search the repo for the name and for its main word.

    line 25
  4. Distinctive:

    Read the line alone. If the meaning is not clear, the name is not finished.

    line 26
  5. Distinctive:

    If you cannot find a good name, the thing itself is probably unclear.

    line 28
  6. Distinctive:

    If the repo has a skill or doc that lists its domain words, read it before naming.

    line 83
  7. Very specific:

    Follow nearby public props and events.

    line 90
  8. Very specific:

    Read every added line of your change.

    line 101

≈ “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

Strict naming

A reader must understand a name without reading the lines above it. Long names are fine. Unclear names are not.

Hard rules

  1. No single-letter names. Not i, j, k, a, b, x, y, n, e, t, v, p, s, or any other. This covers variables, parameters, callback arguments, loop counters, catch parameters, destructured names, and generic type parameters. The only exception is _ for an argument that you must accept but do not use (see "Patterns").
  2. No shortened words. Not idx, tmp, val, obj, arr, res, ret, cb, el, evt. Write the full word. Allowed short forms: id, url, config, params, args, min, max, unit endings such as Ms and Px, and short forms that are product words in the repo.
  3. No name that says nothing. data, item, value, result, info, temp, flag, list, handler alone do not say what the thing is. Add what it is: chatMessage, pollOption, joinResponse.
  4. No clash. A new name must not be the same as, or easy to confuse with, another variable, method, public API name, event name, config key, or feature in the repo.
  5. Existing code is not a model. Old code may contain i, e, cb, x, y. Do not copy that style into new code. Poor names around your change are never a reason to add one more.
  6. Do not rename old code on your own. These rules are for the names you add. Rename existing names only when the developer asks. When your new or edited line must use an old short name that already exists there, keep it as it is.

How to choose a name

Do this for every new name.

  1. Write one sentence: what does it hold, or what does it do?
  2. Build the name from the nouns and verbs of that sentence.
  3. Search the repo for the name and for its main word. If the word already means something else, pick another word. If a similar name exists in the same scope, make the difference visible in the name.
  4. Read the line alone. If the meaning is not clear, the name is not finished.

If you cannot find a good name, the thing itself is probably unclear. Describe what it does in two lines and rethink the code.

Patterns

KindRuleExample
Loop over a collectionName the item. Prefer for...of.for (const controlName of controlNames)
Loop that needs the positionName the position after the item.for (const [tileIndex, videoTile] of videoTiles.entries())
Callback argumentName the item, same as a loop.controlNames.filter((controlName) => controlName !== 'rtk-mic-toggle')
catch parameterSay what failed.catch (deviceError)
Event listener argumentSay which event.(stateUpdateEvent) => ...
Promise executorSay what settles.new Promise((resolveDeviceList, rejectDeviceList) => ...)
reduceName the running total and the item.(visibleCount, controlName) => visibleCount + Number(controlName !== 'rtk-mic-toggle')
Key and value pairsName both.for (const [selector, styles] of Object.entries(config.styles ?? {}))
Coordinates and sizesSay which point and the unit.tileLeftPx, canvasWidthPx
BooleanStart with is, has, should, can, was for internal names.shouldShowDeviceMenu
CollectionPlural, and say what is inside.visibleControlNames
Number with a unitPut the unit in the name.notificationDurationMs
Function or methodVerb plus object. The name covers everything the function does.filterVisibleControls()
Generic type parameterA word, not a letter.ItemType, not T
Value with a generic field nameRename while destructuring if it helps.const { id: notificationId } = notification
One argument you must accept but do not useUse _.(_, controlIndex) => controlIndex
Two or more arguments you do not use_ cannot be used twice. Put _ in front of what each one is.(_controlName, _controlIndex, allControls) => allControls.length

Bad and good

// Bad
for (let i = 0; i < controls.length; i++) {
  const c = controls[i];
  if (c !== 'rtk-mic-toggle') visible.push(c);
}
const res = controls.filter((x) => !hidden.includes(x));

// Good
for (const controlName of controlNames) {
  if (controlName !== 'rtk-mic-toggle') {
    visibleControlNames.push(controlName);
  }
}
const availableControlNames = controlNames.filter(
  (controlName) => !hiddenControlNames.includes(controlName)
);

Clashes

A word that already has a meaning in the repo keeps only that meaning. Examples of the mistake:

  • Calling a set of CSS selectors states when states already means UI state.
  • Naming a new flag config when it is not a UIConfig.
  • Using stateUpdate as a new public event name when the emitted DOM name must be rtkStateUpdate.

Fix: use the existing domain word for its existing meaning, or add detail (activeStateSelectors, shouldShowSetupScreen).

If the repo has a skill or doc that lists its domain words, read it before naming.

Public names

A public name (@Prop(), DOM event, CSS custom property, UIConfig key, helper, or exported type) needs extra care once released.

  • Choose it with extra care.
  • Follow nearby public props and events. For example, keep the existing showSetupScreen prop name; do not rename it solely to match an internal boolean pattern.
  • List every new public name in your report, so the developer can change it before release.

When the developer asks for a rename

  1. Rename in all code and comments in the same change.
  2. Tests and Markdown files follow the order of code-first-workflow. List the test and Markdown files that still contain the old name in the Gate report. Rename them after the developer confirms the code and allows tests and docs.
  3. At the end of the task, the old word is in no file.

Check before you report

Read every added line of your change. Use git diff HEAD. If the change is already committed, use git diff <base branch>...HEAD. New untracked files are in neither output. Read them in full.

This command is for JavaScript and TypeScript. It finds the common misses. It does not find all of them. It also prints old short names on lines you edited. Those stay (rule 6).

git diff HEAD -U0 | grep -E '^\+' | grep -nE '\b(const|let|var) [A-Za-z]\b|[(,[{] ?[A-Za-z] ?[],)}]|[(,] ?[A-Za-z]\??: |\b[A-Za-z] =>|<[A-Z][ ,>]|, ?[A-Z]>'

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.