Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
2ac1248
feat: add project skill queries and authorization
jaaydenh Oct 15, 2026
836c956
refactor(coderd/database): share chat project config authorization he…
jaaydenh Oct 15, 2026
7bc17ba
test(coderd/database): assert project skill reads stay scoped to thei…
jaaydenh Oct 15, 2026
1c9e8f1
feat: add project skill API routes
jaaydenh Oct 15, 2026
d623418
chore(coderd): clarify chat project skill limit comment
jaaydenh Oct 15, 2026
dda45bc
feat(coderd/x): load project skills in chats
jaaydenh Oct 15, 2026
27c808d
feat(site): list project skills in the chat slash menu
jaaydenh Oct 15, 2026
009432c
refactor(site/src/pages/AgentsPage): share stored skill source loadin…
jaaydenh Oct 15, 2026
a3a2f5d
refactor(site/src/pages/AgentsPage/components/ChatMessageInput): simp…
jaaydenh Oct 15, 2026
23a5168
refactor(site/src/pages/AgentsPage): name stored skill source flags a…
jaaydenh Oct 15, 2026
5533023
refactor(site/src/pages/AgentsPage/components): clarify skill source …
jaaydenh Oct 15, 2026
681b374
test: cover project skill loader and gating gaps
jaaydenh Oct 15, 2026
2a72a92
test(site/src/pages/AgentsPage/components): assert the project skills…
jaaydenh Oct 15, 2026
26deda5
fix(site/src/pages/AgentsPage): use the root chat's project for subag…
jaaydenh Oct 15, 2026
549a030
fix(site/src/pages/AgentsPage): keep inherited project skills pending…
jaaydenh Oct 15, 2026
7b6c3e3
test(site/src/pages/AgentsPage/components): restore Range geometry st…
jaaydenh Oct 15, 2026
a14b495
refactor(site/src/pages/AgentsPage): extract SkillEditorForm and shar…
jaaydenh Oct 15, 2026
3a6e22b
feat(site): add the project skills dialog
jaaydenh Oct 15, 2026
d8b9163
feat: manage project skills from the project page
jaaydenh Oct 15, 2026
e1a4429
fix(site/src/pages/AgentsPage/components): keep the edited skill name…
jaaydenh Oct 15, 2026
dd7a120
Merge branch 'chat-project-skills/skill-editor-form' into chat-projec…
jaaydenh Oct 15, 2026
43b64fc
fix(site/src/pages/AgentsPage/components/ProjectPage): keep skill edi…
jaaydenh Oct 15, 2026
ffc6165
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 15, 2026
fc6f82d
test(site/src/pages/AgentsPage/components/ProjectPage): move download…
jaaydenh Oct 15, 2026
f412310
test(site/src/pages/AgentsPage/components/ProjectPage): cover dialog …
jaaydenh Oct 15, 2026
85fcc37
refactor(site/src/pages/AgentsPage/components): drop a JSDoc that res…
jaaydenh Oct 15, 2026
ff7f8d8
fix(site/src/pages/AgentsPage/components/ProjectPage): drop stale ski…
jaaydenh Oct 15, 2026
91be0f4
Merge branch 'chat-project-skills/skill-editor-form' into chat-projec…
jaaydenh Oct 15, 2026
f3a7564
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 15, 2026
2890acf
fix(site/src/pages/AgentsPage/components/ProjectPage): surface skill …
jaaydenh Oct 15, 2026
0683472
test(site/src/pages/AgentsPage/components/ProjectPage): cover skill d…
jaaydenh Oct 15, 2026
553df7e
refactor(site/src/pages/AgentsPage/components): drop comments that re…
jaaydenh Oct 15, 2026
78f6a19
Merge branch 'chat-project-skills/skill-editor-form' into chat-projec…
jaaydenh Oct 15, 2026
316ad1e
fix(site/src/pages/AgentsPage/components/ProjectPage): cancel stale s…
jaaydenh Oct 15, 2026
492e634
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 15, 2026
fb91fda
test(site/src/pages/AgentsPage/components/ProjectPage): cover cancell…
jaaydenh Oct 15, 2026
bd2a6d9
fix(site/src/pages/AgentsPage/components/ProjectPage): wait for the s…
jaaydenh Oct 15, 2026
6c07758
fix(site/src/pages/AgentsPage/components/ProjectPage): keep New disab…
jaaydenh Oct 15, 2026
76bfc9d
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 15, 2026
8defe30
docs(site/src/api/queries): correct the project skill 409 comment
jaaydenh Oct 15, 2026
ecab89a
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 15, 2026
805a802
docs(site/src/pages/AgentsPage): document exported skill helpers
jaaydenh Oct 15, 2026
aa90018
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 15, 2026
0344df4
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 16, 2026
74b1f39
refactor(site/src/pages/AgentsPage): tighten the project skills dialog
jaaydenh Oct 16, 2026
827356c
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 16, 2026
540ea7b
refactor(site/src/pages/AgentsPage/components/ProjectPage): scope the…
jaaydenh Oct 16, 2026
6667893
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 16, 2026
14066aa
docs(site/src/pages/AgentsPage): document project skill cache and dia…
jaaydenh Oct 16, 2026
67e9170
test(site/src/pages/AgentsPage/components/ProjectPage): cover the ski…
jaaydenh Oct 16, 2026
062166f
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 16, 2026
4adbfba
test(site/src/pages/AgentsPage/components/ProjectPage): drop a render…
jaaydenh Oct 16, 2026
ecb0ede
test(site/src): tighten project skill test helpers and comments
jaaydenh Oct 16, 2026
dd721a6
test(site/src/pages/AgentsPage/components/ProjectPage): name local sk…
jaaydenh Oct 16, 2026
f6c25f5
fix(site/src/pages/AgentsPage/components/ProjectPage): wait for backg…
jaaydenh Oct 16, 2026
77dd873
test(site/src/pages/AgentsPage/components/ProjectPage): cover project…
jaaydenh Oct 16, 2026
d2c797c
feat(site/src/pages/AgentsPage/components/ProjectPage): show an edit …
jaaydenh Oct 16, 2026
e6af784
Merge remote-tracking branch 'origin/main' into HEAD
jaaydenh Oct 16, 2026
ebb0776
fix(coderd/database/migrations): renumber chat project skill audit mi…
jaaydenh Oct 16, 2026
2ea1fca
Merge branch 'chat-project-skills/queries' into chat-project-skills/api
jaaydenh Oct 16, 2026
f317b07
Merge branch 'chat-project-skills/api' into chat-project-skills/chatd
jaaydenh Oct 16, 2026
958d217
Merge branch 'chat-project-skills/chatd' into chat-project-skills/sub…
jaaydenh Oct 16, 2026
483db17
Merge branch 'chat-project-skills/subagent-project' into chat-project…
jaaydenh Oct 16, 2026
29b7356
Merge branch 'chat-project-skills/skill-editor-form' into chat-projec…
jaaydenh Oct 16, 2026
7e7aab2
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 16, 2026
f010477
chore(coderd): remove non-essential project skill comments
jaaydenh Oct 18, 2026
cbb4bf7
Merge remote-tracking branch 'origin/main' into rs-queries
jaaydenh Oct 18, 2026
1799827
fix(coderd/database/migrations): renumber chat project skill audit mi…
jaaydenh Oct 18, 2026
d1c3934
Merge branch 'rs-queries' into rs-api
jaaydenh Oct 18, 2026
a63de89
Merge branch 'rs-api' into rs-chatd
jaaydenh Oct 18, 2026
8e1aa52
feat: add project skill API routes
jaaydenh Oct 15, 2026
34c10cd
chore(coderd): clarify chat project skill limit comment
jaaydenh Oct 15, 2026
c20a345
Merge branch 'chat-project-skills/api' into chat-project-skills/chatd
jaaydenh Oct 18, 2026
ec1b625
Merge remote-tracking branch 'origin/main' into chat-project-skills/c…
jaaydenh Oct 18, 2026
c39c1e0
Merge branch 'chat-project-skills/chatd' into chat-project-skills/sub…
jaaydenh Oct 18, 2026
e848b00
Merge branch 'chat-project-skills/subagent-project' into chat-project…
jaaydenh Oct 18, 2026
9d3f01c
Merge branch 'chat-project-skills/skill-editor-form' into chat-projec…
jaaydenh Oct 18, 2026
ace1ded
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 18, 2026
52ba82d
Merge remote-tracking branch 'origin/main' into skills-chatd-fix
jaaydenh Oct 20, 2026
1c06855
chore: update architecture.md
jaaydenh Oct 20, 2026
0c938f1
fix: gate project skills on project usability and fail open in the co…
jaaydenh Oct 20, 2026
379ae2e
fix(site/src/pages/AgentsPage): keep loaded project skills after a fa…
jaaydenh Oct 20, 2026
ee7773e
Merge remote-tracking branch 'origin/chat-project-skills/chatd' into …
jaaydenh Oct 20, 2026
8288725
docs(site/src/pages/AgentsPage/components/ChatMessageInput): clarify …
jaaydenh Oct 20, 2026
894beaf
fix(site/src): count only lost project access as no project skills
jaaydenh Oct 20, 2026
019f52f
fix(site/src): let lost project access override cached project skills
jaaydenh Oct 20, 2026
2964653
test(site/src/pages/AgentsPage/components/ChatMessageInput): cover lo…
jaaydenh Oct 20, 2026
b0a3bbc
revert(site/src/pages/AgentsPage): drop the root-chat project fallbac…
jaaydenh Oct 20, 2026
b1e7cf2
Merge remote-tracking branch 'origin/chat-project-skills/chatd' into …
jaaydenh Oct 20, 2026
9bb55f3
Merge remote-tracking branch 'origin/chat-project-skills/skill-editor…
jaaydenh Oct 20, 2026
147becf
Merge branch 'skills-dialog-resync' into skills-details-resync
jaaydenh Oct 20, 2026
e25ca2e
fix(site/src/pages/AgentsPage/components/ProjectPage): take skill edi…
jaaydenh Oct 20, 2026
c505116
test(site/src/pages/AgentsPage/components/ProjectPage): assert a shar…
jaaydenh Oct 20, 2026
89a2e9a
fix(site/src): hide project skills the caller's chats cannot use
jaaydenh Oct 20, 2026
7ad1778
test(site/src/pages/AgentsPage/components/ProjectPage): name the proj…
jaaydenh Oct 20, 2026
9231e4e
fix(site/src/api/queries): treat a cached project list as unknown unt…
jaaydenh Oct 20, 2026
7c88cf1
test(site/src/pages/AgentsPage/components/ProjectPage): seed project …
jaaydenh Oct 20, 2026
6349cb1
test(site/src/pages/AgentsPage/components/ProjectPage): cover a faile…
jaaydenh Oct 20, 2026
5f55038
test(site/src/pages/AgentsPage/components/ProjectPage): wait for the …
jaaydenh Oct 20, 2026
98ad675
test(site/src/pages/AgentsPage/components/ProjectPage): type the refe…
jaaydenh Oct 20, 2026
8383b23
test(site/src/pages/AgentsPage/components/ProjectPage): refetch the s…
jaaydenh Oct 20, 2026
cfb1716
test(site/src/pages/AgentsPage/components/ProjectPage): capture the f…
jaaydenh Oct 20, 2026
17ba94d
Merge remote-tracking branch 'origin/main' into wyav/sk-chatd
jaaydenh Oct 20, 2026
b79ed20
Merge branch 'wyav/sk-chatd' into wyav/sk-skill-editor-form
jaaydenh Oct 20, 2026
0384e1b
Merge branch 'wyav/sk-skill-editor-form' into wyav/sk-project-skills-…
jaaydenh Oct 20, 2026
fede53b
Merge branch 'wyav/sk-project-skills-dialog' into wyav/sk-project-ski…
jaaydenh Oct 20, 2026
90de6c8
refactor(coderd/x/chatd): remove the unused resolveProjectInstructions
jaaydenh Oct 21, 2026
e9117ba
chore: update architecture.md
jaaydenh Oct 21, 2026
f83fb91
Merge branch 'chat-project-skills/chatd' of https://github.com/coder/…
jaaydenh Oct 21, 2026
e9a4adf
fix(site/src/pages/AgentsPage/components/ChatMessageInput): drop the …
jaaydenh Oct 21, 2026
fe2c0b3
Merge commit 'e9a4adf7c68e6bf80c9633591e8a99345b3f1dbf' into resync-s…
jaaydenh Oct 21, 2026
9d80261
Merge commit '3216580614^' into resync-skill-editor-form
jaaydenh Oct 21, 2026
793e989
Merge commit '3216580614' into resync-skill-editor-form
jaaydenh Oct 21, 2026
e5f1e0a
Merge commit '793e989a07d92b87e39aa15f5f0f9c853a9d317c' into pr-30855…
jaaydenh Oct 21, 2026
78f232d
Merge commit 'c1d4907f6c^' into project-skills-dialog
jaaydenh Oct 21, 2026
d581a38
Merge commit 'c1d4907f6c' into project-skills-dialog
jaaydenh Oct 21, 2026
4dbd39e
Merge commit 'd581a3864e' into details-resync-30856
jaaydenh Oct 21, 2026
e7220ac
Merge remote-tracking branch 'origin/main' into details-resync-30856
jaaydenh Oct 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/ai-coder/agents/extending-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ Project skills use the same single-file `SKILL.md` format and the same 64 K
Each project can have up to 100 skills, and skills that are turned off count toward that limit.

Anyone who can edit a project can add, change, turn on or off, and delete its skills.
To manage them, open the project page and select the **Skills** row in the **Details** panel.
A chat in the project can use the project's skills while the chat owner owns the project or the project is shared with them, the same rule as for project instructions and memory.
An administrator role that can view every project does not count.
A sub-agent chat uses the skills of the project its top-level chat belongs to.
Expand All @@ -272,7 +273,7 @@ For site owners, organization admins, and auditors, the group lists every organi

### Turn a skill on or off

Personal and organization skills each have an **Enabled** column in their skills table.
Personal, organization, and project skills each have an **Enabled** column in their skills table.
If you can edit the skill, the column shows a switch that turns the skill on or off.
Otherwise, the column shows a check mark for a skill that is turned on and an X for a skill that is turned off.
For example, auditors on the **Skills** admin page and everyone in the **From your organizations** section see these icons instead of a switch.
Expand Down
8 changes: 5 additions & 3 deletions site/src/api/queries/chatProjectSkills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { API } from "#/api/api";
import type * as TypesGen from "#/api/typesGenerated";

/**
* The key holds only the project ID, so it matches chatProjectSkills() for
* any organization ID.
* Keys a project's skill list. It holds only the project ID, so it matches
* chatProjectSkills() for any organization ID. It prefixes each skill's
* detail key, so invalidating it without `exact` also hits the details.
*/
export const chatProjectSkillsKey = (projectId: string) =>
["chat-project-skills", projectId] as const;

const chatProjectSkillKey = (projectId: string, name: string) =>
/** Keys one project skill, under its project's list key. */
export const chatProjectSkillKey = (projectId: string, name: string) =>
[...chatProjectSkillsKey(projectId), name] as const;

/** Lists the skills of a chat project, including disabled ones. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ import {
MockChatProject,
MockChatProjectInstructions,
MockUnsetChatProjectInstructions,
MockUserMember,
mockApiError,
} from "#/testHelpers/entities";
import { createTestQueryClient } from "#/testHelpers/renderHelpers";
import { MockDisabledSkill, MockSkills } from "#/testHelpers/skills";
import themes, { DEFAULT_THEME } from "#/theme";
import { ProjectDetailsPanel } from "./ProjectDetailsPanel";

Expand Down Expand Up @@ -75,7 +77,7 @@ const confirmDelete = async (user: ReturnType<typeof userEvent.setup>) => {
);
};

const renderPanel = () => {
const renderPanel = (initialProject: ChatProject = MockChatProject) => {
const queryClient = createTestQueryClient();
const panel = (project: ChatProject) => (
<ThemeOverride theme={themes[DEFAULT_THEME]}>
Expand All @@ -86,7 +88,7 @@ const renderPanel = () => {
</QueryClientProvider>
</ThemeOverride>
);
const { rerender } = render(panel(MockChatProject));
const { rerender } = render(panel(initialProject));
return {
user: userEvent.setup(),
queryClient,
Expand Down Expand Up @@ -470,4 +472,87 @@ describe("ProjectDetailsPanel", () => {
await waitFor(() => expect(getInstructions).toHaveBeenCalledTimes(2));
await screen.findByRole("button", { name: "Edit instructions" });
});

it("opens the project skills from the Skills row", async () => {
mockInstructions(MockChatProjectInstructions);
vi.spyOn(API.experimental, "getChatProjectSkills").mockResolvedValue([
MockSkills[0],
MockDisabledSkill,
]);
const getSkill = vi
.spyOn(API.experimental, "getChatProjectSkill")
.mockResolvedValue({
...MockSkills[0],
content: "---\nname: reviewer\n---\nReview the diff.\n",
});
const { user } = renderPanel();

await user.click(
await screen.findByRole("button", {
name: "Skills: 2 skills, 1 disabled",
}),
);
await user.click(
await screen.findByRole("button", { name: "Open menu for reviewer" }),
);
await user.click(await screen.findByRole("menuitem", { name: "Edit" }));

await waitFor(() =>
expect(getSkill).toHaveBeenCalledWith(
MockChatProject.organization_id,
MockChatProject.id,
"reviewer",
),
);
});

it("lets a non-owner turn a skill off when the project permits update", async () => {
mockInstructions(MockChatProjectInstructions);
vi.spyOn(API, "getUser").mockResolvedValue(MockUserMember);
vi.spyOn(API.experimental, "getChatProjectSkills").mockResolvedValue([
MockSkills[0],
]);
const updateSkill = vi
.spyOn(API.experimental, "updateChatProjectSkill")
.mockResolvedValue({ ...MockSkills[0], content: "", enabled: false });
// An admin-role sharee gets update only through the project's ACL,
// which /authcheck cannot see but project.permissions reflects.
const { user } = renderPanel({
...MockChatProject,
owner_id: MockUserMember.id,
permissions: { update: true, delete: false, share: true },
});

await user.click(
await screen.findByRole("button", { name: "Skills: 1 skill" }),
);
await user.click(
await screen.findByRole("switch", {
name: `Enable ${MockSkills[0].name}`,
}),
);

await waitFor(() =>
expect(updateSkill).toHaveBeenCalledWith(
MockChatProject.organization_id,
MockChatProject.id,
MockSkills[0].name,
{ enabled: false },
),
);
});

it("returns focus to the Skills row when the skills dialog closes", async () => {
mockInstructions(MockChatProjectInstructions);
vi.spyOn(API.experimental, "getChatProjectSkills").mockResolvedValue([]);
const { user } = renderPanel();
const skillsButton = await screen.findByRole("button", {
name: "Skills: None",
});

await user.click(skillsButton);
await user.click(await screen.findByRole("button", { name: "Close" }));

await waitFor(() => expect(skillsButton).toHaveFocus());
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useRef, useState } from "react";
import { useMutation, useQuery, useQueryClient } from "react-query";
import { chatProjectSkills } from "#/api/queries/chatProjectSkills";
import {
chatProjectInstructions,
deleteChatProjectInstructions,
Expand All @@ -9,14 +10,16 @@ import { user } from "#/api/queries/users";
import type { ChatProject } from "#/api/typesGenerated";
import { useAuthenticated } from "#/hooks/useAuthenticated";
import { useDashboard } from "#/modules/dashboard/useDashboard";
import { useDialogFocusReturn } from "../useDialogFocusReturn";
import { ProjectDetailsPanelView } from "./ProjectDetailsPanelView";
import { ProjectInstructionsDialog } from "./ProjectInstructionsDialog";
import { ProjectSkillsDialog } from "./ProjectSkillsDialog";

type ProjectDetailsPanelProps = {
readonly project: ChatProject;
};

/** Loads a project's details and edits its instructions. */
/** Loads a project's details and edits its instructions and skills. */
export const ProjectDetailsPanel: React.FC<ProjectDetailsPanelProps> = ({
project,
}) => (
Expand Down Expand Up @@ -50,6 +53,11 @@ const ProjectDetailsPanelContent: React.FC<ProjectDetailsPanelProps> = ({
: "Unknown"
: undefined;
const instructionsQuery = useQuery(chatProjectInstructions(project));
const skillsQuery = useQuery(
chatProjectSkills(project.organization_id, project.id),
);
const [isSkillsDialogOpen, setIsSkillsDialogOpen] = useState(false);
const skillsFocusReturn = useDialogFocusReturn();
const updateMutation = useMutation(
updateChatProjectInstructions(queryClient, project),
);
Expand Down Expand Up @@ -89,6 +97,15 @@ const ProjectDetailsPanelContent: React.FC<ProjectDetailsPanelProps> = ({
ownerLabel={ownerLabel}
createdAt={project.created_at}
organizationLabel={organizationLabel}
skillCount={skillsQuery.data?.length}
disabledSkillCount={
skillsQuery.data?.filter((skill) => !skill.enabled).length
}
skillsError={skillsQuery.error}
onOpenSkills={(event) => {
skillsFocusReturn.rememberTrigger(event);
setIsSkillsDialogOpen(true);
}}
instructions={instructionsQuery.data}
error={instructionsQuery.error}
onRetry={() => void instructionsQuery.refetch()}
Expand Down Expand Up @@ -129,6 +146,13 @@ const ProjectDetailsPanelContent: React.FC<ProjectDetailsPanelProps> = ({
)
}
/>
<ProjectSkillsDialog
project={project}
open={isSkillsDialogOpen}
onOpenChange={setIsSkillsDialogOpen}
canEdit={project.permissions.update}
onCloseAutoFocus={skillsFocusReturn.restoreFocus}
/>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ const meta: Meta<typeof ProjectDetailsPanelView> = {
args: {
ownerLabel: "You",
createdAt: MockChatProject.created_at,
skillCount: 3,
disabledSkillCount: 0,
skillsError: undefined,
onOpenSkills: fn(),
instructions: MockChatProjectInstructions,
error: undefined,
onRetry: fn(),
Expand Down Expand Up @@ -98,6 +102,27 @@ export const CreatedDateFocused: Story = {
},
};

/** Focus returns to the Skills row after the skills dialog closes. */
export const SkillsFocused: Story = {
play: async ({ canvasElement }) => {
within(canvasElement)
.getByRole("button", { name: /^Skills:/ })
.focus();
},
};

export const OneSkill: Story = {
Comment thread
jaaydenh marked this conversation as resolved.
Resolved
args: { skillCount: 1 },
};

export const SomeSkillsDisabled: Story = {
args: { disabledSkillCount: 1 },
};

export const NoSkills: Story = {
args: { skillCount: 0 },
};

export const Unset: Story = {
args: { instructions: MockUnsetChatProjectInstructions },
};
Expand All @@ -117,12 +142,14 @@ export const LongInstructions: Story = {
};

export const Loading: Story = {
args: { instructions: undefined },
args: { instructions: undefined, skillCount: undefined },
};

export const LoadError: Story = {
args: {
instructions: undefined,
skillCount: undefined,
skillsError: mockApiError({ message: "Failed to list project skills." }),
error: mockApiError({
message: "Failed to get chat project instructions.",
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ type ProjectDetailsPanelViewProps = {
readonly createdAt: string;
/** Omit to hide the organization row. */
readonly organizationLabel?: string;
/** `undefined` while the skills load or after loading fails. */
readonly skillCount: number | undefined;
/** `undefined` while the skills load or after loading fails. */
readonly disabledSkillCount: number | undefined;
readonly skillsError: unknown;
readonly onOpenSkills: (event: React.MouseEvent<HTMLButtonElement>) => void;
/** `undefined` until the instructions load. */
readonly instructions: ChatProjectInstructions | undefined;
readonly error: unknown;
Expand All @@ -33,6 +39,10 @@ export const ProjectDetailsPanelView: React.FC<
ownerLabel,
createdAt,
organizationLabel,
skillCount,
disabledSkillCount,
skillsError,
onOpenSkills,
instructions,
error,
onRetry,
Expand All @@ -50,6 +60,17 @@ export const ProjectDetailsPanelView: React.FC<
}
/>
);
let skillsLabel =
skillCount === undefined
? "Unknown"
: skillCount === 0
? "None"
: skillCount === 1
? "1 skill"
: `${skillCount} skills`;
if (skillCount && disabledSkillCount) {
skillsLabel += `, ${disabledSkillCount} disabled`;
}

return (
<section aria-labelledby={headingId} className="flex flex-col gap-3">
Expand Down Expand Up @@ -88,6 +109,24 @@ export const ProjectDetailsPanelView: React.FC<
{organizationLabel !== undefined && (
<DetailRow label="Organization">{organizationLabel}</DetailRow>
)}
<DetailRow label="Skills">
{skillCount === undefined && !skillsError ? (
Comment thread
jaaydenh marked this conversation as resolved.
Resolved
<>
<Skeleton className="my-1 ml-auto h-3 w-12" />
<span className="sr-only">Loading</span>
</>
) : (
<button
type="button"
aria-label={`Skills: ${skillsLabel}`}
className="group inline-flex items-center gap-1.5 rounded-sm hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-content-link"
onClick={onOpenSkills}
>
{skillsLabel}
<PenIcon className="size-3.5 shrink-0 text-content-secondary group-hover:text-content-primary" />
</button>
)}
</DetailRow>
</dl>
<section
aria-labelledby={instructionsHeadingId}
Expand Down
Loading
Loading