ModsCode / Claude Code Mods / Ranking / poker
poker
No-Limit Texas Hold'em against styled bots in a Claude Code pane (/poker)
What it does
- Draws a pane
- Adds /poker
- Watches AskUserQuestion calls and can refuse them
- Hooks classic.PermissionRequest, classic.Stop, prompt.submit, session.end and 2 more
- Keeps its own state between turns
Good points
- No network calls
- Starts no processes
- Written in TypeScript
- Handles errors
Code to start from
A starter ModsCode writes from the drawing it read, and the mod's own lines that draw, where there are any.
Starter (register.tsx)
import type { Register } from 'claude-code'
// Drawn like poker by LyInfi (pane, toast), as ModsCode read it from the mod's code:
// https://modscode.com/claude-mods/mods/lyinfi-poker/
// Written by ModsCode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
// the pane: open it with $.ui.open({ id: 'my-pane', title: "‹t›" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button, Input } = $.ui.resolve(e)
const t = '…'
const stake = '…'
const t2 = '…'
const chips = '…'
const t3 = '…'
const hands = '…'
const t4 = '…'
const signed = '…'
const t5 = '…'
const title = '…'
const t6 = '…'
const hints = '…'
const fmt = '…'
const raiseVerb = '…'
const key = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row" justifyContent="space-between" marginBottom={1}>
<Text>
<Text color="#D97757" bold>
{"♠ "}
{t}
</Text>
<Text dimColor>
{stake}
</Text>
<Text dimColor>
{" · "}
{t2}
{" "}
{chips}
{" · "}
{t3}
{" "}
{hands}
{" · "}
{t4}
{" "}
</Text>
<Text color="green">
{signed}
</Text>
</Text>
<Button hotkey="s" plain>
{`${t} ▴`}
</Button>
</Box>
<Box flexDirection="row" gap={3} justifyContent="flex-end" flexWrap="wrap">
<Button hotkey="l" plain />
<Button hotkey="v" plain>
{`${t} A♠`}
</Button>
<Button hotkey="u" plain>
{`${t} BB`}
</Button>
</Box>
<Box justifyContent="center" height={1}>
<Text color="green" bold>
{t5}
</Text>
</Box>
<Box flexDirection="column" flexGrow={1} justifyContent="center" alignItems="center">
<Box flexDirection="column" width={72}>
<Box marginTop={1}>
<Box flexDirection="column" width="72">
<Box flexDirection="row">
<Text dimColor>
{`╭─${title}─────────`}
</Text>
<Button hotkey="k" plain>
↑
</Button>
<Text dimColor>
─
</Text>
<Button hotkey="j" plain>
↓
</Button>
<Text dimColor>
─╮
</Text>
</Box>
</Box>
</Box>
<Box flexDirection="column" minHeight={4} marginTop={1}>
<Box flexDirection="column">
<Text>
<Text color="#D97757" bold>
{"❯ "}
{t6}
</Text>
<Text dimColor>
{" · "}
{hints}
</Text>
</Text>
<Box flexDirection="row" gap={2} flexWrap="wrap" paddingLeft={2}>
<Button hotkey="f" plain />
<Button hotkey="c" plain autoFocus>
{`${t} ${fmt}`}
</Button>
<Button hotkey="r" plain>
{`${raiseVerb} ${fmt}`}
</Button>
<Button hotkey="a" plain>
{`${t} ${fmt}`}
</Button>
</Box>
<Box flexDirection="row" gap={2} flexWrap="wrap" paddingLeft={2}>
<Button hotkey={`${key}`} plain>
{`2.5x ${fmt}`}
</Button>
<Button hotkey={`${key}`} plain>
{`2.5x ${fmt}`}
</Button>
<Button hotkey={`${key}`} plain>
{`2.5x ${fmt}`}
</Button>
</Box>
<Box paddingLeft={2}>
<Input label={`${raiseVerb}`} placeholder={`${fmt}–${fmt}`} />
</Box>
</Box>
</Box>
</Box>
</Box>
</Box>
)
})
}
The mod's own code
Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.
mods/poker/hooks/register.tsx lines 235–244 · Pane
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const els = $.ui.resolve(e)
const g = await read($, game)
const why = await read($, alert)
const up = await read($, logScroll)
const columns = e.props.bodyColumns ?? e.viewport?.columns ?? 80
const rows = e.props.scroll?.bodyRows ?? e.viewport?.rows ?? 24
const open = await read($, settingsOpen)
return tableView(els as never, g, why, up, open, columns, rows, await background($), intents($))
})mods/poker/ui/view.tsx lines 36–56 · Pane
export function tableView(els: Els, g: Game, alert: Alert | null, logScroll: number, settingsOpen: boolean, columns: number, rows: number, background: string | undefined, on: Intents) {
const { Box, Text } = els
const lang = g.profile.lang
return (
<Box flexDirection="column" width={columns} minHeight={rows} backgroundColor={background}>
{header(els, g, lang, settingsOpen, on)}
{settingsOpen && settings(els, g, lang, on)}
{/* one row held for the alert, shown or not, so nothing below it moves */}
<Box justifyContent="center" height={1}>
{alert && (
<Text color={alert === 'done' ? 'green' : 'yellow'} bold>
{t(lang, alert === 'permission' ? 'alertPermission' : alert === 'question' ? 'alertQuestion' : 'alertDone')}
</Text>
)}
</Box>
<Box flexDirection="column" flexGrow={1} justifyContent="center" alignItems="center">
{g.table ? seated(els, g, g.table, lang, columns, logScroll, on) : lobby(els, g, lang, columns, on)}
</Box>
</Box>
)
}mods/poker/ui/view.tsx lines 59–83 · Pane
function header(els: Els, g: Game, lang: Lang, settingsOpen: boolean, on: Intents) {
const { Box, Text, Button } = els
const p = g.profile
const stake = g.table ? ` · ${g.table.smallBlind}/${g.table.bigBlind}` : ''
return (
<Box flexDirection="row" justifyContent="space-between" marginBottom={1}>
<Text>
<Text color={ACCENT} bold>
♠ {t(lang, 'title')}
</Text>
<Text dimColor>{stake}</Text>
<Text dimColor>
{' · '}
{t(lang, 'bankroll')} {chips(p.bankroll)} · {t(lang, 'hands')} {p.hands} · {t(lang, 'net')}{' '}
</Text>
<Text color={p.net > 0 ? 'green' : p.net < 0 ? 'red' : undefined} dimColor={p.net === 0}>
{signed(p.net)}
</Text>
</Text>
<Button key="settings" hotkey="s" plain onPress={on.toggleSettings}>
{`${t(lang, 'settings')} ${settingsOpen ? '▴' : '▾'}`}
</Button>
</Box>
)
}mods/poker/ui/view.tsx lines 123–138 · Pane
function settings(els: Els, g: Game, lang: Lang, on: Intents) {
const { Box, Button } = els
return (
<Box flexDirection="row" gap={3} justifyContent="flex-end" flexWrap="wrap">
<Button key="lang" hotkey="l" plain onPress={on.toggleLang}>
{t(lang, 'language')}
</Button>
<Button key="cards" hotkey="v" plain onPress={on.toggleCards}>
{`${t(lang, 'cardStyle')} ${g.profile.cardStyle === 'compact' ? 'A♠' : '[A♠]'}`}
</Button>
<Button key="unit" hotkey="u" plain onPress={on.toggleUnit}>
{`${t(lang, 'unit')} ${g.profile.chipUnit === 'bb' ? 'BB' : t(lang, 'chips')}`}
</Button>
</Box>
)
}mods/poker/ui/view.tsx lines 140–153 · Pane
function seated(els: Els, g: Game, table: TableState, lang: Lang, columns: number, logScroll: number, on: Intents) {
const { Box } = els
const wide = columns >= TABLE_COLS
return (
<Box flexDirection="column" width={wide ? TABLE_COLS : columns}>
{wide ? drawTable(els, g, table, lang) : drawList(els, g, table, lang, columns)}
{/* fixed heights below the table: the centered block keeps one size through the Hand */}
<Box marginTop={1}>{drawLog(els, g, table, lang, wide ? TABLE_COLS : columns, logScroll, { up: () => on.scrollLog(1), down: () => on.scrollLog(-1) })}</Box>
<Box flexDirection="column" minHeight={CONTROL_ROWS} marginTop={1}>
{controls(els, g, table, lang, on)}
</Box>
</Box>
)
}mods/poker/ui/art.tsx lines 296–398 · Pane
export function drawLog(els: Els, g: Game, table: TableState, lang: Lang, cols: number, scroll: number, on: { up: () => void; down: () => void }) {
const fmt = amountOf(g, table)
const inner = cols - 4
const lines: Runs[] = []
let line: Runs = []
let used = 0
const name = (seat: number): [string, Ink?] => {
const o = table.seats[seat]
return [o?.kind === 'player' ? t(lang, 'you') : (o?.name ?? '?'), { bold: o?.kind === 'player' }]
}
const runsWidth = (runs: Runs) => runs.reduce((w, [text]) => w + width(text), 0)
const newLine = (label: Runs = []) => {
if (line.length) lines.push(line)
const pad = LABEL_COLS - runsWidth(label)
line = [...label, [' '.repeat(Math.max(1, pad))]]
used = Math.max(LABEL_COLS, runsWidth(label) + 1)
}
/** Adds one item after a separator, wrapping onto an indented line when it does not fit. */
const add = (item: Runs) => {
const w = runsWidth(item)
const first = used <= LABEL_COLS
if (!first && used + 3 + w > inner) newLine()
if (used > LABEL_COLS && line.length > 1) {
line.push([' · ', DIM])
used += 3
}
line.push(...item)
used += w
}
const board = table.hand?.board ?? []
let settled = false
const SIZE = { preflop: 0, flop: 3, turn: 4, river: 5 } as const
newLine([[t(lang, 'preflop'), DIM]])
for (const e of g.log) {
switch (e.kind) {
case 'blind':
add([name(e.seat), [` ${e.blind} `, DIM], [fmt(e.amount)]])
break
case 'action': {
const amount: Runs = e.action === 'fold' || e.action === 'check' ? [] : [[` ${fmt(e.to)}`]]
add([name(e.seat), [` ${t(lang, e.action)}`, DIM], ...amount])
break
}
case 'street':
newLine([[t(lang, e.street), DIM]])
line.push(...compact(board.slice(0, SIZE[e.street])))
used += runsWidth(compact(board.slice(0, SIZE[e.street])))
newLine()
break
case 'pot': {
// the first pot starts the result group under its label; the rest follow beneath
newLine(settled ? [] : [[t(lang, 'settle'), DIM]])
settled = true
const label = e.index === 0 ? t(lang, 'mainPot') : `${t(lang, 'sidePot')} ${e.index}`
const who = e.winners.map((s) => name(s)[0]).join(', ')
const verb = e.winners.length > 1 ? t(lang, 'split') : t(lang, 'wins')
const how = e.category === null ? '' : ` (${categoryName(lang, e.category)})`
line.push([`${label} ${fmt(e.amount)}: ${who} ${verb}${how}`, { color: 'green' }])
used = inner
break
}
}
}
if (line.some(([text]) => text.trim() !== '')) lines.push(line)
// the window over the lines: from row `scroll`, or the newest rows while following (-1)
const maxTop = Math.max(0, lines.length - LOG_ROWS)
logMaxTop = maxTop
const top = scroll < 0 ? maxTop : Math.min(scroll, maxTop)
const shown = lines.slice(top, top + LOG_ROWS)
// the top border is a row of its own, carrying the scroll keys; the canvas draws the rest
const { Box, Text, Button } = els
const title = ` ${t(lang, 'logTitle')} `
const keys = 4 + 1 + 4 // `k: ↑`, a rule, `j: ↓`
const rule = Math.max(1, cols - 2 - width(title) - keys - 3)
const canvas = new Canvas(cols, LOG_ROWS + 1)
for (let y = 0; y < LOG_ROWS; y++) {
canvas.put(0, y, '│', DIM)
canvas.put(cols - 1, y, '│', DIM)
}
canvas.put(0, LOG_ROWS, '╰' + '─'.repeat(cols - 2) + '╯', DIM)
if (top > 0) canvas.put(cols - 1, 0, '▲', { color: ACCENT })
if (top < maxTop) canvas.put(cols - 1, LOG_ROWS - 1, '▼', { color: ACCENT })
shown.forEach((runs, i) => canvas.spans(2, i, runs))
return (
<Box key="log" flexDirection="column" width={cols}>
<Box flexDirection="row">
<Text dimColor>{`╭─${title}${'─'.repeat(rule)}─`}</Text>
<Button key="log-up" hotkey="k" plain onPress={on.up}>
↑
</Button>
<Text dimColor>─</Text>
<Button key="log-down" hotkey="j" plain onPress={on.down}>
↓
</Button>
<Text dimColor>─╮</Text>
</Box>
{canvas.draw(els, 'log-body')}
</Box>
)
}Licence text (MIT)
MIT License Copyright (c) 2026 LyInfi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
How to build this: Pane (panel), Deny a tool call
What its code calls
tool callsremembers
What its code shows
Read from the source at commit 0cdac71947f4. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.
| Decides the listing: code you can check | |
|---|---|
| Entry read | Every module hooks/hooks.json names was read.mods/poker/hooks/register.tsx |
| Parses | Every file parses as TypeScript or JavaScript.12 files parsed |
| All its code is in the mod | Every import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod |
| Readable | No minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs |
| Calls in the open | Network and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open |
| For you to weigh before installing | |
| Where it draws | The terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both |
| Install line | Whether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there |
| Programs on Windows | Whether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks |
| Network | Whether every fetch names its https host in the code.no network |
| Programs | Whether every program it starts is named in the code and is not a shell, an interpreter or a network tool.starts no programs |
| Reads and sends | Whether it both reads something of yours (files, environment variables, the transcript, settings) and reaches outside (the network, an MCP server, another session, telemetry).reaches nothing outside |
| Keys in the source | Whether the source holds what looks like an API key or a private key.no keys in the source |
| Licence | An open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets ModsCode show its code; otherwise the code is linked.MIT |
| Settings hooks | Hooks declared in hooks/hooks.json or plugin.json beside the module: a command (a shell when it has no args), an HTTP request, an MCP tool or a model prompt at an event. They run outside $.no settings hooks: its function hooks alone |
| Servers it ships | MCP servers (a program, or a URL; a headersHelper is a shell command; a .mcpb bundle is unpacked at run time), LSP servers, monitors (a shell command for the whole session) and bin/ (on the PATH of the Bash tool).ships no MCP or LSP server, no monitor, no bin/ |
| Skills, commands, agents | What its Markdown declares beyond text: allowed-tools granted for the turn, hooks added when a skill is invoked, a command run before Claude reads the skill.no skills, commands, agents or workflows |
| Tools and MCP | Whether every tool it calls through $.tool.call and $.mcp.call is named in the code, and none is a shell (Bash through the tool runs a shell without $.process).calls no tool, MCP server or command |
| Asks of the model | Completions it runs ($.model.complete, fork, classify), subagents it spawns, prompts it submits as you, and the tools, commands and agents it adds.adds command poker |
| Events it hooks | By what a hook there can do: gates (refuse a tool call, a prompt, a setting, another plugin), shapes (what the model reads: the system prompt, tool descriptions, each request), reads (your input, the events of the settings hooks, every event with *), and the rest.gates: command.run (poker), classic.PermissionRequest, tool.call (AskUserQuestion), classic.Stop, prompt.submit · also: session.start, session.end, ui.render (Pane), ui.scroll (Pane) · timers: clock.after |
| Reads, by name | The environment variables and files it names, and whether it reads the transcript, settings.json, the prompt box or the mouse selection.reads no files, environment variables, settings or transcript |
| Writes, by name | The files and environment variables it names, and whether it changes settings, the prompt box, the clipboard, the conversation (a row the model reads) or another session.writes no files, environment variables, settings or conversation rows |
This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen
Install it
Check it yourself before you install it. Mods run unsandboxed, with your permissions, and ModsCode does not vouch for what this code does. Read its code (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.
From its marketplace
Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:
/plugin marketplace add LyInfi/claude-code-mods/plugin install poker@lyinfi-mods/reload-pluginsThis installs the marketplace's latest commit, which may not be the one read here (0cdac71947f4). Compare them before you install. /reload-plugins loads it into a session that is already open.
Try the commit ModsCode read
No marketplace needed. In a terminal, clone the repository, check out the commit read, validate the mod, and load it for one session:
git clone https://github.com/LyInfi/claude-code-modsgit -C claude-code-mods checkout 0cdac71947f4c6b1335c9d678cc2dc03c9c0fcffclaude plugin validate claude-code-mods/mods/pokerclaude --plugin-dir claude-code-mods/mods/pokerThe validate line lists the events the mod hooks and what it asks Claude Code to do, without running it. The last line loads the mod for this session only and writes nothing to your settings. If the author has rewritten history, the commit may no longer exist.
Ask Claude about it
With the ModsCode connector added, Claude can read this mod's code and what it reaches, and build on them. Ask it like this:
Read the ModsCode mod "lyinfi-poker" with its code and make me one like itSearch them from Claude: the MCP connector
Similar mods
- code-modernizationAnthropic★ 37,653
- lcu-approveLCU★ 894
- ai-maestro-secrets23blocks-OS★ 817
- filetreeKurt Buhler★ 131
- great-ctoAlexander Velikiy★ 103
- hopeSaad Shahd★ 35
Badge for your README
If this is your mod, paste this into your README. It links to this page.
[](https://modscode.com/claude-mods/mods/lyinfi-poker/)