# Writing Utility Helpers

> Standardizes frequent utility functions for currency, dates, and strings. Use to maintain consistency in formatting.

- Skill: `majiayu000/writing-utility-helpers` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add majiayu000/writing-utility-helpers`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/writing-utility-helpers/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/writing-utility-helpers

---


# Utility Helper Functions

## When to use this skill
- Formatting prices in PKR or USD.
- Truncating long descriptions in cards.
- Pretty-printing dates for travel itineraries.

## Recommended Helpers
### Currency
```typescript
export const formatCurrency = (amount: number, currency = 'PKR') => {
    return new Intl.NumberFormat('en-PK', {
        style: 'currency',
        currency,
        maximumFractionDigits: 0,
    }).format(amount);
};
```

### String Truncation
```typescript
export const truncate = (str: string, length: number) => {
    return str.length > length ? str.substring(0, length) + '...' : str;
};
```

## Instructions
- **Location**: Store all helpers in `lib/utils.ts` or `utils/index.ts`.
- **DRY**: Check for existing helpers before writing new logic.

