Skip to content
Prompt

manifold — Cursor Rules

by manifoldmarkets

AI Summary

To check if a user is an admin, use the function from instead of checking for an property on the user object. This ensures consistent admin checks across the application and avoids errors related to non-existent properties. We use jest to unit test some things, particularly market math.

Install

Copy this and paste it into Claude Code, Cursor, or any AI assistant:

I want to add the "manifold — Cursor Rules" prompt rules to my project.
Repository: https://github.com/manifoldmarkets/manifold

Please read the repo to find the rules/prompt file, then:
1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type)
2. If there's an existing rules file, merge the new rules in rather than overwriting
3. Confirm what was added

Description

Manifold Markets: A market for every question

Checking Admin Status

To check if a user is an admin, use the isAdminId function from common/envs/constants instead of checking for an isAdmin property on the user object. Example: `typescript import { isAdminId } from 'common/envs/constants' // Correct way to check if a user is an admin if (user && isAdminId(user.id)) { // Admin-specific code here } // Incorrect way (do not use) // if (user?.isAdmin) { ... } ` This ensures consistent admin checks across the application and avoids errors related to non-existent properties.

Unit testing

We use jest to unit test some things, particularly market math. Run tests via yarn run test Example: `typescript describe('addCpmmLiquidity', () => { it('should maintain probability after adding liquidity', () => { const pool = { YES: 150, NO: 50 } const p = 0.5 const amount = 20 const initialProb = getCpmmProbability(pool, p) const { newPool, newP } = addCpmmLiquidity(pool, p, amount) const newProb = getCpmmProbability(newPool, newP) expect(newProb).toBeCloseTo(initialProb, 5) }) it('should not change if state if 0 liquidity is added', () => { const pool = { YES: 100, NO: 100 } const p = 0.5 const amount = 0 const { newPool, newP } = addCpmmLiquidity(pool, p, amount) expect(newPool.YES).toBeCloseTo(pool.YES, 5) expect(newPool.NO).toBeCloseTo(pool.NO, 5) expect(newP).toBeCloseTo(p, 5) }) }); `

Discussion

0/2000
Loading comments...

Health Signals

MaintenanceCommitted Today
Active
Adoption100+ stars on GitHub
502 ★ · Growing
DocsMissing or thin
Undocumented

GitHub Signals

Stars502
Forks234
Issues54
UpdatedToday
View on GitHub
MIT License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Any AI assistant that accepts custom rules or system prompts

Claude
ChatGPT
Cursor
Windsurf
Copilot
+ more