result-foundation

Add or extend MoreSpeakers Domain Result types with explicit factory methods and structured errors.

6 stars

Best use case

result-foundation is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Add or extend MoreSpeakers Domain Result types with explicit factory methods and structured errors.

Teams using result-foundation should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/result-foundation/SKILL.md --create-dirs "https://raw.githubusercontent.com/cwoodruff/morespeakers-com/main/.squad/skills/result-foundation/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/result-foundation/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How result-foundation Compares

Feature / Agentresult-foundationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Add or extend MoreSpeakers Domain Result types with explicit factory methods and structured errors.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

## Context
Use this skill when implementing or extending the approved Result-based exception handling migration in the Domain layer. It applies when expected failures need to flow through Data, Managers, and Web without losing structured context.

## Patterns
- Keep `Error`, `Result`, and `Result<T>` in `src\MoreSpeakers.Domain\Models\`, but expose them from the root `MoreSpeakers.Domain` namespace.
- Model creation after `IdentityResult`: factory methods live on non-generic `Result` instead of exposing public constructors.
- Use `readonly struct` for `Result` and `Result<T>` to stay additive and allocation-conscious on the hot path.
- Keep failure access explicit: success results throw if callers read `Error`, and failure results throw if callers read `Value`.
- Cover the public API surface in `src\MoreSpeakers.Domain.Tests\ResultTests.cs`, including success, failure, implicit conversion, and equality.
- When converting an existing vertical slice, let the slice interface own explicit `Result` signatures instead of inheriting generic `IDataStore` contracts that force sentinel returns.
- In DataStores, catch only expected persistence exceptions such as `DbUpdateException`; return typed `Error` codes for not-found/no-op outcomes and let unexpected exceptions propagate.
- In Managers, forward DataStore `Result` values unchanged unless adding boundary validation or input normalization that belongs above persistence.

## Examples
- `var ok = Result.Success();`
- `var saved = Result.Success(user);`
- `var failed = Result.Failure<User>(new Error("users.save.failed", "Unable to save the user.", ex));`
- `Result<Guid> id = Guid.NewGuid();`

## Anti-Patterns
- Do not expose public constructors for `Result` or `Result<T>`.
- Do not use sentinel values (`null`, `false`, empty collections) for expected failures once a Result-based path exists.
- Do not strip exception context when an `Error` can carry the underlying exception reference.