brainstorming
Structured design dialogue that validates ideas before implementation begins.
enhance-workflow
Analyze, refactor, and enhance existing Workscript workflow JSON files based on user feedback. Use when asked to improve, optimize, refactor, fix, or enhance an existing workflow. Triggers on requests like "improve this workflow", "optimize the X workflow", "add error handling to", "make this wor...
Full skill instructions
Refine existing workflows through surgical enhancements, like a master craftsman perfecting their work. Every enhancement removes what doesn't belong and reveals the workflow's true potential.
Surgical precision over wholesale rewriting. Enhancing a workflow means understanding its purpose and making focused changes that improve without disrupting. Changes should be:
Workflow enhancement follows these steps:
The user must specify which workflow to enhance. Accept:
/apps/sandbox/resources/shared/prompts/my-workflow.jsonmy-workflow (resolve to standard locations)Default locations to search:
/apps/sandbox/resources/shared/prompts/
/apps/api/prompts/
If the target is ambiguous, ask for clarification before proceeding.
Before making any changes, perform comprehensive analysis using scripts/analyze-workflow.ts:
bun /Users/narcisbrindusescu/teste/workscript/.claude/skills/enhance-workflow/scripts/analyze-workflow.ts <workflow.json>
The analysis examines:
error? edges on nodes that can failRead the full workflow contents and understand:
User feedback comes in several forms. See references/enhancement-patterns.md for detailed patterns.
Direct requests: "Add error handling to all nodes", "Flatten the nested structure" Observations: "The workflow fails when AI returns invalid JSON", "It crashes on empty arrays" Advice: "It should validate input first", "The loop needs a guard" Critique: "Too deeply nested", "Missing defensive guards", "Hard to read"
For each piece of feedback, identify:
Map feedback to specific workflow components:
| Feedback Type | Target | Enhancement Approach |
|---|---|---|
| Missing guards | Entry point | Add validateData for input validation |
| AI response fails | After ask-ai | Add JSON validation chain |
| Empty array crashes | Before loops | Add logic array length guard |
| Too nested | Workflow structure | Flatten sequential operations |
| Missing error handling | All fallible nodes | Add error? edges |
| Hard to maintain | Deeply nested branches | Extract to flat workflow array |
| Performance issues | Loops, API calls | Add timeouts, batch processing |
Create a change plan before implementing:
## Enhancement Plan
### Target: workflow-id.json
### Changes:
1. [Location] - [Change description] - [Rationale]
2. [Location] - [Change description] - [Rationale]
### Preserved:
- [What stays unchanged and why]
### Risk Assessment:
- [Potential issues and mitigations]
Apply changes following these principles:
For structure changes:
success? chains to flat workflow arrays when sequentialtrue?/false?, valid?/invalid?) as edgesFor adding guards:
ask-ai callserror? edges to all nodes that can failFor flattening:
For state management:
After implementing changes, validate using the standard workflow validator:
bun /Users/narcisbrindusescu/teste/workscript/.claude/skills/new-workflow/scripts/validate-workflow.ts <workflow.json>
And compare before/after:
bun /Users/narcisbrindusescu/teste/workscript/.claude/skills/enhance-workflow/scripts/diff-workflows.ts <original.json> <enhanced.json>
Validation checks:
$.path references correctThe most common enhancement - making workflows robust against runtime errors.
Pattern: Input Validation Guard
Add at workflow entry:
{
"validateData": {
"validationType": "required_fields",
"data": "$.input",
"requiredFields": ["userId", "action"],
"invalid?": {
"log": { "message": "Missing required input: {{$.validationErrors}}" }
}
}
}
Pattern: AI Response JSON Guard
Add after any ask-ai expecting structured output:
{
"validateData": {
"validationType": "json",
"data": "$.aiResponse",
"valid?": {
"validateData": {
"validationType": "required_fields",
"data": "$.parsedJson",
"requiredFields": ["expectedField"],
"valid?": { ... },
"invalid?": {
"log": { "message": "AI response missing fields: {{$.validationErrors}}" }
}
}
},
"invalid?": {
"log": { "message": "AI did not return valid JSON" }
}
}
}
Pattern: Array Length Guard
Add before loops or array operations:
{
"logic": {
"operation": "greater",
"values": ["$.items.length", 0],
"true?": { ... loop or array processing ... },
"false?": {
"log": { "message": "No items to process" }
}
}
}
Convert unnecessarily nested workflows to flat sequential structure.
Before - Excessive Nesting:
{
"workflow": [
{
"filter": {
"success?": {
"sort": {
"success?": {
"log": { "message": "Done" }
}
}
}
}
}
]
}
After - Flat Sequential:
{
"workflow": [
{
"filter": {
"items": "$.data",
"error?": { "log": { "message": "Filter failed" } }
}
},
{
"sort": {
"type": "simple",
"error?": { "log": { "message": "Sort failed" } }
}
},
{
"log": { "message": "Done" }
}
]
}
Ensure all fallible nodes have error? edges.
Nodes that need error? edges:
| Node Type | Common Errors |
|---|---|
database | Connection, query syntax, not found |
filesystem | File not found, permissions |
fetchApi | Network, timeout, HTTP errors |
ask-ai | API errors, rate limits |
auth | Invalid credentials |
validateData | Validation failures |
Enhancement pattern:
{
"database": {
"operation": "find",
"table": "users",
"query": { "id": "$.userId" },
"found?": { ... },
"not_found?": {
"log": { "message": "User {{$.userId}} not found" }
},
"error?": {
"log": { "message": "Database error: {{$.error}}" }
}
}
}
Make loops safer and more efficient.
Add loop guard:
{
"logic": {
"operation": "and",
"values": [
{ "operation": "greater", "values": ["$.items.length", 0] }
],
"true?": {
"logic...": {
"operation": "less",
"values": ["$.index", "$.items.length"],
"true?": [ ... loop body ... ],
"false?": null
}
},
"false?": {
"log": { "message": "No items to process" }
}
}
}
Make state usage clearer and prevent conflicts.
Pattern: Explicit intermediate state:
{
"workflow": [
{
"filter": { "items": "$.rawData" }
},
{
"editFields": {
"mode": "manual_mapping",
"fieldsToSet": [
{ "name": "filteredData", "value": "$.filterPassed", "type": "array" }
]
}
},
{
"sort": { "type": "simple" }
},
{
"editFields": {
"mode": "manual_mapping",
"fieldsToSet": [
{ "name": "processedData", "value": "$.sortedItems", "type": "array" }
]
}
}
]
}
Before finalizing any enhancement:
validate-workflow.ts returns successerror? edgesSee references/anti-patterns.md for detailed examples.
Over-enhancement: Adding more than requested, scope creep Breaking changes: Removing functionality without replacement Over-flattening: Flattening actual conditional branches Guard overload: Adding redundant validations State pollution: Adding unnecessary intermediate state keys
# Analyze workflow
bun .claude/skills/enhance-workflow/scripts/analyze-workflow.ts <workflow.json>
# Validate enhanced workflow
bun .claude/skills/new-workflow/scripts/validate-workflow.ts <workflow.json>
# Compare before/after
bun .claude/skills/enhance-workflow/scripts/diff-workflows.ts <original> <enhanced>
| Request | Enhancement |
|---|---|
| "Add guards" | Input validation + AI validation + array guards |
| "Flatten structure" | Convert success? chains to workflow array |
| "Add error handling" | Add error? edges to all fallible nodes |
| "Make robust" | All guards + all error edges |
| "Optimize loop" | Add length guard + exit condition |
/new-workflow/references/workflow-syntax.md/new-workflow/references/node-quick-reference.md/new-workflow/references/flat-vs-nested.mdStructured design dialogue that validates ideas before implementation begins.
Comprehensive design intelligence for web and mobile UI/UX across 10 technology stacks.
Comprehensive implementation plans for multi-step tasks, breaking down specs into bite-sized, testable steps.
Introduction to the obra skills system with mandatory skill invocation rules and best practices.
Execute a written implementation plan with critical review and task checkpoints.
Delegate independent tasks to specialized agents working concurrently with isolated context.
Isolated git worktrees with smart directory selection and safety verification.
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
Plan searchable and shareable content that drives traffic, builds authority, and generates leads.
README-first repository scanner that extracts commands and classifies reproduction candidates without executing them.
Brainstorm and prioritize marketing strategies tailored to your SaaS stage, budget, and goals.
Plan and optimize your website's page hierarchy, navigation, URL structure, and internal linking.
The world's fastest calendar for remote work
Capture, organize, and utilize your knowledge effortlessly.
Instant Summaries of Audio & Video Interviews with AnySummary
Transform PDFs into engaging mind maps.
Chat with any PDF instantly
Create an optimal daily plan using your voice
A productivity platform to centralize organizational knowledge and workflows with contextual AI assistance.
AskYourPDF Pricing Plans: Tailored to Your Needs