mobx
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "mobx" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-211c68b4a8042bbbb7c9d7548d3d5f20b0ec95a0686dc3ef910541556a5c0b60. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Expert information on MobX, a state management library based on transparent reactive programming. Suitable for helping developers use observable state, automatic dependency tracking, computed values, actions for state changes, and reactions for side effects in React applications to achieve automatic UI updates when state changes.
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Testing
- Not tested
Browse files
Frontmatter
name: mobx
description: >-
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.
license: Apache-2.0
compatibility: ''
metadata:
author: terminal-skills
version: 1.0.0
category: Frontend Development
tags:
- react
- state-management
- observable
- reactive
- proxy
- automaticMobX — 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
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供 MobX 状态管理的完整知识体系,对 React 开发者具有明确实用价值
- 涵盖核心概念、代码示例、最佳实践,帮助用户快速上手
Highlights
- description 清晰定义了 MobX 专家角色和适用场景
- frontmatter 中 description 完整,覆盖 React 状态管理、observable、reactive 等关键词
Highlights
- 文档结构清晰,包含核心能力、代码示例、安装指南、最佳实践等章节
- 提供完整的 TypeScript 示例,frontmatter 完整
Highlights
- 代码示例语法正确,工具来源明确(mobx、mobx-react-lite)
- 涵盖异步操作、错误处理、反应式副作用等关键场景
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 126
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.