mcpField
K
knitwork-x

knitwork-x

github.com/hairyfDevelopment3538 installsUpdated 35w ago
Repository

About knitwork-x

A code-generation skill for JavaScript and TypeScript, aimed at agents and tools that need to assemble source code programmatically. Its pure gen* helpers return composable code strings without mutating inputs.

Key features

  1. 01Generate JavaScript and TypeScript fragments
  2. 02Helpers for classes, functions, and types
  3. 03Generate control-flow constructs
  4. 04Serialize objects and collections
  5. 05Composable pure string outputs

Use cases

  1. 01Building code-generation tools
  2. 02Generating plugin source code
  3. 03Creating dynamic modules
  4. 04Assembling TypeScript declarations

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/hairyf/knitwork-x --skill knitwork-x

After installing, type/knitwork-xin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

GENERATION.md
references/
core-design-guidelines.md
core-esm.md
core-overview.md
core-string.md
core-variable.md
features-class.md
features-condition.md
features-conditional.md
features-decorator.md
features-enum.md
features-function.md
features-interface.md
features-loop.md
features-module-namespace.md
features-object.md
features-statement.md
features-switch.md
features-try.md
features-type.md
features-utils.md

Details

From the project README

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.

Comments

Markdown supported