improve-sdk-naming
Original:🇺🇸 English
Translated
Use when you want AI-powered suggestions for SDK naming improvements via the `speakeasy suggest` command (not manual overlay creation). Triggers on "suggest improvements", "speakeasy suggest", "AI suggestions", "suggest operation-ids", "suggest error-types", "auto-improve naming", "get AI recommendations".
1installs
Added on
NPX Install
npx skill4agent add speakeasy-api/agent-skills improve-sdk-namingTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →improve-sdk-naming
Improve SDK method naming using AI-powered suggestions or manual overrides. Covers both automatic commands and manual naming with and extensions.
speakeasy suggestx-speakeasy-groupx-speakeasy-name-overrideWhen to Use
Use this skill when you want AI-powered suggestions from Speakeasy:
- SDK methods have ugly auto-generated names like
GetApiV1Users - You want Speakeasy AI to suggest better operation IDs
- You want AI-generated suggestions for error types
- Looking to improve spec quality automatically using
speakeasy suggest - User says: "suggest improvements", "speakeasy suggest", "AI suggestions", "suggest operation-ids", "suggest error-types", "get AI recommendations"
NOT for: Manually creating overlays (see instead)
manage-openapi-overlaysInputs
| Input | Required | Description |
|---|---|---|
| OpenAPI spec | Yes | Path to the spec file ( |
| Authentication | Yes | Via |
| Output file | No | Path for overlay output ( |
Outputs
| Output | Description |
|---|---|
| Suggestions | Better operation names or error types printed to console |
| Overlay file | Optional: saves suggestions as an overlay YAML file ( |
Prerequisites
For non-interactive environments (CI/CD, AI agents), set the API key as an environment variable:
bash
export SPEAKEASY_API_KEY="<your-api-key>"For interactive use, authenticate directly:
bash
speakeasy auth loginCommand
AI-Powered Suggestions
bash
# Suggest better operation IDs (SDK method names)
speakeasy suggest operation-ids -s <spec-path>
# Suggest error type definitions
speakeasy suggest error-types -s <spec-path>
# Output suggestions as an overlay file
speakeasy suggest operation-ids -s <spec-path> -o suggested-overlay.yamlCheck Current Operation IDs
Run the suggest command without to preview what would change:
-obash
speakeasy suggest operation-ids -s openapi.yamlSDK Method Naming Convention
Speakeasy generates grouped SDK methods from operation IDs. The naming convention uses for the namespace and for the method name.
x-speakeasy-groupx-speakeasy-name-override| HTTP Method | SDK Usage | Operation ID |
|---|---|---|
| GET (list) | | |
| GET (single) | | |
| POST | | |
| PUT | | |
| DELETE | | |
The operation ID format is . Speakeasy splits on the underscore to create the namespace and method name in the generated SDK.
{group}_{method}Example
Step 1: Get AI Suggestions
bash
speakeasy suggest operation-ids -s openapi.yaml -o operation-ids-overlay.yamlThis analyzes your spec and generates an overlay that transforms names like:
- ->
get_api_v1_users_listlistUsers - ->
post_api_v1_users_createcreateUser
Step 2: Review and Apply the Overlay
The AI-generated overlay (from ) creates naming improvements using and .
-ox-speakeasy-groupx-speakeasy-name-overrideNote: For manual overlay creation, use the skill instead of this skill.
manage-openapi-overlaysStep 3: Add the Overlay to workflow.yaml
yaml
sources:
my-api:
inputs:
- location: ./openapi.yaml
overlays:
- location: ./operation-ids-overlay.yamlStep 4: Regenerate the SDK
bash
speakeasy run --output consoleError Type Suggestions
The command analyzes your API and suggests structured error responses:
suggest error-typesbash
speakeasy suggest error-types -s openapi.yamlThis suggests:
- Common HTTP error codes (400, 401, 404, 500)
- Custom error schemas appropriate for your API
Output as an overlay:
bash
speakeasy suggest error-types -s openapi.yaml -o error-types-overlay.yamlWhat NOT to Do
- Do NOT modify operationIds directly in the source spec if it is externally managed. Use overlays instead.
- Do NOT use generic names like or
getwithout a group. Always pairpostwithx-speakeasy-name-override.x-speakeasy-group - Do NOT forget to add the generated overlay to after creating it. Without this step, the names will not change in the generated SDK.
workflow.yaml - Do NOT create duplicate operation names across different groups. Each combination must be unique.
{group}_{method}
Troubleshooting
| Error | Cause | Solution |
|---|---|---|
| "unauthorized" | Missing or invalid API key | Set |
| Names unchanged after regeneration | Overlay not added to workflow | Add the overlay to the |
| No suggestions returned | Spec already has good naming | No action needed; names are already well-structured |
| Duplicate method names | Similar endpoints share names | Use unique |
| Timeout during suggest | Very large spec | Try running on a smaller subset or increase timeout |