Agent skill
patterns/result-type
Result Type Pattern (C-Specific) pattern for C development
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/patternsresult-type
SKILL.md
Result Type Pattern (C-Specific)
Return struct containing success/failure status plus value or error. Explicit error handling without exceptions. Caller must check result.
ikigai Application
Core type: res_t used throughout:
res_t result = ik_cfg_load(ctx, path, &cfg);
if (!result.ok) {
// Handle error, result.error contains message
}
Macros:
OK(value)- Construct success resultERR(msg)- Construct error resultTRY(expr)- Propagate error if failedCHECK(cond, msg)- Return error if condition false
Benefits:
- Errors can't be ignored (must check
.ok) - Error context propagates up call stack
- No hidden control flow (unlike exceptions)
See: project/error_handling.md for patterns.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?