betting-app-skill

by skllsVerified

Claude skill for building full-stack pari-mutuel sports betting apps with Next.js + Supabase

0
Stars
0
Forks
8/24/2026
Added
View on GitHubDownload ZIP

⚠️ Third-Party Software Notice

This skill is third-party open-source software developed and hosted independently on GitHub. SkillTip is an informational directory and does not control or maintain the underlying repository. Any security checks displayed are automated and limited in scope. Review the source code before installing.

Read the Terms of Service

Installation

Add to your Claude Code skills directory:

# Add to your Claude Code skills
git clone https://github.com/sklls/betting-app-skill

Getting Started

Guides for using skills like betting-app-skill.

Security Report

Verified

Last scanned: —

{
  "status": "PASSED",
  "issues": []
}

README.md

🏏 Betting App — Claude Skill

A production-tested Claude skill that teaches Claude how to build full-stack sports betting and prediction market apps — with correct odds math, atomic wallet logic, and zero data integrity bugs.

Claude Skill Stack License


What Is This?

This is a Claude skill — a knowledge file that makes Claude dramatically better at building betting and prediction market apps. Instead of giving generic boilerplate, Claude uses this skill to apply patterns proven in a real production app that ran a full cricket tournament with 15+ players and 200+ bets with zero data integrity incidents.

Reference implementation: github.com/sklls/BPL_BET


Who Is This For?

  • Developers building sports betting platforms, fantasy leagues, or office pools
  • Anyone adding prediction markets or wagering to an existing app
  • Developers who want to avoid the painful bugs that come with financial logic (double-spend, race conditions, stale odds)

What Problems Does This Skill Solve?

Building a betting app looks simple until you hit these walls:

ProblemWhat Goes Wrong Without This Skill
Race conditionsTwo users bet at the same time, one overdrafts their wallet
Wrong odds previewThe odds shown to the user before placing don't match the odds recorded after placing
Stale dataAdmin sees yesterday's totals; leaderboard doesn't update after new bets
RLS bypassesLeaderboard and admin pages silently return empty data because of Row Level Security
TypeScript errorsSupabase join types come back as arrays but are actually objects — causes runtime crashes
Settlement bugsWinners don't get paid, or get paid the wrong amount

Every one of these is handled in the skill with the exact fix.


What's Inside the Skill?

1. Complete Database Schema

Full PostgreSQL schema for profiles, matches, markets, bet_options, bets, and transactions — with correct types, constraints, RLS policies, and foreign keys.

2. Atomic Bet Placement RPC

The place_bet Postgres function uses SELECT FOR UPDATE to lock the user's wallet row before deducting — preventing any possibility of double-spend, even under concurrent load.

SELECT wallet_balance INTO v_balance
FROM profiles WHERE id = p_user_id FOR UPDATE; -- locks the row

3. Pari-Mutuel Odds Engine (TypeScript)

The live odds formula — including the critical extraAmount trick that makes the preview odds match the final recorded odds:

// Include the player's own stake in the preview pool
// so what they see is what they get
export function calculateOdds(
  options: BetOption[],
  selectedId: string,
  extraAmount: number,   // <-- this is the key
  houseEdgePct: number
): number { ... }

4. Market Settlement with Early Bird Bonus

settle_market pays out winning bets with an optional +10% bonus for bettors who placed their bet within the first 30 minutes of a market opening — encouraging early participation over last-minute odds manipulation.

v_early_bird_cutoff := v_market_created_at + INTERVAL '30 minutes';
IF bet.placed_at < v_early_bird_cutoff THEN
  v_payout := v_payout * 1.10;  -- early bird bonus
END IF;

5. Two Supabase Clients (and When to Use Each)

// Public pages — respects RLS
createServerComponentClient() / createClientComponentClient()

// Admin, leaderboard, bettors API — bypasses RLS with service role key
createAdminClient() // uses SUPABASE_SERVICE_ROLE_KEY

6. Stale Data Prevention

Every page serving financial or live data needs this to prevent Vercel from caching old results:

export const dynamic = 'force-dynamic'

7. TypeScript Join Type Fix

Supabase types .select('profiles(display_name)') as an array, but the join returns a single object. The safe cast pattern:

const name = (bet.profiles as unknown as { display_name: string } | null)
  ?.display_name ?? 'Unknown'

8. Per-Match + Overall Leaderboard

Full pattern for a leaderboard with tab switching — server-rendered for speed, with client-side fresh fetch to avoid stale dropdown data when new matches are added.

9. Admin Financial Dashboard

Direct table queries (not RPC) for the financial overview, so numbers always reflect the current state:

// Don't use RPC — it can be stale
// Query the tables directly
const { data: topups } = await admin.from('transactions')
  .select('amount').eq('type', 'topup')

10. Common Pitfalls Table

A cheat sheet of every painful mistake, what caused it, and the exact fix — built from real production debugging sessions.


How to Install

Option A: Use the .skill file (recommended)

  1. Download betting-app.skill
  2. In Claude Code, run:
    /skills install betting-app.skill
    

Option B: Manual install

Copy SKILL.md into your Claude skills directory:

~/.claude/skills/betting-app/SKILL.md         # Mac / Linux
%APPDATA%\Claude\skills\betting-app\SKILL.md  # Windows

Once installed, Claude will automatically apply these patterns whenever you ask it to:

  • Build a betting or wagering app
  • Add prediction markets to an existing app
  • Write pari-mutuel odds logic
  • Create wallet or transaction systems

How It Was Built

This skill was extracted from BCL Bet — a real cricket tournament betting platform built from scratch over 2 weeks. Every pattern in the skill was learned the hard way:

  • The FOR UPDATE lock came from catching a wallet race condition in testing
  • The extraAmount odds trick came from users seeing different odds before and after confirming a bet
  • The force-dynamic fix came from the admin dashboard showing week-old totals
  • The early bird bonus came from the problem of everyone betting at the last second to manipulate odds
  • The admin client pattern came from the leaderboard returning zero rows due to RLS

The skill was validated with 3 eval prompts, each run with and without the skill. Average improvement: +60% on key correctness criteria.


Eval Results

TestWith SkillWithout Skill
Postgres schema + RPCs6/6 ✅2/6 ❌
Pari-mutuel odds engine (TypeScript)5/5 ✅4/5 ⚠️
Stale data fixes (Next.js + Supabase)4/4 ✅3/4 ⚠️

The biggest gaps without the skill: FOR UPDATE row lock, extraAmount in odds preview, force-dynamic on financial pages — subtle but critical.


Tech Stack

LayerTechnology
FrontendNext.js 14 (App Router), TypeScript, Tailwind CSS
BackendSupabase (PostgreSQL + RLS + Realtime)
AuthSupabase Auth
DeploymentVercel
PaymentsManual wallet top-up (admin-controlled)

Related


License

MIT — use freely, attribution appreciated.


Built from a real production app. Every pattern here was written in anger at 2am after something broke.

Frequently Asked Questions

What is betting-app-skill?

betting-app-skill is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by sklls. Claude skill for building full-stack pari-mutuel sports betting apps with Next.js + Supabase. It has 0 GitHub stars.

Is betting-app-skill safe to use?

Yes. betting-app-skill passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install betting-app-skill?

Clone the repository with "git clone https://github.com/sklls/betting-app-skill" and add it to your Claude Code skills directory (see the Installation section above). betting-app-skill ships a SKILL.md manifest, so compatible agents can discover and load it automatically.

Are there alternatives to betting-app-skill?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh betting-app-skill against similar tools.

Comments (0)

No comments yet. Be the first to share your thoughts!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI Agentsai-agentsanthropicclaude-code
View details
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI Agentsai-agentsbrainstorming
View details

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI Agentsai-agentsanthropicclaude-code
View details

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI Agentsclaude-codeai-tools
View details

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI Agents
View details

Developers Also Liked

Based on votes and bookmarks from developers who liked this skill

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI Agentsai-agentsanthropicclaude-code
View details
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI Agentsai-agentsbrainstorming
View details

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP Serversapisai-tools
View details

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI Agentsai-agentsanthropicclaude-code
View details

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI Agentsclaude-codeai-tools
View details