Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
hairyf avatar

Knitwork X

  • 348 installs
  • 3 repo stars
  • Updated March 4, 2026
  • hairyf/knitwork-x

knitwork-x is an agent skill for the knitwork-x npm library that helps developers programmatically generate safe JavaScript and TypeScript source strings for code generators, plugins, and AST-to-code pipelines.

About

knitwork-x is a Claude Code skill for the hairyf/knitwork-x package, a comprehensive fork of unjs/knitwork that emits JavaScript and TypeScript code as pure strings. Version 0.2.0 documents gen* helpers for ESM imports, classes, interfaces, enums, functions, type aliases, control flow, and object serialization, with 21 progressive-disclosure reference files loaded on demand. Every gen* function returns a string fragment suitable for splicing into larger modules without mutating inputs. Developers reach for knitwork-x when building codegen CLIs, bundler plugins, OpenAPI emitters, or dynamic module output where hand-written templates are error-prone. Install via npm install knitwork-x or npx nypm install knitwork-x, then compose outputs like genClass with nested genConstructor calls.

  • Compose threaded posts and reply sequences for X
  • Maintain cadence across hooks, CTAs, and follow-ups
  • Apply character-limit and formatting guardrails
  • Iterate voice and engagement patterns from drafts
  • Knit standalone posts into cohesive distribution arcs

Knitwork X by the numbers

  • 348 all-time installs (skills.sh)
  • Ranked #832 of 1,879 Marketing & SEO skills by installs in the Skillselion catalog
  • Data as of Jul 13, 2026 (Skillselion catalog sync)
npx skills add https://github.com/hairyf/knitwork-x --skill knitwork-x

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs348
repo stars3
Last updatedMarch 4, 2026
Repositoryhairyf/knitwork-x

How do you generate TypeScript source code programmatically?

Plan and draft multi-post X threads, reply chains, and campaign cadences in Claude while keeping narrative flow, tone, and platform formatting constraints intact.

Who is it for?

Tooling engineers building TypeScript or JavaScript code generators who need safe, composable string emitters instead of full AST printers.

Skip if: Application developers writing normal app components by hand who do not need programmatic source generation.

When should I use this skill?

A developer asks to generate TypeScript with knitwork-x, build a codegen plugin, or emit imports and classes as strings.

What you get

Composable gen* code strings for imports, classes, types, control flow, and serialized literals ready to write into .ts files.

  • Generated import and export statements
  • Composed class and interface source strings
  • Serialized object and array literal fragments

By the numbers

  • Skill metadata declares knitwork-x version 0.2.0
  • SKILL.md indexes 21 reference topic files across core and features sections
  • Package is forked from unjs/knitwork with extended TypeScript gen* APIs

Files

SKILL.mdMarkdownGitHub ↗

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.

Related skills

How it compares

Choose knitwork-x over raw template literals when codegen must emit valid TypeScript with quoting, indentation, and ESM import rules handled by tested gen* helpers.

FAQ

What does knitwork-x generate?

knitwork-x provides pure gen* functions that return JavaScript or TypeScript source strings for imports, classes, types, control flow, and literals. The knitwork-x skill documents how to compose those fragments in codegen tools without mutating input objects.

How is knitwork-x different from unjs/knitwork?

knitwork-x is a fork of unjs/knitwork extended with comprehensive TypeScript helpers such as genInterface, genMappedType, genTry, and genSwitch. The skill tells agents to install the knitwork-x package rather than the original knitwork package.

When should an agent load knitwork-x reference files?

The knitwork-x skill keeps SKILL.md lean and points to 21 reference markdown files for ESM, classes, loops, and serialization topics. Agents load a specific reference only when generating that construct, following progressive disclosure.

Marketing & SEOdistributioncontentlifecycle

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.