[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AWDBNHW9787VSV79EMQDX7":3,"skill-same:01M7AWDBNHW9787VSV79EMQDX7":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7AWDBNHW9787VSV79EMQDX7","nim-error-handling",null,"Design clear Nim error-handling flows; when to raise exceptions vs return `Option`\u002F`bool`, how to enforce non-raising contracts, and where to translate or record failures. Use when reviewing failure behavior, exception boundaries, recovery, or batch processing that needs per-item error reporting.","Vyrnexis\u002Fnim-agent-template","Vyrnexis","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F315210836?v=4","01M7AWARQX2P2CQ25GD7S71DHH","01M7AWARRJ3WF9DRPNJ6S1W9CG",5,"MIT","https:\u002F\u002Fgithub.com\u002FVyrnexis\u002Fnim-agent-template\u002Fblob\u002Fmain\u002Fskills\u002Fnim-error-handling\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: nim-error-handling\ndescription: Design clear Nim error-handling flows; when to raise exceptions vs return `Option`\u002F`bool`, how to enforce non-raising contracts, and where to translate or record failures. Use when reviewing failure behavior, exception boundaries, recovery, or batch processing that needs per-item error reporting.\n---\n\n# Nim Error Handling\n\n## Rules\n\n### Choose the Failure Channel\n\n- Return `bool` when success or failure is the whole result.\n- Return `Option[T]` when success returns a value but absence is expected.\n- Use `bool` with a `var` parameter only when filling or mutating caller-owned storage is part of the API.\n- Convert per-item failures into structured outcomes at the batch boundary. Keep intermediate steps exception-based.\n\n### Add Only Real Failure Paths\n\n- Read what the current operation promises and how each called API reports failure.\n- If a successful call guarantees valid output, do not add another raising nil, size, or range check.\n- If a condition breaks no documented promise, remove the raising check and document the valid behavior.\n- Report failure when the result cannot safely satisfy its API or the operation cannot meet its documented promise.\n- If an operation requires a stronger guarantee than the API it calls, validate that guarantee in that operation.\n\n### Place Boundaries\n\n- Let failures propagate through intermediate steps.\n- Catch only where the handler can recover, translate, or record the failure.\n- At a batch boundary, record recoverable per-item failures.\n\n### Choose Exception Types\n\n- For a contract failure caused by caller input or the environment, raise the closest existing `CatchableError`.\n- Separate `except` branches when handling differs. Group exception types when handling is identical.\n- Put child exception types before their parents in `except` branches.\n- Catch `CatchableError` only when the boundary handles every recoverable error. Do not catch bare `Exception`.\n- Add a custom exception only when callers handle it differently. Derive it from the closest existing `CatchableError` subtype.\n- Do not use `Defect` for recoverable failures; it represents a programming bug and is not caught by `CatchableError`.\n- Use `assert` for conditions whose failure means a programming bug: preconditions, internal invariants, and state guards,\n  as in `assert s.opened, \"next called before open\"`.\n- Do not use range conversions for recoverable validation, e.g. `Positive(parseInt(s))`; invalid values raise `RangeDefect`.\n\n### Translate and Inspect Errors\n\n- Translate errors only at module or subsystem boundaries. Add local context and preserve the original reason.\n- If the handler only needs the message text, use `getCurrentExceptionMsg()`.\n- If the handler needs exception fields, use `except X as e`.\n\n### Cleanup and Contracts\n\n- Use `try\u002Ffinally` for cleanup.\n- Use `{.raises: [].}` when a proc must not raise. Leave raising procs unannotated.\n\n## Workflow\n\n1. **Read the contracts.** Note what this operation promises, how called APIs report failure, and what they guarantee on success.\n2. **Decide whether failure is needed.** Name the documented promise that the condition would break. If there is none, remove the check.\n3. **Place the decision.** Document valid behavior as success, or report failure in the first operation whose promise is broken.\n4. **Place catch boundaries.** Catch only where the handler can recover, translate, or record the failure.\n5. **Enforce non-raising contracts.** Add `{.raises: [].}` only to procs that must not raise.\n\n## Common Mistakes\n\n| Mistake | Why it is wrong |\n|---------|-----------------|\n| Parent `except` before child | First-match dispatch makes the child handler unreachable. |\n| Catching bare `Exception` | Also catches `Defect` and can hide programming bugs. |\n| Rechecking guaranteed output | Adds dead branches and can contradict the lower-level API. |\n| Rejecting allowed behavior | Silently narrows the operation's contract. |\n\n## References\n\n- `references\u002Fbatch_preview_boundary.md` — Per-item batch failures with reporting failures allowed\n  to escape.\n","# Nim Error Handling\n\n## Rules\n\n### Choose the Failure Channel\n\n- Return `bool` when success or failure is the whole result.\n- Return `Option[T]` when success returns a value but absence is expected.\n- Use `bool` with a `var` parameter only when filling or mutating caller-owned storage is part of the API.\n- Convert per-item failures into structured outcomes at the batch boundary. Keep intermediate steps exception-based.\n\n### Add Only Real Failure Paths\n\n- Read what the current operation promises and how each called API reports failure.\n- If a successful call guarantees valid output, do not add another raising nil, size, or range check.\n- If a condition breaks no documented promise, remove the raising check and document the valid behavior.\n- Report failure when the result cannot safely satisfy its API or the operation cannot meet its documented promise.\n- If an operation requires a stronger guarantee than the API it calls, validate that guarantee in that operation.\n\n### Place Boundaries\n\n- Let failures propagate through intermediate steps.\n- Catch only where the handler can recover, translate, or record the failure.\n- At a batch boundary, record recoverable per-item failures.\n\n### Choose Exception Types\n\n- For a contract failure caused by caller input or the environment, raise the closest existing `CatchableError`.\n- Separate `except` branches when handling differs. Group exception types when handling is identical.\n- Put child exception types before their parents in `except` branches.\n- Catch `CatchableError` only when the boundary handles every recoverable error. Do not catch bare `Exception`.\n- Add a custom exception only when callers handle it differently. Derive it from the closest existing `CatchableError` subtype.\n- Do not use `Defect` for recoverable failures; it represents a programming bug and is not caught by `CatchableError`.\n- Use `assert` for conditions whose failure means a programming bug: preconditions, internal invariants, and state guards,\n  as in `assert s.opened, \"next called before open\"`.\n- Do not use range conversions for recoverable validation, e.g. `Positive(parseInt(s))`; invalid values raise `RangeDefect`.\n\n### Translate and Inspect Errors\n\n- Translate errors only at module or subsystem boundaries. Add local context and preserve the original reason.\n- If the handler only needs the message text, use `getCurrentExceptionMsg()`.\n- If the handler needs exception fields, use `except X as e`.\n\n### Cleanup and Contracts\n\n- Use `try\u002Ffinally` for cleanup.\n- Use `{.raises: [].}` when a proc must not raise. Leave raising procs unannotated.\n\n## Workflow\n\n1. **Read the contracts.** Note what this operation promises, how called APIs report failure, and what they guarantee on success.\n2. **Decide whether failure is needed.** Name the documented promise that the condition would break. If there is none, remove the check.\n3. **Place the decision.** Document valid behavior as success, or report failure in the first operation whose promise is broken.\n4. **Place catch boundaries.** Catch only where the handler can recover, translate, or record the failure.\n5. **Enforce non-raising contracts.** Add `{.raises: [].}` only to procs that must not raise.\n\n## Common Mistakes\n\n| Mistake | Why it is wrong |\n|---------|-----------------|\n| Parent `except` before child | First-match dispatch makes the child handler unreachable. |\n| Catching bare `Exception` | Also catches `Defect` and can hide programming bugs. |\n| Rechecking guaranteed output | Adds dead branches and can contradict the lower-level API. |\n| Rejecting allowed behavior | Silently narrows the operation's contract. |\n\n## References\n\n- `references\u002Fbatch_preview_boundary.md` — Per-item batch failures with reporting failures allowed\n  to escape.\n",{"name":5,"description":7},"main","060e1c453fdad0410a2b385f59275494911d9a4b","skills\u002Fnim-error-handling",2,"https:\u002F\u002Fgithub.com\u002FVyrnexis\u002Fnim-agent-template","https:\u002F\u002Fgithub.com\u002FVyrnexis","https:\u002F\u002Fvyrnexis.github.io","2026-10-27 00:06:43",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add Vyrnexis\u002Fnim-agent-template --skill nim-error-handling",{"tool":37,"command":38},"bunx","bunx skills add Vyrnexis\u002Fnim-agent-template --skill nim-error-handling",{"tool":40,"command":41},"pnpm","pnpm dlx skills add Vyrnexis\u002Fnim-agent-template --skill nim-error-handling","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FVyrnexis\u002Fnim-agent-template\u002Fblob\u002Fmain\u002Fskills\u002Fnim-error-handling\u002FSKILL.md",true,[45],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"references\u002Fbatch_preview_boundary.md","REFERENCE","参考文档",1045,"https:\u002F\u002Fgithub.com\u002FVyrnexis\u002Fnim-agent-template\u002Fblob\u002Fmain\u002Fskills\u002Fnim-error-handling\u002Freferences\u002Fbatch_preview_boundary.md",[52,59,66,73,80,87],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M7AWEDMYZVEFGPQYGCVC4NQN","run-tests","Runs the project unit tests and validation suites.","https:\u002F\u002Fgithub.com\u002FVyrnexis\u002Fnim-agent-template\u002Fblob\u002Fmain\u002Fskills\u002Frun-tests\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M7AWE9HNJ36TDH5NPDVCEAHC","nimonyplugins","Build and debug Nimony compile-time plugins for code generation and DSL rewrites. Use when replacing Nim macros with Nimony plugins, writing or reviewing template, for-loop, module, type, or import plugins, or diagnosing NIF traversal and generated output.","https:\u002F\u002Fgithub.com\u002FVyrnexis\u002Fnim-agent-template\u002Fblob\u002Fmain\u002Fskills\u002Fnimonyplugins\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":18},"01M7AWE4F7EJ1H837ETBHESE2T","nim-testing","Write and run deterministic Nim tests, including isolated test files, expected-exception checks, multi-configuration builds, and sanitizer integration. Use when setting up a Nim test suite, testing failure behavior, running tests across debug\u002Frelease\u002Fdanger modes, or adding AddressSanitizer support.","https:\u002F\u002Fgithub.com\u002FVyrnexis\u002Fnim-agent-template\u002Fblob\u002Fmain\u002Fskills\u002Fnim-testing\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M7AWE0S8C3Y39VGR54R23FZD","nim-style-guide","Write clear, consistent Nim code in a simple stdlib-aligned style, covering imports, naming, proc vs func vs template choices, local variables, constructors, formatting, and control flow. Use when writing new Nim code or reviewing a Nim module for readability, consistency, and low-noise style decisions.","https:\u002F\u002Fgithub.com\u002FVyrnexis\u002Fnim-agent-template\u002Fblob\u002Fmain\u002Fskills\u002Fnim-style-guide\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":18},"01M7AWDWZAD6RQ547RT96RHA5B","nim-ownership-hooks","Implement and review Nim ARC\u002FORC ownership hooks for types that manually manage resources, including move-only, deep-copy, refcounted, and copy-on-write patterns. Use when a Nim type owns pointers, buffers, file descriptors, or custom heap memory and you need correct `=destroy`, `=copy`, `=dup`, `=sink`, or move semantics.","https:\u002F\u002Fgithub.com\u002FVyrnexis\u002Fnim-agent-template\u002Fblob\u002Fmain\u002Fskills\u002Fnim-ownership-hooks\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":18},"01M7AWDQ5JGN9XNNJ9FKJQ14GP","nim-mcp-tools","Use for Nim symbol navigation, diagnostics, and type resolution. MANDATORY: Use specialized MCP tools (nimFindSymbols, nimFindReferences, nimListSymbols, nimCheckFile, nimCheckProject, nimFindTypeDefinition) first; fall back to grep only on error or user confirmation.","https:\u002F\u002Fgithub.com\u002FVyrnexis\u002Fnim-agent-template\u002Fblob\u002Fmain\u002Fskills\u002Fnim-mcp-tools\u002FSKILL.md",[],[]]