skills/repository-mgmt/nx/nx-plugin-authoring/SKILL.md
Create Nx plugins with custom generators and executors for TypeScript monorepos. Covers plugin scaffolding, Tree API usage, schema-driven options, ExecutorContext API, template generation, project-graph-safe updates, cache-aware outputs, and testable workflows. Use when creating Nx plugins, building custom generators, implementing executors, enforcing conventions, or extending Nx workspace automation.
npx skillsauth add pantheon-org/tekhne nx-plugin-authoringInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Navigation hub for creating custom Nx plugins, generators, and executors.
Start new workspace with plugin:
npx create-nx-plugin my-plugin
Add plugin to existing workspace:
npx nx add @nx/plugin
npx nx g plugin tools/my-plugin
Create a generator:
npx nx g generator my-plugin/src/generators/library-with-readme
Implement with Tree API:
tree.write, generateFiles, updateJson for filesystem edits--dry-run before executionValidate: Run npx nx g my-plugin:library-with-readme mylib --dry-run
Stop if: Unexpected files appear or required options fail validation
Create executor structure:
mkdir -p tools/executors/my-executor
Implement with ExecutorContext:
{ success: boolean } from executorValidate: Run npx nx run my-project:my-target --help
Stop if: Executor fails to resolve or schema is invalid
Run tests:
npx nx test my-plugin
Validate in real workspace:
npx nx g my-plugin:my-generator sample --dry-run
npx nx run my-project:my-target
npx create-nx-plugin my-plugin
npx nx add @nx/plugin
npx nx g generator my-plugin/src/generators/my-gen
npx nx g my-plugin:my-gen sample --dry-run
npx nx run my-project:my-target --skip-nx-cache
npx nx reset
rg -n "generateFiles|updateJson|readProjectConfiguration" plugins tools
writeFileSync("libs/my-lib/src/index.ts", content).tree.write("libs/my-lib/src/index.ts", content).libs/my-lib/... writes.readProjectConfiguration(tree, name).root.schema: any and no guardrails.project.json.const config = readProjectConfiguration(tree, name); config.targets.build = {...}; updateProjectConfiguration(tree, name, config);.executor.ts."executor": "../../tools/executors:task"."executor": "@scope/tools:task"."outputs": ["{options.outputPath}"].fs.readFileSync in main execution flow.await fs.promises.readFile with structured error handling.generateFiles() without calling formatFiles(tree).await generateFiles(...); await formatFiles(tree);.tree.write(path, content) without checking tree.exists(path).if (tree.exists(path)) { throw new Error('File already exists'); }.src/index.ts and generators.json.src/index.ts and register in generators.json with factory path.Generators:
--dry-run before broad rolloutsExecutors:
{ success: boolean } from executor function| Missing Input | Fallback |
| --- | --- |
| directory omitted in generator | Use workspace default location |
| optional flags omitted | Apply safe schema defaults |
| custom template not provided | Generate minimal boilerplate |
| executor outputs not declared | No cache, always re-run |
| Topic | Reference | | --- | --- | | Plugin scaffolding and structure | references/plugin-scaffolding.md | | Core concepts | knowledge-base/concepts.md |
| Topic | Reference | | --- | --- | | Generator implementation guide | references/generators-guide.md | | Tree API patterns | references/tree-api-reference.md | | Template engine guidance | references/template-engine-guide.md | | Template system details | knowledge-base/template-system.md |
| Topic | Reference | | --- | --- | | Executor implementation guide | references/executors-guide.md | | ExecutorContext API usage | references/executor-context-api.md | | Executor schema design | references/executor-schema-design.md |
| Topic | Reference | | --- | --- | | Schema design patterns | references/schema-design-patterns.md | | Utility helpers | knowledge-base/utilities.md | | Testing and troubleshooting | references/testing-and-troubleshooting.md |
tools
A skill that produces warnings but no errors.
testing
A well-formed example skill for testing the validator.
development
A skill with code blocks and imperative instructions for testing content and contamination analysis.
tools