create-deact-hook
Create custom Deact hooks for reusable UI logic. Use when extracting shared state/callback patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create custom Deact hooks for reusable UI logic. Use when extracting shared state/callback patterns.
用 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 | create-deact-hook |
| description | Create custom Deact hooks for reusable UI logic. Use when extracting shared state/callback patterns. |
File location: src/hooks/useYourHook.js
Naming convention: Always prefix with use (e.g., usePagination, useInfoToggle)
const {
useState,
useCallbackBinding,
createElement,
} = require("../deact/deact");
/**
* @param {object} param0
* @param {number=} param0.initialValue
* @param {DeactElement} ref
* @returns {{ value: number, setValue: Function, buttonElement: CreateElementResult }}
*/
const useMyHook = ({ initialValue = 0 }, ref) => {
// State and logic here
return {
// Return values, setters, and pre-built elements
};
};
module.exports = useMyHook;
ref is always the last parameter (not a hook call)await for data fetchingcreateElement results - pre-built UI componentsconst {
useState,
useCallback,
useCallbackBinding,
createElement,
} = require("../deact/deact");
const { ButtonStyle } = require("discord.js");
const Button = require("../deact/elements/Button");
const useInfoToggle = ({ initial = false, deferToggle = false }, ref) => {
const [isToggled, setIsToggled] = useState(initial, ref);
const toggle = useCallback(
() => {
setIsToggled((prev) => !prev);
},
[],
ref,
);
const toggleBindingKey = useCallbackBinding(toggle, ref, {
defer: deferToggle,
});
const toggleButton = createElement(Button, {
label: "ⓘ",
callbackBindingKey: toggleBindingKey,
style: isToggled ? ButtonStyle.Primary : ButtonStyle.Secondary,
});
return {
isToggled,
toggle,
toggleButton,
};
};
module.exports = useInfoToggle;
ref is always the last parameteruseawaited when calleduse-deact-hook - How to use hooks in elements (useState, useMemo, useCallbackBinding, etc.)deact-component-callback - Handling component interactions in callbacksreferences/pattern-pagination-hook.md - Pagination with scroll buttonsreferences/pattern-async-data-hook.md - Async hook with data fetchingreferences/pattern-callback-options.md - Passing through callback options