> mobx
You are an expert in MobX, the simple and scalable state management library based on transparent reactive programming. You help developers build React applications with observable state, automatic tracking of dependencies, computed values, actions for state mutations, and reactions for side effects — providing a natural, class-based or functional approach where the UI automatically updates when state changes without manual subscriptions.
curl "https://skillshub.wtf/TerminalSkills/skills/mobx?format=md"MobX — Reactive State Management
You are an expert in MobX, the simple and scalable state management library based on transparent reactive programming. You help developers build React applications with observable state, automatic tracking of dependencies, computed values, actions for state mutations, and reactions for side effects — providing a natural, class-based or functional approach where the UI automatically updates when state changes without manual subscriptions.
Core Capabilities
Observable Store
import { makeAutoObservable, runInAction, reaction, autorun } from "mobx";
import { observer } from "mobx-react-lite";
class TodoStore {
todos: Todo[] = [];
filter: "all" | "active" | "done" = "all";
isLoading = false;
constructor() {
makeAutoObservable(this); // Auto-detect observables, computeds, actions
}
// Computed (auto-cached, updates when dependencies change)
get filteredTodos() {
switch (this.filter) {
case "active": return this.todos.filter(t => !t.done);
case "done": return this.todos.filter(t => t.done);
default: return this.todos;
}
}
get stats() {
return {
total: this.todos.length,
done: this.todos.filter(t => t.done).length,
remaining: this.todos.filter(t => !t.done).length,
};
}
// Actions (state mutations)
addTodo(text: string) {
this.todos.push({ id: crypto.randomUUID(), text, done: false });
}
toggleTodo(id: string) {
const todo = this.todos.find(t => t.id === id);
if (todo) todo.done = !todo.done; // Direct mutation — MobX tracks it
}
removeTodo(id: string) {
this.todos = this.todos.filter(t => t.id !== id);
}
// Async action
async fetchTodos() {
this.isLoading = true;
try {
const response = await fetch("/api/todos");
const data = await response.json();
runInAction(() => { // Wrap post-await mutations
this.todos = data;
this.isLoading = false;
});
} catch {
runInAction(() => { this.isLoading = false; });
}
}
}
const todoStore = new TodoStore();
// Observer component — auto-tracks which observables are used
const TodoList = observer(() => {
const { filteredTodos, stats, isLoading } = todoStore;
if (isLoading) return <Spinner />;
return (
<div>
<p>{stats.remaining} remaining</p>
<ul>
{filteredTodos.map(t => (
<li key={t.id} onClick={() => todoStore.toggleTodo(t.id)}
style={{ textDecoration: t.done ? "line-through" : "none" }}>
{t.text}
</li>
))}
</ul>
</div>
);
});
// Reactions (side effects when state changes)
reaction(
() => todoStore.stats.remaining,
(remaining) => { document.title = `${remaining} todos left`; },
);
Installation
npm install mobx mobx-react-lite
Best Practices
- makeAutoObservable — Use in constructor; automatically makes properties observable, getters computed, methods actions
- observer() — Wrap React components with
observer; only re-renders when accessed observables change - Direct mutations — Mutate state directly in actions (
this.todos.push(...)) — MobX uses Proxy to track changes - runInAction — Wrap state changes after
awaitinrunInAction(); required for async actions - Computed values — Use getters for derived data; MobX caches results and recalculates only when dependencies change
- Reaction for side effects — Use
reaction()orautorun()for logging, localStorage sync, API calls on state change - Small stores — Create multiple domain stores (AuthStore, CartStore, UIStore); inject via React context or import
- Don't destructure — Don't destructure observables outside observer:
const { count } = storebreaks tracking; access viastore.count
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zoho
Integrate and automate Zoho products. Use when a user asks to work with Zoho CRM, Zoho Books, Zoho Desk, Zoho Projects, Zoho Mail, or Zoho Creator, build custom integrations via Zoho APIs, automate workflows with Deluge scripting, sync data between Zoho apps and external systems, manage leads and deals, automate invoicing, build custom Zoho Creator apps, set up webhooks, or manage Zoho organization settings. Covers Zoho CRM, Books, Desk, Projects, Creator, and cross-product integrations.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> zipkin
Deploy and configure Zipkin for distributed tracing and request flow visualization. Use when a user needs to set up trace collection, instrument Java/Spring or other services with Zipkin, analyze service dependencies, or configure storage backends for trace data.