nitro-ui-nitrogen
Installation
SKILL.md
- Avoid nested ternaries and ternaries inside generated-code templates, including conditional whitespace or newlines. Select generated bodies outside templates: use a short ternary for simple literal alternatives, and explicit
if/elseorswitchfor longer or more complex choices. - Always write generated code in multiline template literals with
.trim(). Use actual line breaks, never\nescapes for layout;.join('\n')is the exception. - Always use
indent(...)for interpolated code, with matching indentation before${...}for its first line. - Name generated bodies by direction, e.g.
swiftToCppConverterCode, before passing them to helpers. Do not bury multiline strings in arguments or object properties. - Use typed options objects destructured immediately in the parameter list for helpers with several code fragments or types, as in
createSwiftConverterandcreateSwiftJSIConverter. - Extract mapping, filtering, sorting, deduplication, comparisons, and other nontrivial expressions into named variables before generated-code templates. Split long chains into multiple variables when it improves readability. Interpolate the results, leaving only final
.join(...)andindent(...)calls inline. Shared renderers such asgetImportsCode()can return complete strings. - Prefer
switch (language)overifchains, ternaries, or inline language-check returns so additional languages fit the same dispatch. Collect imports in a shared result and pass import context through nested wrappers. - Avoid
??=when it hides initialization. - Use
getImportCode()/getImportsCode()for import rendering and deduplication. Model declaration and implementation dependencies separately; do not repair them by comparing emitted strings or overriding descriptors at the caller. - Collect module dependencies from specs and their type graph, including nested types and inheritance. Preserve ownership through wrapping; do not infer modules from include paths.
- Put type-specific policy on
Type/SwiftTypeas overridable properties or methods, e.g. contextualgetCode()andrequiresExplicitSwiftTarget, rather than repeatingtype.kindchecks in shared emitters. - In a PR stack, run Nitrogen at each atomic PR and commit its affected generated files in that PR. Keep every PR buildable with its own generated output; do not defer regeneration to the end of the stack.
- Accept incidental blank lines from empty include blocks. Avoid arbitrary gaps between related literal includes.