use-deact-hook
Use Deact hooks for state management, memoization, and side effects. Reference for all available hooks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use Deact hooks for state management, memoization, and side effects. Reference for all available hooks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Add new moves to the battle system. Use when implementing attack, status, or support moves for Pokemon.
Add a Pokemon (real or fake) to src/config/pokemonConfig.js with its moves, abilities, rarity, and evolution data. Use when the user asks to add, register, implement, or create a new Pokemon, Pokemon form, or fake/custom Pokemon in the battle system.
Find a Pokemon's Discord emoji string — canonical (e.g. `<:25:1100282072003772457>`) from `pokestar-pk-{n}`, form variants (e.g. `<:483origin:1404654211324448848>`) from `pokestar-forms-1`, or fakemon (e.g. `<:ashpikachu:1109522092283658250>`) from `pokestar-pk-extra` — via Playwright CLI. Use when the user asks for a Pokemon's emoji, emoji ID, form emoji, fakemon emoji, or needs an `<:name:snowflake>` string.
Create an implementation plan before adding one or more Pokemon via the `add-pokemon` skill. Builds Pokemon, moves, and abilities tables with all required inputs, flags unimplemented moves/abilities, and produces step-by-step implementation instructions. Use when the user asks to plan adding a Pokemon, plan a Pokemon batch, or invokes this skill before `add-pokemon`.
Verify Discord bot changes by running the bot and testing commands in Discord via Playwright CLI. Use when the user asks to test, verify, or check bot commands in Discord.
Verify a Pokemon's configuration in pokemonConfig.js by testing its moves and abilities in Discord via Playwright CLI. Use when validating a Pokemon's battle behavior after configuration changes.
| name | use-deact-hook |
| description | Use Deact hooks for state management, memoization, and side effects. Reference for all available hooks. |
Hooks are re-usable functions in Deact elements inspired by React hooks. Similarly to React hooks, they should always be invoked in the same order within a component.
All hooks require ref as the last parameter.
// React
const [value, setValue] = useState(0);
// Deact
const [value, setValue] = useState(0, ref);
deact.js)useStateuseRefuseMemouseCallbackconst userData = await useAwaitedMemo(() => fetchUser(userId), [userId], ref);
useAwaitedMemouseAwaitedEffectBind a callback to Discord component interactions (buttons, select menus). Refer to the deact-component-callback skill on how to use.
Handle modal form submissions.
const onSubmitKey = useModalSubmitCallbackBinding(
(interaction, data) => {
const inputValue = interaction.fields.getTextInputValue("inputId");
setFormValue(inputValue);
},
ref,
{ defer: true },
);
const [page, setPage] = useState(1, ref);
const prevKey = useCallbackBinding(() => setPage((p) => p - 1), ref);
const nextKey = useCallbackBinding(() => setPage((p) => p + 1), ref);
const [isOpen, setIsOpen] = useState(false, ref);
const toggleKey = useCallbackBinding(() => setIsOpen((v) => !v), ref);
const [filter, setFilter] = useState({}, ref);
const filteredItems = useMemo(
() => items.filter((item) => matchesFilter(item, filter)),
[items, filter],
ref,
);
const result = await useAwaitedMemo(() => fetchData(id), [id], ref);
if (result.err) {
return { err: result.err };
}
const data = result.data;
Custom hooks are created in src/hooks and can be used for more specific purposes. Refer to the create-deact-hook skill on creating a custom hook.
Like React, dependencies determine when hooks re-run:
// Always recalculates (no deps = every render)
useMemo(() => compute(), [], ref);
// Recalculates when a or b changes
useMemo(() => compute(a, b), [a, b], ref);
Include all values used inside the callback that could change.
ref as last argumentawait async hooks (useAwaitedMemo, useAwaitedEffect)defer: false for callbacks that show modals