539a8bcec83cf820a506a0070322d4d5541365a5
Only delete had a DB owner check via _assert_agent_may_delete. The other four write actions only called ensure_custom_skill_is_editable, which just verifies the directory exists under skills/custom/ — it does not check owner_user_id. Any agent that knew a skill's name could overwrite or strip support files from another user's UI-uploaded skill. Generalise the helper to _assert_agent_may_modify (same three rules: no DB row / built-in owner=None / owner mismatch) and call it from edit, patch, delete, write_file, and remove_file. Hoist user_id + skill_store to the top of the lock block so the four newly-guarded branches stay one-liners and create/delete reuse the same handles. Behaviour preserved when skill_store is None (no DB) — matches the existing delete fallback. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Languages
Python
39.2%
TypeScript
35.9%
HTML
22.2%
CSS
1.5%
JavaScript
0.9%
Other
0.2%