Skip to content

Align skills REST API contract with RESTful conventions#3818

Merged
JAORMX merged 1 commit intomainfrom
jaosorior/skill-api-contract-changes
Feb 13, 2026
Merged

Align skills REST API contract with RESTful conventions#3818
JAORMX merged 1 commit intomainfrom
jaosorior/skill-api-contract-changes

Conversation

@JAORMX
Copy link
Collaborator

@JAORMX JAORMX commented Feb 13, 2026

Summary

The skills endpoints (merged as 501 stubs in #3801) used verb-based routes
(POST /install, POST /uninstall) that don't follow REST conventions. This
PR fixes the API contract before the service implementation lands, so #3804
can rebase onto clean routes.

  • POST /skills/installPOST /skills/ — standard resource creation
  • POST /skills/uninstallDELETE /skills/{name} — idiomatic resource deletion via path param + ?scope= query param
  • Removed uninstallSkillRequest body type (no longer needed)
  • Added Enums(user, project) constraint to all three scope query params (list, info, uninstall) for machine-readable OpenAPI validation
  • Documented Location header on 201 install response
  • Added 400/404/409 failure codes to swagger annotations where appropriate
  • Added ValidateScope() function for scope validation at API boundaries
  • Added Scope field to InfoOptions so the info endpoint can accept scope filtering

Route comparison

Endpoint Before After
Install POST /api/v1beta/skills/install POST /api/v1beta/skills
Uninstall POST /api/v1beta/skills/uninstall (JSON body) DELETE /api/v1beta/skills/{name}?scope=
List GET /api/v1beta/skills unchanged (added ?scope= enum)
Info GET /api/v1beta/skills/{name} unchanged (added ?scope= enum + 404)

All handlers remain 501 stubs — zero service code is touched. #3804 will
rebase onto this and adapt its handlers to the new routes.

Why now?

Changing routes after the service implementation lands means rewriting handler
code, tests, and client assumptions simultaneously. Doing it while everything
is still a stub makes the change trivial and reviewable.

Refs: #3648, #3741

Test plan

  • task lint — 0 issues
  • task test — all passing
  • task docs — swagger regenerated with enum constraints
  • TestValidateScope — 8 cases: valid scopes, unknown values, case sensitivity, whitespace, trailing spaces, and error message content assertions

🤖 Generated with Claude Code

Change skill routes to use standard HTTP verbs on resources:
- POST /install -> POST / (resource creation)
- POST /uninstall -> DELETE /{name} (resource deletion with path param)

Add scope enum constraints to swagger query params, document
Location header on install, and add 400/404/409 failure codes.
Add ValidateScope() and Scope field to InfoOptions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the size/L Large PR: 600-999 lines changed label Feb 13, 2026
@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.87%. Comparing base (02496a2) to head (cbd190f).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/api/v1/skills.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3818      +/-   ##
==========================================
- Coverage   66.88%   66.87%   -0.01%     
==========================================
  Files         439      439              
  Lines       43437    43443       +6     
==========================================
+ Hits        29051    29053       +2     
- Misses      12134    12138       +4     
  Partials     2252     2252              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@aponcedeleonch aponcedeleonch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and aligned with the comments that Chris had. I'll leave it up to you to wait for Chris's review or go ahead and merge

@JAORMX JAORMX merged commit e5cf4f6 into main Feb 13, 2026
36 checks passed
@JAORMX JAORMX deleted the jaosorior/skill-api-contract-changes branch February 13, 2026 12:35
JAORMX added a commit that referenced this pull request Feb 13, 2026
Update skill handlers and tests to align with the RESTful routes
merged in #3818:
- Install: POST /skills with Location header
- Uninstall: DELETE /skills/{name}?scope= (path param + query param)
- Add ValidateScope calls to list, info, and uninstall handlers
- Update tests for new routes and validation
- Regenerate swagger docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR: 600-999 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants