---
name: ui-sdk-unslop
description: Removes generated-looking code from a ui-sdk diff or files, like comments that restate the code, filler JSDoc, defensive checks for impossible cases, one-caller helpers and vague names, without changing behavior. Use as the last step of any change, or when asked to clean up, trim comments or remove slop.
metadata:
  internal: true
title: ui-sdk-unslop
canonical_url: https://skilld.dev/gh/vercel-labs/ui/ui-sdk-unslop
last_updated: 2026-11-13T00:01:41.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install vercel-labs/ui/ui-sdk-unslop`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/ui-sdk-unslop`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/vercel-labs/ui/ui-sdk-unslop) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/ui-sdk-unslop`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/ui-sdk-unslop --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/ui-sdk-unslop --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Unslop

Scope is the diff (`git diff` against the base) unless you're given files. Behavior never changes: the same tests pass before and after, and nothing public is renamed.

## What goes

Each pattern, with what replaces it.

**A comment that says what the next line does.** Delete it. If the line isn't clear without it, rename something.

```ts
// Close the popup when Escape is pressed.
if (event.key === "Escape") close()
```

**A comment on every declaration.** Most constants, fields and functions need none: the name and the type say what they are. Delete each one that doesn't stop a reader from getting the code wrong.

**A comment that explains the design.** What a value holds, where it's kept, which attribute it lands on, who reads it. The code says that. Keep the one fact it can't show, in a line, or delete the comment.

```ts
// Before
// The site's color scheme, shown on <html> as `data-color-scheme`, which the
// stylesheet's colors follow. It's kept under "theme", the key the site used
// before, so readers keep what they chose.
const colorScheme = createColorScheme({
  storage: createLocalStorage("theme"),
  global: true,
})

// After
// "theme" is the key the site used before, so readers keep their choice.
const colorScheme = createColorScheme({
  storage: createLocalStorage("theme"),
  global: true,
})
```

**A comment longer than three lines.** Cut it to the reason. An explanation that needs more goes in the docs page, a test title or `contributing/`. `pnpm lint` flags it (`comment-length`).

**A comment that narrates history or the task.** "Now we", "Updated to", "Fixed the bug where", "As requested". Delete it. Git holds the history.

**A section banner.** `// ---- Helpers ----`, `// State`. Delete it. Split the file if it needs signposts.

**JSDoc that repeats the name.** `/** The value. */ value`. Say what the reader can't see: the default, the unit, when it's called, what happens on change. `pnpm lint` catches field docs that only repeat the name; write the rest the same way.

**A hedge or a sales word in a comment or a doc.** "Robust", "seamless", "comprehensive", "simply", "just", "easily", "ensure", "leverage", "utilize", "note that", "it's important to". Cut the word; if nothing is left, cut the comment.

**A defensive check the types already rule out.** `if (!items) return` on `items: Item[]`, `?? []` on a value that's never undefined, `try` around code that can't throw. Delete it. Narrow `unknown` at a boundary instead.

**A cast or `!` with no reason.** Make the type right, or say why in a comment.

**A one-caller helper, or a wrapper that only renames.** Inline it, unless its name explains something the call can't.

**A name that says nothing.** `data`, `result`, `item2`, `handleClick2`, `temp`, `flag`, `isValid2`. Name what it is: `highlightedItem`, `isOpen`, `onTriggerPress`.

**An option nobody passes,** a parameter with one value, a config object for one setting. Delete it.

**Logs, probes and commented-out code.** Delete them.

**In examples, any comment at all.** Only tool directives stay (`svelte-ignore`, `eslint-disable`, `@__PURE__`).

## What stays

- A comment that says why, in three lines at most: a browser bug and the browser, an APG rule, a trade-off, a link to the spec or test that pins the behavior.
- The word "primitive", and parentheses that hold code names, like "the trigger (`MenuTrigger`)".
- JSDoc on every public field and export. Make it say more; don't delete it.

## Steps

1. List what you'll change, by file, before touching anything.
2. Make the changes.
3. Run `pnpm lint`, `pnpm format`, `pnpm typecheck` and the unit tests for the packages you touched. Check exit codes.
4. Delete each comment left in the diff and reread the code. If it still reads right, leave it deleted.
5. Read the diff once more. Revert any change that doesn't make the code easier to read.
6. If one pattern showed up in three or more files, propose a lint rule for it in `scripts/check-code.mjs` or `scripts/check-comments.mjs`.
