JTBD Generator Skill
This skill generates complete JTBD (Jobs-to-be-Done) markdown files from user-provided step descriptions. It discovers the correct API operations, maps data flow between steps, and produces validated, hybrid-format JTBD files.
How to Use
When the user wants to create a JTBD, they will provide:
- Prerequisites: Conditions that must be met (e.g., "user logged in", "API asset exists in Exchange")
- Steps: List of operations in natural language (e.g., "Get GAV from Exchange", "Create API in API Manager")
You will guide them through discovery, validation, and generation.
Workflow
Step 1: Parse User Input
Extract the user's intent:
- Job purpose/title
- Prerequisites
- Step descriptions (in natural language)
If anything is unclear, ask clarifying questions:
- What's the goal of this workflow?
- What should happen in each step?
- Are there specific APIs you want to use?
Step 2: Discover Operations
For each step description:
Search for matching operations:
import sys
from pathlib import Path
# Add JTBD generator library to path
sys.path.insert(0, '.claude/skills/jtbd-generator')
from lib import api_discovery
# Search for operations matching the description
results = api_discovery.search_operations(
"create api", # User's description keywords
None, # Search all APIs, or specify URN like "urn:api:api-manager"
repo_root=Path(".")
)
# Show top 3-5 matches
for op in results[:5]:
print(f"{op['score']:.2f} - {op['operationId']} ({op['api']})")
print(f" {op['method']} {op['path']}")
print(f" {op['summary']}")
Present options to user:
- Show the top matches with scores
- Include operation summary and API
- Ask user to confirm or choose
Get operation details:
# Once user confirms, get full details
details = api_discovery.get_operation_details(
api_urn="urn:api:api-manager",
operation_id="createOrganizationsEnvironmentsApis",
repo_root=Path(".")
)
print(f"Parameters: {len(details['parameters'])}")
print(f"Method: {details['method']} {details['path']}")
Store selection:
- Step number
- Step name (user-provided)
- API URN
- Operation ID
- Operation details
Step 3: Analyze Parameters & Data Flow
For each step (in order from 1 to N):
Analyze parameters:
from lib import parameter_analyzer
# Build inputs considering previous steps
inputs = parameter_analyzer.build_all_inputs(
api_urn="urn:api:api-manager",
operation_id="createOrganizationsEnvironmentsApis",
repo_root=Path("."),
previous_steps=previous_steps # List of already-processed steps
)
# Review detected sources
for param_name, input_def in inputs.items():
if 'from' in input_def:
source = input_def['from']
print(f"{param_name}: from {source.get('api', source.get('step'))}")
elif input_def.get('userProvided'):
print(f"{param_name}: user-provided")
Suggest outputs:
from lib import response_analyzer
# Suggest outputs considering next steps
outputs = response_analyzer.analyze_response_for_operation(
api_urn="urn:api:api-manager",
operation_id="createOrganizationsEnvironmentsApis",
repo_root=Path("."),
next_steps=remaining_steps # Steps not yet processed
)
# Show suggestions
for output in outputs:
print(f"{output['name']}: {output['path']}")
if 'used_by' in output:
print(f" → Used by: {', '.join(output['used_by'])}")
Confirm with user:
- Show detected data flow
- Highlight any user-provided parameters
- Ask if adjustments are needed
Step 4: Generate JTBD Structure
Create kebab-case name:
from lib.utils import kebab_case
name = kebab_case("Deploy API with Omni Gateway")
# Result: "deploy-api-with-flex-gateway"
Build YAML blocks for each step:
from lib import jtbd_builder
yaml_block = jtbd_builder.build_step_yaml(
api_urn="urn:api:api-manager",
operation_id="createOrganizationsEnvironmentsApis",
inputs=inputs,
outputs=outputs
)
Generate prose sections:
Use your intelligence to write:
- Overview: Action-oriented description (start with verb: "Deploys...", "Creates...", "Configures...")
- What you'll build: Clear outcome statement
- Step descriptions: Explain what each step does and why
- What you'll need: Prerequisites for each step
- What happens next: Outcomes and connections to next steps
Quality guidelines:
- Be conversational and helpful
- Explain the "why", not just the "what"
- Connect steps logically
- Anticipate common questions
Build complete markdown:
from lib import jtbd_builder
# Prepare step definitions
steps = []
for i, step_info in enumerate(step_definitions, 1):
step_md = jtbd_builder.build_step_markdown(
step_number=i,
step_name=step_info['name'],
step_description="[Your prose explanation]",
operation_summary=step_info['operation_summary'],
yaml_block=step_info['yaml_block'],
what_you_need=step_info.get('what_you_need'),
what_happens_next="[Your explanation of outcomes]"
)
steps.append({'markdown': step_md})
# Assemble complete JTBD
jtbd_content = jtbd_builder.build_complete_jtbd(
name="deploy-api-with-flex-gateway",
description="Deploy API instance to Omni Gateway. Use when deploying APIs to Omni Gateway, setting up API instances, or connecting Exchange assets to gateways.",
title="Deploy API with Omni Gateway",
overview="Deploys an API instance to a Omni Gateway by retrieving asset details from Exchange, discovering available gateway targets, and creating the API instance in API Manager with the proper configuration.",
what_youll_build="An API instance connected to your Omni Gateway target",
prerequisites=[
"**Authentication** - Valid Bearer token for Anypoint Platform with API Manager and Exchange permissions",
"**Resources** - API asset published in Exchange and Omni Gateway deployed"
],
steps=steps,
completion_items=[
"Asset retrieved from Exchange",
"Gateway target identified",
"API instance created in API Manager"
],
what_youve_built="✅ **API Deployment** - Connected Exchange asset to API Manager, configured Omni Gateway as target, API ready for policy configuration",
next_steps=[
"**Apply Policies** - Add security policies (OAuth2, IP allowlist) and configure rate limiting",
"**Test API** - Verify endpoint is accessible and test through gateway"
]
)
Step 5: Validate
Run the validator to ensure correctness:
python3 .claude/skills/jtbd-generator/scripts/validate_jtbd.py /tmp/generated-job.md .
If validation fails:
- Explain the error in plain English
- Auto-fix when possible:
- Add missing outputs (common IDs)
- Correct step references
- Generate basic descriptions
- Regenerate and validate again
If validation succeeds:
- Show success message
- Proceed to save
Step 6: Save & Confirm
Determine save location:
- Default:
skills/{name}/SKILL.md
- Ask user if unsure
Save the file:
from pathlib import Path
output_dir = Path("skills/deploy-api-with-flex-gateway")
output_dir.mkdir(parents=True, exist_ok=True)
output_path = output_dir / "SKILL.md"
output_path.write_text(jtbd_content)
Confirm with user:
- Show file path
- Mention validation status
- Suggest next actions
Suggest related workflows:
- Based on the APIs used
- Based on similar existing JTBDs
- Based on common next steps
Example Interaction
User: Create a JTBD with these prerequisites: user logged in, API asset in Exchange.
Steps: 1) Get GAV from Exchange, 2) Get omni gateway targets, 3) Create API in api-manager.
You: I'll create a workflow for deploying an API with a Omni Gateway target.
Let me find the right operations for each step...
[Calls search_operations for each step]
I found these operations:
Step 1: Get GAV from Exchange
→ getAssetsByGroupidByAssetid (urn:api:exchange-experience)
GET /assets/{groupId}/{assetId}
Score: 0.85
Step 2: Get omni gateway targets
→ getOrganizationsByOrganizationidEnvironmentsByEnvironmentidGateways (urn:api:flex-gateway-manager)
GET /organizations/{organizationId}/environments/{environmentId}/gateways
Score: 0.78
Step 3: Create API in api-manager
→ createOrganizationsEnvironmentsApis (urn:api:api-manager)
POST /organizations/{organizationId}/environments/{environmentId}/apis
Score: 0.92
Does this match your intent?
User: Yes
You: Building the workflow...
[Analyzes parameters and data flow]
Data flow detected:
✓ Step 1 outputs: groupId, assetId, version
✓ Step 2 outputs: gatewayId
✓ Step 3 uses: groupId, assetId, version (from Step 1), gatewayId (from Step 2)
[Generates complete JTBD with prose]
Generated JTBD:
- Name: deploy-api-with-flex-gateway
- Steps: 3
- Prerequisites: User authentication, Exchange asset, Omni Gateway
[Validates]
Validation: ✅ PASSED
Save to skills/deploy-api-with-flex-gateway/SKILL.md?
User: Yes
You: ✅ Saved successfully!
File: skills/deploy-api-with-flex-gateway/SKILL.md
Next steps:
- Review the generated workflow
- Test with: python3 .claude/skills/jtbd-generator/scripts/validate_jtbd.py skills/deploy-api-with-flex-gateway/SKILL.md .
- Related workflows: deploy-api-with-rate-limiting, setup-multi-upstream-routing
Data Flow Intelligence
Apply these rules when detecting parameter sources:
Rule 1: Output → Input Matching (High Confidence)
If Step N outputs 'environmentApiId' AND Step N+1 needs 'environmentApiId':
→ Auto-link with { from: { step: "Step N", output: "environmentApiId" } }
Rule 2: Input Reuse (High Confidence)
If Step N uses 'organizationId' AND Step N+1 needs 'organizationId':
→ Reuse with { from: { step: "Step N", input: "organizationId" } }
(Not from original source - reuse the previous step's input)
Rule 3: x-origin Suggestions (High Confidence)
If parameter has x-origin annotation:
→ Use that as the default source
→ Add alternatives if provided
Rule 4: Common Patterns (Medium Confidence)
If parameter is 'organizationId' and no previous source:
→ Default to access-management#getOrganizations
If parameter is 'environmentId' and no previous source:
→ Default to access-management#listEnvironments
Rule 5: User-Provided Fallback (Low Confidence)
If no source detected:
→ Mark as userProvided: true
→ Add example if parameter has example in schema
→ Mention in conversation that this needs user input
Error Handling
Operation Not Found
"I couldn't find an operation matching '{description}' in {api_urn}.
Let me search more broadly..."
[Search all APIs, show top matches]
"Here are some operations that might work:
1. {operationId} ({api}) - {summary}
2. {operationId} ({api}) - {summary}
Which one fits best, or would you like to search differently?"
Validation Fails
"The generated JTBD has validation errors:
❌ Step 2 references unknown output 'apiId' from Step 1
I'll fix this by:
- Checking Step 1's actual outputs
- Updating Step 2's input to use the correct output name
Regenerating..."
Ambiguous Step Description
"Step 2: 'Get gateway targets' is ambiguous.
I found operations in two APIs:
1. Omni Gateway Manager - List omni gateways
2. Runtime Manager - List CloudHub workers
Which one should I use?"
Tips for Quality Output
Write conversational prose:
- "Start by retrieving..." not "This step retrieves..."
- "You'll need the organization ID..." not "organizationId is required"
Explain the why:
- Not just "Create an API instance"
- But "Create an API instance to register your Exchange asset with API Manager, enabling policy application and gateway routing"
Connect steps logically:
- End each step with "What happens next" that leads into the next step
- Show how outputs become inputs
Anticipate issues:
- Add "Common issues" for known problems
- Mention typical error responses
Be specific:
- "Organization Business Group GUID" not just "organization ID"
- "Target environment ID (e.g., Production, Sandbox)" not just "environment ID"
Available Python Utilities
You have access to these utilities in .claude/skills/jtbd-generator/lib/:
api_discovery.py
list_available_apis(repo_root) - List all APIs with metadata
search_operations(query, api_urn, repo_root) - Fuzzy search for operations
get_operation_details(api_urn, operation_id, repo_root) - Get full operation details
get_operations_by_api(api_urn, repo_root) - List all operations in an API
parameter_analyzer.py
analyze_parameters(spec, operation_id, spec_path) - Extract all parameters with metadata
detect_parameter_source(param_name, param_def, previous_steps) - Detect where parameter should come from
build_input_definition(param_name, param_def, source) - Build JTBD input definition
build_all_inputs(api_urn, operation_id, repo_root, previous_steps) - Build complete inputs section
response_analyzer.py
suggest_outputs(spec, operation_id, spec_path, next_steps) - Suggest which fields to capture
generate_jsonpath(field_path) - Generate JSONPath expressions
analyze_response_for_operation(api_urn, operation_id, repo_root, next_steps) - Main entry point
jtbd_builder.py
build_frontmatter(name, description) - Generate YAML frontmatter
build_step_yaml(api_urn, operation_id, inputs, outputs) - Generate YAML block for step
build_step_markdown(step_number, step_name, ...) - Generate complete step section
build_complete_jtbd(name, description, title, ...) - Assemble complete JTBD
utils.py
load_openapi_spec(api_path) - Load and parse OpenAPI spec
urn_to_path(urn, repo_root) - Convert URN to filesystem path
path_to_urn(api_path) - Convert filesystem path to URN
kebab_case(text) - Convert text to kebab-case
resolve_ref(ref, spec, spec_path) - Resolve $ref references
find_api_dirs(repo_root) - Find all API directories
common_patterns.py
match_common_pattern(param_name) - Check for known patterns
is_likely_user_provided(param_name) - Check if likely user-provided
get_example_for_param(param_name, param_schema) - Get example values
Success Criteria
A successful JTBD generation:
- ✅ Passes validation (
validate_jtbd.py)
- ✅ All operations exist in referenced API specs
- ✅ Data flow correctly maps outputs to inputs
- ✅ Prose sections are clear and helpful (not template-like)
- ✅ User completed generation in <5 minutes of interaction
- ✅ User understands what the workflow does and how to use it
Notes
- Always run the workflow in order: Parse → Discover → Analyze → Generate → Validate → Save
- Use the Python utilities for spec parsing and structure building
- Use your intelligence for prose generation and user interaction
- Be conversational and helpful
- When in doubt, ask the user for clarification
- Default to skills/{name}/SKILL.md for output location
1---2name: jtbd-generator3description: Generate JTBD (Jobs-to-be-Done) markdown files from step descriptions. Use when creating API workflows, building JTBD files, documenting multi-step processes, or when user says "create a JTBD", "generate workflow", "document these API steps", or "build a job with these operations".4---56# JTBD Generator Skill78This skill generates complete JTBD (Jobs-to-be-Done) markdown files from user-provided step descriptions. It discovers the correct API operations, maps data flow between steps, and produces validated, hybrid-format JTBD files.910## How to Use1112When the user wants to create a JTBD, they will provide:13141. **Prerequisites**: Conditions that must be met (e.g., "user logged in", "API asset exists in Exchange")152. **Steps**: List of operations in natural language (e.g., "Get GAV from Exchange", "Create API in API Manager")1617You will guide them through discovery, validation, and generation.1819---2021## Workflow2223### Step 1: Parse User Input2425Extract the user's intent:26- Job purpose/title27- Prerequisites28- Step descriptions (in natural language)2930If anything is unclear, ask clarifying questions:31- What's the goal of this workflow?32- What should happen in each step?33- Are there specific APIs you want to use?3435### Step 2: Discover Operations3637For each step description:38391. **Search for matching operations:**40 ```python41 import sys42 from pathlib import Path4344 # Add JTBD generator library to path45 sys.path.insert(0, '.claude/skills/jtbd-generator')46 from lib import api_discovery4748 # Search for operations matching the description49 results = api_discovery.search_operations(50 "create api", # User's description keywords51 None, # Search all APIs, or specify URN like "urn:api:api-manager"52 repo_root=Path(".")53 )5455 # Show top 3-5 matches56 for op in results[:5]:57 print(f"{op['score']:.2f} - {op['operationId']} ({op['api']})")58 print(f" {op['method']} {op['path']}")59 print(f" {op['summary']}")60 ```61622. **Present options to user:**63 - Show the top matches with scores64 - Include operation summary and API65 - Ask user to confirm or choose66673. **Get operation details:**68 ```python69 # Once user confirms, get full details70 details = api_discovery.get_operation_details(71 api_urn="urn:api:api-manager",72 operation_id="createOrganizationsEnvironmentsApis",73 repo_root=Path(".")74 )7576 print(f"Parameters: {len(details['parameters'])}")77 print(f"Method: {details['method']} {details['path']}")78 ```79804. **Store selection:**81 - Step number82 - Step name (user-provided)83 - API URN84 - Operation ID85 - Operation details8687### Step 3: Analyze Parameters & Data Flow8889For each step (in order from 1 to N):90911. **Analyze parameters:**92 ```python93 from lib import parameter_analyzer9495 # Build inputs considering previous steps96 inputs = parameter_analyzer.build_all_inputs(97 api_urn="urn:api:api-manager",98 operation_id="createOrganizationsEnvironmentsApis",99 repo_root=Path("."),100 previous_steps=previous_steps # List of already-processed steps101 )102103 # Review detected sources104 for param_name, input_def in inputs.items():105 if 'from' in input_def:106 source = input_def['from']107 print(f"{param_name}: from {source.get('api', source.get('step'))}")108 elif input_def.get('userProvided'):109 print(f"{param_name}: user-provided")110 ```1111122. **Suggest outputs:**113 ```python114 from lib import response_analyzer115116 # Suggest outputs considering next steps117 outputs = response_analyzer.analyze_response_for_operation(118 api_urn="urn:api:api-manager",119 operation_id="createOrganizationsEnvironmentsApis",120 repo_root=Path("."),121 next_steps=remaining_steps # Steps not yet processed122 )123124 # Show suggestions125 for output in outputs:126 print(f"{output['name']}: {output['path']}")127 if 'used_by' in output:128 print(f" → Used by: {', '.join(output['used_by'])}")129 ```1301313. **Confirm with user:**132 - Show detected data flow133 - Highlight any user-provided parameters134 - Ask if adjustments are needed135136### Step 4: Generate JTBD Structure1371381. **Create kebab-case name:**139 ```python140 from lib.utils import kebab_case141142 name = kebab_case("Deploy API with Omni Gateway")143 # Result: "deploy-api-with-flex-gateway"144 ```1451462. **Build YAML blocks for each step:**147 ```python148 from lib import jtbd_builder149150 yaml_block = jtbd_builder.build_step_yaml(151 api_urn="urn:api:api-manager",152 operation_id="createOrganizationsEnvironmentsApis",153 inputs=inputs,154 outputs=outputs155 )156 ```1571583. **Generate prose sections:**159160 Use your intelligence to write:161 - **Overview**: Action-oriented description (start with verb: "Deploys...", "Creates...", "Configures...")162 - **What you'll build**: Clear outcome statement163 - **Step descriptions**: Explain what each step does and why164 - **What you'll need**: Prerequisites for each step165 - **What happens next**: Outcomes and connections to next steps166167 Quality guidelines:168 - Be conversational and helpful169 - Explain the "why", not just the "what"170 - Connect steps logically171 - Anticipate common questions1721734. **Build complete markdown:**174 ```python175 from lib import jtbd_builder176177 # Prepare step definitions178 steps = []179 for i, step_info in enumerate(step_definitions, 1):180 step_md = jtbd_builder.build_step_markdown(181 step_number=i,182 step_name=step_info['name'],183 step_description="[Your prose explanation]",184 operation_summary=step_info['operation_summary'],185 yaml_block=step_info['yaml_block'],186 what_you_need=step_info.get('what_you_need'),187 what_happens_next="[Your explanation of outcomes]"188 )189 steps.append({'markdown': step_md})190191 # Assemble complete JTBD192 jtbd_content = jtbd_builder.build_complete_jtbd(193 name="deploy-api-with-flex-gateway",194 description="Deploy API instance to Omni Gateway. Use when deploying APIs to Omni Gateway, setting up API instances, or connecting Exchange assets to gateways.",195 title="Deploy API with Omni Gateway",196 overview="Deploys an API instance to a Omni Gateway by retrieving asset details from Exchange, discovering available gateway targets, and creating the API instance in API Manager with the proper configuration.",197 what_youll_build="An API instance connected to your Omni Gateway target",198 prerequisites=[199 "**Authentication** - Valid Bearer token for Anypoint Platform with API Manager and Exchange permissions",200 "**Resources** - API asset published in Exchange and Omni Gateway deployed"201 ],202 steps=steps,203 completion_items=[204 "Asset retrieved from Exchange",205 "Gateway target identified",206 "API instance created in API Manager"207 ],208 what_youve_built="✅ **API Deployment** - Connected Exchange asset to API Manager, configured Omni Gateway as target, API ready for policy configuration",209 next_steps=[210 "**Apply Policies** - Add security policies (OAuth2, IP allowlist) and configure rate limiting",211 "**Test API** - Verify endpoint is accessible and test through gateway"212 ]213 )214 ```215216### Step 5: Validate217218Run the validator to ensure correctness:219220```bash221python3 .claude/skills/jtbd-generator/scripts/validate_jtbd.py /tmp/generated-job.md .222```223224If validation fails:225- Explain the error in plain English226- Auto-fix when possible:227 - Add missing outputs (common IDs)228 - Correct step references229 - Generate basic descriptions230- Regenerate and validate again231232If validation succeeds:233- Show success message234- Proceed to save235236### Step 6: Save & Confirm2372381. **Determine save location:**239 - Default: `skills/{name}/SKILL.md`240 - Ask user if unsure2412422. **Save the file:**243 ```python244 from pathlib import Path245246 output_dir = Path("skills/deploy-api-with-flex-gateway")247 output_dir.mkdir(parents=True, exist_ok=True)248 output_path = output_dir / "SKILL.md"249 output_path.write_text(jtbd_content)250 ```2512523. **Confirm with user:**253 - Show file path254 - Mention validation status255 - Suggest next actions2562574. **Suggest related workflows:**258 - Based on the APIs used259 - Based on similar existing JTBDs260 - Based on common next steps261262---263264## Example Interaction265266```267User: Create a JTBD with these prerequisites: user logged in, API asset in Exchange.268Steps: 1) Get GAV from Exchange, 2) Get omni gateway targets, 3) Create API in api-manager.269270You: I'll create a workflow for deploying an API with a Omni Gateway target.271272Let me find the right operations for each step...273274[Calls search_operations for each step]275276I found these operations:277278Step 1: Get GAV from Exchange279 → getAssetsByGroupidByAssetid (urn:api:exchange-experience)280 GET /assets/{groupId}/{assetId}281 Score: 0.85282283Step 2: Get omni gateway targets284 → getOrganizationsByOrganizationidEnvironmentsByEnvironmentidGateways (urn:api:flex-gateway-manager)285 GET /organizations/{organizationId}/environments/{environmentId}/gateways286 Score: 0.78287288Step 3: Create API in api-manager289 → createOrganizationsEnvironmentsApis (urn:api:api-manager)290 POST /organizations/{organizationId}/environments/{environmentId}/apis291 Score: 0.92292293Does this match your intent?294295User: Yes296297You: Building the workflow...298299[Analyzes parameters and data flow]300301Data flow detected:302✓ Step 1 outputs: groupId, assetId, version303✓ Step 2 outputs: gatewayId304✓ Step 3 uses: groupId, assetId, version (from Step 1), gatewayId (from Step 2)305306[Generates complete JTBD with prose]307308Generated JTBD:309- Name: deploy-api-with-flex-gateway310- Steps: 3311- Prerequisites: User authentication, Exchange asset, Omni Gateway312313[Validates]314315Validation: ✅ PASSED316317Save to skills/deploy-api-with-flex-gateway/SKILL.md?318319User: Yes320321You: ✅ Saved successfully!322323File: skills/deploy-api-with-flex-gateway/SKILL.md324325Next steps:326- Review the generated workflow327- Test with: python3 .claude/skills/jtbd-generator/scripts/validate_jtbd.py skills/deploy-api-with-flex-gateway/SKILL.md .328- Related workflows: deploy-api-with-rate-limiting, setup-multi-upstream-routing329```330331---332333## Data Flow Intelligence334335Apply these rules when detecting parameter sources:336337**Rule 1: Output → Input Matching (High Confidence)**338```339If Step N outputs 'environmentApiId' AND Step N+1 needs 'environmentApiId':340 → Auto-link with { from: { step: "Step N", output: "environmentApiId" } }341```342343**Rule 2: Input Reuse (High Confidence)**344```345If Step N uses 'organizationId' AND Step N+1 needs 'organizationId':346 → Reuse with { from: { step: "Step N", input: "organizationId" } }347 (Not from original source - reuse the previous step's input)348```349350**Rule 3: x-origin Suggestions (High Confidence)**351```352If parameter has x-origin annotation:353 → Use that as the default source354 → Add alternatives if provided355```356357**Rule 4: Common Patterns (Medium Confidence)**358```359If parameter is 'organizationId' and no previous source:360 → Default to access-management#getOrganizations361362If parameter is 'environmentId' and no previous source:363 → Default to access-management#listEnvironments364```365366**Rule 5: User-Provided Fallback (Low Confidence)**367```368If no source detected:369 → Mark as userProvided: true370 → Add example if parameter has example in schema371 → Mention in conversation that this needs user input372```373374---375376## Error Handling377378### Operation Not Found379```380"I couldn't find an operation matching '{description}' in {api_urn}.381382Let me search more broadly..."383384[Search all APIs, show top matches]385386"Here are some operations that might work:3871. {operationId} ({api}) - {summary}3882. {operationId} ({api}) - {summary}389390Which one fits best, or would you like to search differently?"391```392393### Validation Fails394```395"The generated JTBD has validation errors:396397❌ Step 2 references unknown output 'apiId' from Step 1398399I'll fix this by:400- Checking Step 1's actual outputs401- Updating Step 2's input to use the correct output name402403Regenerating..."404```405406### Ambiguous Step Description407```408"Step 2: 'Get gateway targets' is ambiguous.409410I found operations in two APIs:4111. Omni Gateway Manager - List omni gateways4122. Runtime Manager - List CloudHub workers413414Which one should I use?"415```416417---418419## Tips for Quality Output4204211. **Write conversational prose:**422 - "Start by retrieving..." not "This step retrieves..."423 - "You'll need the organization ID..." not "organizationId is required"4244252. **Explain the why:**426 - Not just "Create an API instance"427 - But "Create an API instance to register your Exchange asset with API Manager, enabling policy application and gateway routing"4284293. **Connect steps logically:**430 - End each step with "What happens next" that leads into the next step431 - Show how outputs become inputs4324334. **Anticipate issues:**434 - Add "Common issues" for known problems435 - Mention typical error responses4364375. **Be specific:**438 - "Organization Business Group GUID" not just "organization ID"439 - "Target environment ID (e.g., Production, Sandbox)" not just "environment ID"440441---442443## Available Python Utilities444445You have access to these utilities in `.claude/skills/jtbd-generator/lib/`:446447### api_discovery.py448- `list_available_apis(repo_root)` - List all APIs with metadata449- `search_operations(query, api_urn, repo_root)` - Fuzzy search for operations450- `get_operation_details(api_urn, operation_id, repo_root)` - Get full operation details451- `get_operations_by_api(api_urn, repo_root)` - List all operations in an API452453### parameter_analyzer.py454- `analyze_parameters(spec, operation_id, spec_path)` - Extract all parameters with metadata455- `detect_parameter_source(param_name, param_def, previous_steps)` - Detect where parameter should come from456- `build_input_definition(param_name, param_def, source)` - Build JTBD input definition457- `build_all_inputs(api_urn, operation_id, repo_root, previous_steps)` - Build complete inputs section458459### response_analyzer.py460- `suggest_outputs(spec, operation_id, spec_path, next_steps)` - Suggest which fields to capture461- `generate_jsonpath(field_path)` - Generate JSONPath expressions462- `analyze_response_for_operation(api_urn, operation_id, repo_root, next_steps)` - Main entry point463464### jtbd_builder.py465- `build_frontmatter(name, description)` - Generate YAML frontmatter466- `build_step_yaml(api_urn, operation_id, inputs, outputs)` - Generate YAML block for step467- `build_step_markdown(step_number, step_name, ...)` - Generate complete step section468- `build_complete_jtbd(name, description, title, ...)` - Assemble complete JTBD469470### utils.py471- `load_openapi_spec(api_path)` - Load and parse OpenAPI spec472- `urn_to_path(urn, repo_root)` - Convert URN to filesystem path473- `path_to_urn(api_path)` - Convert filesystem path to URN474- `kebab_case(text)` - Convert text to kebab-case475- `resolve_ref(ref, spec, spec_path)` - Resolve $ref references476- `find_api_dirs(repo_root)` - Find all API directories477478### common_patterns.py479- `match_common_pattern(param_name)` - Check for known patterns480- `is_likely_user_provided(param_name)` - Check if likely user-provided481- `get_example_for_param(param_name, param_schema)` - Get example values482483---484485## Success Criteria486487A successful JTBD generation:4884891. ✅ Passes validation (`validate_jtbd.py`)4902. ✅ All operations exist in referenced API specs4913. ✅ Data flow correctly maps outputs to inputs4924. ✅ Prose sections are clear and helpful (not template-like)4935. ✅ User completed generation in <5 minutes of interaction4946. ✅ User understands what the workflow does and how to use it495496---497498## Notes499500- Always run the workflow in order: Parse → Discover → Analyze → Generate → Validate → Save501- Use the Python utilities for spec parsing and structure building502- Use your intelligence for prose generation and user interaction503- Be conversational and helpful504- When in doubt, ask the user for clarification505- Default to skills/{name}/SKILL.md for output location