Advanced · ~20 minutes
Create an Extension
Build a Prodara extension that adds a custom reviewer and generator. Package it as an npm module that other teams can install and use.
1 Scaffold the Package
Create a new npm package with the Prodara extension manifest:
mkdir prodara-ext-rest-api && cd prodara-ext-rest-api
npm init -ypackage.json
{
"name": "@my-org/prodara-ext-rest-api",
"version": "1.0.0",
"main": "dist/index.js",
"prodara-extension": {
"capabilities": [
{ "kind": "reviewer", "id": "rest-api-best-practices" },
{ "kind": "validator", "id": "rest-naming-conventions" }
]
}
}2 Define Capabilities
The prodara-extension key in package.json tells the compiler what your extension provides. Each capability has a kind and optional metadata.
ℹ️
Five capability kinds are supported:
reviewer, generator, validator, phase, and template. 3 Implement the Extension
Create the main entry point that exports your capabilities. Here's an example reviewer that checks for REST API best practices:
src/index.ts
// src/index.ts
export const reviewer = {
id: 'rest-api-best-practices',
name: 'REST API Best Practices',
perspective: `You are a REST API design expert. Review all
workflows and surfaces for proper HTTP method usage,
resource naming conventions, and pagination patterns.
Flag any endpoint that uses verbs in URLs or returns
unbounded lists.`,
enabled: true,
};
export const validator = {
id: 'rest-naming-conventions',
validate(graph) {
const findings = [];
for (const node of graph.nodes) {
if (node.kind === 'workflow' && /[A-Z]/.test(node.name)) {
findings.push({
code: 'REST001',
severity: 'warning',
message: `Workflow "${node.name}" uses camelCase — prefer snake_case for REST endpoints.`,
nodeId: node.id,
});
}
}
return findings;
},
};4 Install & Test
Install your extension locally and verify it works:
# Build the extension
npm run build
# Install locally in your Prodara project
cd ../my-project
prodara extensions install ../prodara-ext-rest-api
# Verify it's loaded
prodara extensions list
# Run a build with the new reviewer
prodara build --format json .💡
Use
prodara extensions list to verify your extension was loaded and its capabilities are registered. 5 Publish to npm
Publish your extension to npm so other teams can install it:
# Build and publish
npm run build
npm publish --access publicOther users install your extension with:
prodara extensions install @my-org/prodara-ext-rest-apiNext Steps
- Read the full Extensions & Presets reference
- Search the marketplace for community extensions
- Create a custom reviewer without building a full extension