|
| 1 | +# Speakeasy Plugin for Claude Code |
| 2 | + |
| 3 | +Generate production-ready SDKs from OpenAPI specifications with guidance for the Speakeasy CLI. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +```bash |
| 8 | +claude /install github:speakeasy-api/speakeasy/plugins/claude-code |
| 9 | +``` |
| 10 | + |
| 11 | +## What This Provides |
| 12 | + |
| 13 | +This plugin provides **skills** - usage guidance and decision frameworks for Speakeasy CLI operations: |
| 14 | + |
| 15 | +| Skill | Use When... | |
| 16 | +|-------|-------------| |
| 17 | +| `start-new-sdk-project` | You have an OpenAPI spec and want to generate an SDK | |
| 18 | +| `regenerate-sdk` | Your spec changed and you need to regenerate | |
| 19 | +| `validate-openapi-spec` | Checking if spec is valid, running `speakeasy lint` | |
| 20 | +| `get-ai-suggestions` | SDK method names are ugly, wanting to improve operation IDs | |
| 21 | +| `check-workspace-status` | Asking what targets/sources are configured | |
| 22 | +| `create-openapi-overlay` | Need to customize SDK without editing source spec | |
| 23 | +| `apply-openapi-overlay` | Applying an overlay file to a spec | |
| 24 | +| `merge-openapi-specs` | Combining multiple OpenAPI specs | |
| 25 | +| `diagnose-generation-failure` | SDK generation failed, seeing "Step Failed: Workflow" | |
| 26 | +| `fix-validation-errors-with-overlays` | Have lint errors but can't modify source spec | |
| 27 | +| `improve-operation-ids` | SDK methods have names like GetApiV1Users | |
| 28 | + |
| 29 | +## Philosophy |
| 30 | + |
| 31 | +Claude Code already calls CLIs reliably. This plugin doesn't wrap CLI commands - instead it provides: |
| 32 | + |
| 33 | +1. **Usage guidance** - How to use each command effectively |
| 34 | +2. **Decision frameworks** - When to use overlays vs ask the user |
| 35 | +3. **Troubleshooting** - How to diagnose and fix common issues |
| 36 | + |
| 37 | +## Key Principles |
| 38 | + |
| 39 | +### Use the Workflow |
| 40 | + |
| 41 | +```bash |
| 42 | +# Initialize project |
| 43 | +speakeasy quickstart -s openapi.yaml -t typescript |
| 44 | + |
| 45 | +# Regenerate after changes (use --output console for AI-friendly output) |
| 46 | +speakeasy run --output console |
| 47 | +``` |
| 48 | + |
| 49 | +### Overlay Over Modify |
| 50 | + |
| 51 | +Never modify the source OpenAPI spec directly. Use overlays to: |
| 52 | +- Rename operations |
| 53 | +- Add descriptions |
| 54 | +- Configure SDK behavior |
| 55 | +- Make portable patches across spec versions |
| 56 | + |
| 57 | +### Don't Auto-Fix Everything |
| 58 | + |
| 59 | +When encountering spec issues: |
| 60 | +- **Small issues** (naming, descriptions) → Fix with overlays |
| 61 | +- **Structural issues** (invalid refs, missing schemas) → Ask the user |
| 62 | +- **Design issues** (auth, API structure) → Produce strategy document |
| 63 | + |
| 64 | +## Plugin Structure |
| 65 | + |
| 66 | +``` |
| 67 | +plugins/claude-code/ |
| 68 | +├── .claude-plugin/ |
| 69 | +│ └── plugin.json # Plugin metadata |
| 70 | +├── skills/ # Individual skill files |
| 71 | +│ ├── start-new-sdk-project.md |
| 72 | +│ ├── regenerate-sdk.md |
| 73 | +│ ├── validate-openapi-spec.md |
| 74 | +│ └── ... |
| 75 | +├── marketplace.json # Marketplace metadata |
| 76 | +└── README.md |
| 77 | +``` |
| 78 | + |
| 79 | +## Prerequisites |
| 80 | + |
| 81 | +Install Speakeasy CLI: |
| 82 | + |
| 83 | +```bash |
| 84 | +# macOS |
| 85 | +brew install speakeasy-api/homebrew-tap/speakeasy |
| 86 | + |
| 87 | +# Other platforms |
| 88 | +curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh |
| 89 | +``` |
| 90 | + |
| 91 | +## Resources |
| 92 | + |
| 93 | +- [Speakeasy Documentation](https://speakeasy.com/docs) |
| 94 | +- [OpenAPI Best Practices](https://speakeasy.com/docs/openapi) |
| 95 | +- [SDK Customization](https://speakeasy.com/docs/customize-sdks) |
| 96 | + |
| 97 | +## License |
| 98 | + |
| 99 | +Apache-2.0 |
0 commit comments