Naming workflow steps effectively
Step naming is an important design decision that affects workflow readability and maintainability. After analyzing multiple pgflow projects, these patterns have proven effective.
Recommended approach: Hybrid naming
Section titled “Recommended approach: Hybrid naming”- Use nouns for steps that produce data other steps depend on
- Use verb-noun combinations for terminal actions or utility steps
// Data-producing steps use nouns.step({ slug: "website" }, ...).step({ slug: "summary", dependsOn: ["website"] }, ...)
// Terminal action step uses verb-noun.step({ slug: "saveToDb", dependsOn: ["summary"] }, ...)
Why this works well
Section titled “Why this works well”-
When accessing data from dependent steps, nouns create more intuitive property access:
// Clean and reads naturally({ website }) => summarizeWithAI(website.content) -
Terminal steps that don’t have any dependents benefit from action-oriented naming that clearly describes what they’re doing
Use camelCase for step slugs
Section titled “Use camelCase for step slugs”.step({ slug: "websiteContent" }, ...) // Correct.step({ slug: "website_content" }, ...) // Avoid
Step slugs are used as identifiers in TypeScript and must match exactly when referenced in dependency arrays. Following JavaScript conventions with camelCase helps maintain consistency.
While this guide recommends the hybrid pattern, the most important thing is consistency within your project. Document the chosen convention and apply it throughout the codebase.