capstring is a lightweight JavaScript library for text capitalization and transformation. It supports 29 different styles including case transformations, code conventions, and fun styles.
npm install # Install dev dependencies
npm test # Run Vitest tests
npm run lint # Run ESLint
npm run test:coverage # Run tests with coverage report- ES2022+ syntax (const/let, arrow functions, template literals)
- ESM modules only (
import/export) - Full JSDoc documentation
- 100% test coverage target
Single-file library with a main function and helper exports:
capstring(str, style)- Main transformation functiongetStyles()- Returns array of all style namesisValidStyle(style)- Validates a style nameSTYLES- Frozen array constant of all styles
Case: same, none, proper, title, sentence, upper, lower, swap Code: camel, pascal, snake, kebab, slug, constant, python, dot, path, train Fun: leet, reverse, sponge, mock, alternate, crazy, random New: hashtag, acronym, rot13, flip
- Ensure all tests pass:
npm test - Maintain 100% coverage:
npm run test:coverage - Run linter:
npm run lint - Update CHANGELOG.md for any user-facing changes
- Preserve the ASCII art header
- cAPIta - REST API that wraps capstring (separate repo)
For anything non-trivial, plan the approach before writing code. Identify which files change, what the edge cases are, and how to verify it works. A solid plan means fewer iterations and cleaner implementations.
When something's broken - CI failing, bug reported, error in logs - just go fix it. Read the error, trace the cause, implement the fix. Don't wait for instructions on each step.
After making changes, prove they work. Run the tests. Check the output. If asked to review code, be genuinely critical - find the issues, don't just approve.
If a solution feels hacky, stop. Rethink from scratch using what you learned. If corrected on a mistake, suggest a CLAUDE.md update to prevent it happening again - be specific about what to avoid.
Use subagents for research, exploration, or isolated subtasks. Keep the main conversation for coordinating and making decisions.