better-result-adopt▌
dmmulroy/better-result · updated May 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Adopt better-result incrementally in existing codebases without rewriting everything at once.
better-result Adopt
Adopt better-result incrementally in existing codebases without rewriting everything at once.
When to Use
Use this skill when the user wants to:
- migrate from try/catch to
Result.tryorResult.tryPromise - replace nullable return values with typed
Result<T, E> - define domain-specific
TaggedErrortypes - refactor nested error handling into
andThenchains orResult.gen - standardize error handling across a service or module
Reading Order
| Task | Files to Read |
|---|---|
| Adopt better-result in a module | This file |
| Define or review error types | references/tagged-errors.md |
| Inspect library implementation details | opensrc/ if present |
Prerequisites
Before editing code:
- Confirm
better-resultis already installed in the target project. - Check for an
opensrc/directory. If present, read the package source there for current patterns. - Identify the migration scope first: one file, one module, or one boundary layer.
Migration Strategy
1. Start at boundaries
Begin with I/O boundaries and exception-heavy code:
- HTTP clients
- database access
- file system operations
- parsing and validation
- framework adapters
Do not convert the whole codebase at once.
2. Classify existing failures
| Category | Examples | Target shape |
|---|---|---|
| Domain errors | not found, validation, auth | TaggedError + Result.err |
| Infrastructure errors | network, DB, file I/O | Result.tryPromise + mapped error |
| Programmer defects | bad assumptions, null deref | leave throwing; defects become Panic inside Result callbacks |
3. Migrate in this order
- Define error types.
- Wrap throwing boundaries with
Result.try/Result.tryPromise. - Replace null or boolean sentinel returns with
Result. - Refactor call sites to propagate
Resultvalues. - Collapse nested branching into
andThen,mapError, orResult.gen.
Core Transformations
Try/catch → Result.try
function parseConfig(json: string): Result<Config, ParseError> {
return Result.try({
try: () => JSON.parse(json) as Config,
catch: (cause) => new ParseError({ cause, message: `Parse failed: ${cause}` }),
});
}
Async throws → Result.tryPromise
async function fetchUser(id: string): Promise<Result<User, ApiError | UnhandledException>> {
return Result.tryPromise({
try: async () => {
const res = await fetch(`/api/users/${id}`);
if (!res.ok) throw new ApiError({ status: res.status, message: `API ${res.status}` });
return res.json() as Promise<User>;
},
catch: (cause) => (cause instanceof ApiError ? cause : new UnhandledException({ cause })),
});
}
Null sentinel → Result
function findUser(id: string): Result<User, NotFoundError> {
const user = users.find((candidate) => candidate.id === id);
return user
? Result.ok(user)
: Result.err(new NotFoundError({ id, message: `User ${id} not found` }));
}
Nested flow → Result.gen
async function processOrder(orderId: string): Promise<Result<OrderResult, OrderError>> {
return Result.gen(async function* () {
const order = yield* Result.await(fetchOrder(orderId));
const validated = yield* validateOrder(order);
const result = yield* Result.await(submitOrder(validated));
return Result.ok(result);
});
}
Execution Workflow
- Audit the target module for
try,catch,.catch(...),throw,null,undefined, and status-flag error handling. - Define or update
TaggedErrorclasses before changing control flow. - Convert boundary functions first and change their signatures to
Result<T, E>orPromise<Result<T, E>>. - Update immediate callers so they handle or propagate the new
Result. - Where multiple Result-returning steps compose, use
Result.genorandThen. - Preserve error context by keeping
cause, IDs, messages, and other structured fields. - Run tests and add coverage for both success and error paths.
Completion Criteria
A migration is complete when:
- target functions no longer rely on try/catch for expected domain failures
- nullable or sentinel error returns are replaced with explicit
Resultvalues - domain failures use typed
TaggedErrorclasses - callers either propagate
Resultor explicitly unwrap/match it - tests cover at least one success path and one representative error path
Common Pitfalls
- Over-wrapping everything instead of starting at boundaries
- Losing original failure context when mapping errors
- Mixing
throw-based andResult-based APIs deep in the same flow - Catching
Panicinstead of fixing the underlying defect
In This Reference
| File | Purpose |
|---|---|
references/tagged-errors.md |
TaggedError patterns, matching, type guards, and examples |
If opensrc/ exists, treat it as the source of truth for implementation details and current API behavior.
How to use better-result-adopt on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add better-result-adopt
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches better-result-adopt from GitHub repository dmmulroy/better-result and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate better-result-adopt. Access the skill through slash commands (e.g., /better-result-adopt) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.7★★★★★25 reviews- ★★★★★Shikha Mishra· Dec 28, 2024
Keeps context tight: better-result-adopt is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Mateo Bansal· Dec 28, 2024
Keeps context tight: better-result-adopt is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Michael Smith· Dec 12, 2024
I recommend better-result-adopt for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Ganesh Mohane· Dec 8, 2024
Useful defaults in better-result-adopt — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Yash Thakker· Nov 19, 2024
Registry listing for better-result-adopt matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Dhruvi Jain· Oct 10, 2024
better-result-adopt reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Sakura Sharma· Sep 17, 2024
Keeps context tight: better-result-adopt is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Rahul Santra· Sep 1, 2024
better-result-adopt has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Ren Wang· Sep 1, 2024
better-result-adopt has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Pratham Ware· Aug 20, 2024
Solid pick for teams standardizing on skills: better-result-adopt is focused, and the summary matches what you get after install.
showing 1-10 of 25