feat: add skill action and automatic-use settings (#30882)

Adds two per-skill settings that the project skills UI will expose next:

- `action` marks a project skill to show as an action button above
project chat composers. A `skills_action_project_only` check keeps it to
project skills; the personal and organization routes reject `action`
with 400.
- `model_invocable` (default true, every stored source) controls
automatic use. When it's false the skill is left out of
`<available-skills>` and `read_skill` reports it as not found, but a
structured skill invocation (a chip from the `/` menu or an action)
still loads it, as long as the skill is enabled and the chat owner can
read it. Workspace skills always count as model-invocable.

Migration 000625 adds both columns with defaults, so existing skills
keep today's behavior. The list, get, insert and update queries,
`codersdk.SkillMetadata` and the create/update requests carry both
fields, and the audit table tracks them.
`coderd/x/chatd/ARCHITECTURE.md` gets TODO notes for the author.

**NOTE**: the migration adds two columns with constant defaults and a
CHECK constraint to `skills`.

Stack (merge top to bottom):
- #30826
- #30827
- #30838
- #30840
- #30854
- #30855
- #30856
- #30861
- #30880
- #30881
- #30882 👈
- #30884
- #31122
- #31126

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Nick Vigilante <nickvigilante@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-10-23 19:32:08 +07:00
1 parent face989d73
commit c4d76a4009
36 files changed
+666 -245

No files matched your search

+3
View File
@@ -3310,7 +3310,10 @@ CREATE TABLE skills (
enabled boolean DEFAULT true NOT NULL,
group_acl jsonb DEFAULT '{}'::jsonb NOT NULL,
user_acl jsonb DEFAULT '{}'::jsonb NOT NULL,
action boolean DEFAULT false NOT NULL,
model_invocable boolean DEFAULT true NOT NULL,
CONSTRAINT skills_acl_only_on_organization_skills CHECK (((organization_id IS NOT NULL) OR ((group_acl = '{}'::jsonb) AND (user_acl = '{}'::jsonb)))),
CONSTRAINT skills_action_project_only CHECK (((NOT action) OR (project_id IS NOT NULL))),
CONSTRAINT skills_content_size CHECK ((octet_length(content) <= 65536)),
CONSTRAINT skills_description_size CHECK ((octet_length(description) <= 4096)),
CONSTRAINT skills_group_acl_is_object CHECK ((jsonb_typeof(group_acl) = 'object'::text)),