knitwork-x

Utilities to generate JavaScript and TypeScript code programmatically. Use when building code generators, AST-to-code output, or dynamic source generation.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "knitwork-x" with this command: npx skills add hairyf/knitwork-x/hairyf-knitwork-x-knitwork-x

knitwork-x provides programmatic code generation for JavaScript and TypeScript. It is forked from knitwork and adds comprehensive TypeScript helpers: ESM (import/export), strings, variables, classes, interfaces, functions, types, control flow (if/try/loop/switch), and serialization (object/array/map/set). All gen* functions return strings suitable for splicing into source; they are pure and do not mutate inputs.

Use this skill when an agent needs to generate code strings (e.g. for codegen tools, plugins, or dynamic module output).

Core References

TopicDescriptionReference
OverviewPurpose, install, when to usecore-overview
ESMImport, export, default export, dynamic importcore-esm
StringgenString, escapeString, genTemplateLiteralcore-string
VariablegenVariable, genVariableNamecore-variable
Design GuidelinesNaming, params, options (for contributors)core-design-guidelines

Features

TopicDescriptionReference
ClassgenClass, genConstructor, genProperty, genMethod, getter/setterfeatures-class
InterfacegenInterface, genIndexSignaturefeatures-interface
EnumgenEnum, genConstEnumfeatures-enum
FunctiongenFunction, genArrowFunction, genBlock, genParamfeatures-function
TypegenTypeAlias, genUnion, genIntersection, genMappedType, etc.features-type
ConditionalgenConditionalType, genTernaryfeatures-conditional
DecoratorgenDecoratorfeatures-decorator
Module & NamespacegenModule, genNamespace, genDeclareNamespacefeatures-module-namespace
ConditiongenIf, genElse, genElseIffeatures-condition
TrygenTry, genCatch, genFinallyfeatures-try
LoopgenFor, genForOf, genWhile, genDoWhilefeatures-loop
SwitchgenSwitch, genCase, genDefaultfeatures-switch
StatementgenReturn, genThrow, genPrefixedBlockfeatures-statement
Object & SerializationgenObject, genArray, genMap, genSet, genTypeObjectfeatures-object
UtilsgenComment, genKey, genLiteral, genRegExp, wrapInDelimitersfeatures-utils

Key Points

  • Return type: Every gen* function returns a string (code fragment).
  • Options: Most accept an optional options object (e.g. export, singleQuotes, indent); default to {}.
  • Indent: When supported, pass indent as the last parameter; use indent + " " for nested blocks.
  • Strings: Use genString(input, options) for quoted/escaped output so singleQuotes is respected.
  • Composing: Combine gen* outputs (e.g. genClass(..., [genConstructor(...)])) to build larger snippets.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

arch-tsdown-cli

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

github-workflow

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

github-cli

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

arch-vscode

No summary provided by upstream source.

Repository SourceNeeds Review