agentleFS
dbeaverdbeaver/cloudbeaver/.agents/skills/component-state/SKILL.md

component-state

Skill5.2k starsChanged 9 days agoApache-2.0View on GitHub

Guides state management, component logic, and hook composition in CloudBeaver React components. Use when creating, changing, reviewing, or extracting component behavior, state, or hooks.

Trending

Steady talk.about the whole repository

Dec 2025: 0 mentionsJan 2026: 1 mentionFeb 2026: 1 mentionMar 2026: 0 mentionsApr 2026: 1 mentionMay 2026: 2 mentionsJun 2026: 1 mentionJul 2026: 5 mentionsAug 2026: 4 mentionsSep 2026: 6 mentionsOct 2026: 4 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the dbeaver/cloudbeaver repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about dbeaver/cloudbeaver

The biggest 5 of 50 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 50

Talked about on GitHub, Hacker News and Bluesky (50 times).

On GitHub · 45

40 more on GitHub

On Hacker News · 3

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep components easy to read: call hooks, connect their results, render UI.

    line 8
  2. Very specific:

    If a hook owns observable state, use useObservableRef from @cloudbeaver/core-blocks.

    line 15
  3. Very specific:

    Read changing inputs through this and pass them in the third argument.

    line 47
  4. Very specific:

    Keep editable local fields out of the update object: it overwrites local changes.

    line 49
  5. Very specific:

    After await, wrap observable changes in runInAction.

    line 51
  6. Very specific:

    Read observable fields inside an observer render or a tracked getter, not as snapshots destructured before that read.

    line 52
  7. Distinctive:

    Keep hooks unconditional and at the top level.

    line 70

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Component state

Keep components easy to read: call hooks, connect their results, render UI.

  • Move related state, derived values, and operations into a named hook. Several state fields, handlers, and effects for one task are a sign to extract it. A single local UI flag can stay.
  • Extract complex logic into a separate hook even when it has no observable state. It can stay in the component when it is the component's direct responsibility and its only piece of logic.
  • Give each hook one job. Do not move a large component into one equally large hook.
  • If a hook owns observable state, use useObservableRef from @cloudbeaver/core-blocks.
  • Return the state object itself, with values and operations. Do not spread it into a new object or return snapshots of its observable fields.

useObservableRef

import { action, computed, observable } from 'mobx';
import { useObservableRef } from '@cloudbeaver/core-blocks';

function useSearchState(items: readonly string[]) {
  return useObservableRef(
    () => ({
      query: '',
      get filteredItems(): readonly string[] {
        return this.items.filter(item => item.includes(this.query));
      },
      setQuery(query: string) {
        this.query = query;
      },
    }),
    {
      query: observable.ref,
      items: observable.ref,
      filteredItems: computed,
      setQuery: action.bound,
    },
    { items },
  );
}
  • Read changing inputs through this and pass them in the third argument. A closure in the factory can keep the first render's values.
  • Keep editable local fields out of the update object: it overwrites local changes. Pass false when there are no inputs to update; omitting the third argument reapplies values from init.
  • After await, wrap observable changes in runInAction; an action does not cover the continuation.
  • Read observable fields inside an observer render or a tracked getter, not as snapshots destructured before that read. Otherwise MobX cannot track the source field.

Compose hooks

Pass one hook's result into the next. Keep the connection visible instead of copying values between independent states with effects. For example:

const source = useItemsSource(projectId);
const search = useItemsSearch(source);
const selection = useItemsSelection(search);

The receiving hook reads the source object in its getters and operations. If that source can be replaced, pass it through the third argument of useObservableRef. Do not copy its current fields into a second state. This keeps one owner for each value and preserves reactivity.

Keep hooks unconditional and at the top level. If the wiring itself grows, extract a composing hook. A component coordinating several responsibilities should show the flow, not implement all their state transitions.

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.