revops
Design and optimize systems connecting marketing, sales, and customer success into a unified revenue engine.
Decimal precision and financial math patterns in LivestockAI
Full skill instructions
LivestockAI uses decimal.js for precise financial calculations. All monetary values are stored as DECIMAL(19,2) in the database.
Located in app/features/settings/currency.ts:
import {
toDecimal,
toNumber,
toDbString,
formatCurrency,
multiply,
divide,
sumAmounts,
} from '~/features/settings/currency'
// From any input to Decimal
const amount = toDecimal('1234.56')
const amount2 = toDecimal(1234.56)
// To number for display
const num = toNumber('1234.56') // 1234.56
// To string for database
const dbVal = toDbString(1234.56) // "1234.56"
// Multiplication (quantity × price)
const total = multiply(100, 5.5) // Decimal(550)
// Division (with null safety)
const perUnit = divide(total, 100) // Decimal(5.50) or null
// Subtraction
const profit = subtract(revenue, costs)
// Sum multiple amounts
const totalCost = sumAmounts(feedCost, laborCost, overheadCost)
// Format for display (uses user settings)
formatCurrency(1234.56) // "₦1,234.56" or "$1,234.56"
// Compact format
formatCurrencyCompact(1500000) // "₦1.5M"
// Percentage
calculatePercentage(50, 200) // 25
In components, use the useFormatCurrency hook:
import { useFormatCurrency } from '~/features/settings'
function PriceDisplay({ amount }: { amount: number }) {
const { format, symbol } = useFormatCurrency()
return <span>{format(amount)}</span> // "₦1,234.56"
}
All monetary values are stored as DECIMAL(19,2):
// Inserting
await db.insertInto('sales').values({
totalAmount: toDbString(1234.56), // "1234.56"
})
// Reading
const sale = await db.selectFrom('sales').executeTakeFirst()
const amount = toNumber(sale.totalAmount) // 1234.56
export function calculateBatchTotalCost(
initialQuantity: number,
costPerUnit: number,
): string {
if (initialQuantity <= 0 || costPerUnit < 0) {
return toDbString(0)
}
return toDbString(multiply(initialQuantity, costPerUnit))
}
export function calculateProfit(
revenue: MoneyInput,
costs: MoneyInput,
): Decimal {
return subtract(revenue, costs)
}
multi-currency - Currency settings and formattingthree-layer-architecture - Service layer calculationsDesign and optimize systems connecting marketing, sales, and customer success into a unified revenue engine.
Strategic planning and optimization for email capture offers and gated content.
Directory submissions: the foundation layer of distribution that passes backlinks and discovery surface area into your marketing pages.
Sequence and choreograph multi-step animations with precise timing control and nested timelines.
Structured framework for planning product launches, feature announcements, and go-to-market strategies.
Upload files to Google Drive with automatic MIME type detection and metadata.
Automates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.
firecrawl lead gen
firecrawl lead research
firecrawl demo walkthrough
Team leadership persona with standup coordination, meeting prep, task delegation, and team communication.
Identify large Google Drive files consuming storage quota.
Revolutionize Video Creation with AI-Generated Avatars and Voices
Social media on autopilot
Design custom logos instantly with AI.
Text-heavy marketing and design images
Boost Your SEO with Content and SEO Silos
Revolutionize Your Marketing with AI-Powered MarketingBlocks!
10X faster & free AI content creation for 100+ use cases
Tribescaler | Make Your Tweets Go Viral