with one click
create-command
Creates a new command for the StickerBot WhatsApp bot.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Creates a new command for the StickerBot WhatsApp bot.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments. TRIGGER ao escrever ou revisar qualquer código no projeto.
Checklists de entrega — verificações antes de fechar feature/PR/commit: type-check (npm run build no Docker), comportamento verificado (não só compila), leis do projeto respeitadas (migração via ensureColumn, permissão grupo vs bot, concorrência fire-and-forget, backup antes de destrutivo). TRIGGER antes de commit/PR de feature, ao finalizar implementação, na verification phase do spec-implement, ou quando o usuário pede "está pronto?" / "revisa antes de mergear".
StickerBot — leis always-on do sistema. TRIGGER ao mexer com: banco de dados / schema / migração (Drizzle + MySQL, sem framework de migração → ensureColumn), criar ou editar comando (auto-loader em src/handlers/text.ts, permissões admin-do-grupo vs admin-do-bot), handlers fire-and-forget / estado em memória / concorrência, config em runtime (Settings + cache), envio de mensagem/menção/mídia via Baileys, ou ao fazer operação destrutiva no banco em produção. Estas leis são a autoridade máxima sobre restrições do sistema.
Estratégias de refatoração segura — quebrar arquivos grandes, extrair função/handler quando um bloco fica grande demais, Dispatcher Pattern para orquestradores grandes, refator incremental (slice, não big-bang), preservar API pública estável, 1 commit = 1 transformação reversível, NUNCA misturar refator + feature no mesmo commit. TRIGGER quando um arquivo/função cresce demais, ou quando o usuário pede "refatora", "extrai", "limpa esse arquivo", "quebra esse monolito", ou ao revisar PR pra detectar code smell de tamanho.
Spec-Driven Development unificado em 3 fases + Modo Retroativo. Plan (design.md + impact.md + tasks.md em .specs/<feature>/ com gates de aprovação), Implement (executa tasks uma a uma com checkpoint + post-task verification + 3-Strike Error Protocol, mantém journal.md vivo registrando desvios, erros+soluções e pedidos extras), Reflect (análise pós-implementação visitando journal.md, propondo criar workflow-<feature> skill, atualizar CLAUDE.md, cross-references e aprendizados em rules). Modo Retroativo faz engenharia reversa de feature já implementada SEM spec. TRIGGER ao iniciar feature nova, planejar implementação complexa multi-arquivo, executar spec já planejado em .specs/, capturar desvios durante implementação, ou consolidar/documentar conhecimento de um módulo.
Como criar e editar comandos do StickerBot. TRIGGER ao adicionar um comando novo em src/commands/, editar um comando existente, mexer com permissões (admin do grupo vs admin do bot), parsing de argumentos, respostas/reações, menções ou subcomandos. Cobre o auto-loader, a interface StickerBotCommand, checkCommand, os helpers de baileysHelper e os padrões de permissão.
| name | create_command |
| description | Creates a new command for the StickerBot WhatsApp bot. |
When asked to create a new command for StickerBot, follow these steps strictly to ensure the command is correctly hooked into the command processor (src/handlers/text.ts) and follows project standards.
src/commands/ directory.ping.ts, sticker.ts, ban.ts).command constant of type StickerBotCommand.StickerBotCommand)Your new file must match the following template exactly, pulling types from src/types/Command.ts and src/types/Message.ts.
import path from 'path'
import { GroupMetadata } from '@whiskeysockets/baileys'
import { StickerBotCommand } from '../types/Command'
import { WAMessageExtended } from '../types/Message'
import { checkCommand } from '../utils/commandValidator'
import { getLogger } from '../handlers/logger'
import { sendMessage, react } from '../utils/baileysHelper'
import { capitalize } from '../utils/misc'
import { emojis } from '../utils/emojis'
// Gets the logger
const logger = getLogger()
// Dynamic import resolution
const extension = __filename.endsWith('.js') ? '.js' : '.ts'
const commandName = capitalize(path.basename(__filename, extension))
export const command: StickerBotCommand = {
name: commandName,
aliases: ['mycommand', 'alias2'], // All aliases the user can type to invoke the command
desc: 'Describe what the command does here.',
example: 'mycommand [param]', // Show how to use it, or undefined if no params
needsPrefix: true, // Requires !, /, etc.
inMaintenance: false, // Set to true to disable temporarily
runInPrivate: true, // Can run in private chats?
runInGroups: true, // Can run in group chats?
onlyInBotGroup: false, // Only in official bot groups?
onlyBotAdmin: false, // Only for bot admins?
onlyAdmin: false, // Only for group admins?
onlyVip: false, // Only for VIPs?
botMustBeAdmin: false, // Does the bot need group admin rights to perform this?
interval: 5, // Cooldown in seconds
limiter: {}, // DO NOT TOUCH
run: async (
jid: string,
sender: string,
message: WAMessageExtended,
alias: string,
body: string,
group: GroupMetadata | undefined,
isBotAdmin: boolean,
isVip: boolean,
isGroupAdmin: boolean,
amAdmin: boolean
) => {
// ALWAYS run the checkCommand first
const check = await checkCommand(jid, message, alias, group, isBotAdmin, isVip, isGroupAdmin, amAdmin, command)
if (!check) return
// --- YOUR COMMAND LOGIC GOES HERE ---
try {
// 1. Process body parameters (all text after the command prefix and alias)
const params = body.slice(command.needsPrefix ? 1 : 0).replace(new RegExp(`^${alias}\\s*`, 'i'), '').trim()
// 2. Do something...
await react(message, emojis.wait) // Example: react with a loading emoji
// 3. Send response
return await sendMessage({ text: 'Command executed successfully!' }, message)
} catch (error) {
logger.error(`Error in ${commandName}:`, error)
return await react(message, emojis.error)
}
}
}
Use the existing helper functions in src/utils/baileysHelper.ts instead of reinventing the wheel. Most useful helpers:
sendMessage(content, messageContext): Safely sends a text, image, format, etc.react(message, emojiString): Adds a reaction directly to the sender's message.getMentionedJids(message): Extracts mentioned tags for commands that target others.getQuotedMessage(message): Returns the message that the user is quoting/replying to.getPhoneFromJid(jid): Async. Resolves proper phone strings, avoiding Baileys v7 LID/DDI formatting bugs.compareJids(jid1, jid2): Async. Robustly compares two users, regardless of LID vs JID status.isJidInParticipantList(jid, participants): Async. Checks membership safely.isJidAdminOfGroup(jid, group): Async. Checks if a user is admin safely.amAdminOfGroup(group): Async. Checks if the bot is admin safely.try/catch and log it using logger.error().emojis.error) or an error message to the user when something goes wrong.After creating the file, advise the user to:
npx tsc --noEmit runs completely clean with no type issues.src/handlers/text.ts will automatically load any .ts/.js file inside src/commands/. The user just needs to start the bot.