Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(skills): add a search box to the skills panel (#21961)

Lobehub Coder0d264832cdfa
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index 7863b87178a..402419ff7cb 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -3656,10 +3656,12 @@
"workingPanel.skills.delete.userConfirm": "Uninstall the skill “{{name}}”? This cannot be undone.",
"workingPanel.skills.detail.title": "Skill details",
"workingPanel.skills.empty": "No skills available",
+ "workingPanel.skills.noSearchResults": "No matching skills",
"workingPanel.skills.rename.action": "Rename",
"workingPanel.skills.rename.error": "Failed to rename skill",
"workingPanel.skills.rename.placeholder": "Skill name",
"workingPanel.skills.rename.title": "Rename skill",
+ "workingPanel.skills.searchPlaceholder": "Filter skills...",
"workingPanel.skills.section.agent": "Agent skills",
"workingPanel.skills.section.device": "Device skills",
"workingPanel.skills.section.project": "Project skills",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 8e1a003f516..55da3d86b8a 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -3656,10 +3656,12 @@
"workingPanel.skills.delete.userConfirm": "确定卸载技能「{{name}}」?此操作不可撤销。",
"workingPanel.skills.detail.title": "技能详情",
"workingPanel.skills.empty": "暂无可用技能",
+ "workingPanel.skills.noSearchResults": "没有匹配的技能",
"workingPanel.skills.rename.action": "重命名",
"workingPanel.skills.rename.error": "重命名技能失败",
"workingPanel.skills.rename.placeholder": "技能名称",
"workingPanel.skills.rename.title": "重命名技能",
+ "workingPanel.skills.searchPlaceholder": "筛选技能...",
"workingPanel.skills.section.agent": "智能体技能",
"workingPanel.skills.section.device": "设备技能",
"workingPanel.skills.section.project": "项目技能",
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index dba632e97f8..60bdb88ac01 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -3842,10 +3842,12 @@ export default {
'Uninstall the skill “{{name}}”? This cannot be undone.',
'workingPanel.skills.detail.title': 'Skill details',
'workingPanel.skills.empty': 'No skills available',
+ 'workingPanel.skills.noSearchResults': 'No matching skills',
'workingPanel.skills.rename.action': 'Rename',
'workingPanel.skills.rename.error': 'Failed to rename skill',
'workingPanel.skills.rename.placeholder': 'Skill name',
'workingPanel.skills.rename.title': 'Rename skill',
+ 'workingPanel.skills.searchPlaceholder': 'Filter skills...',
'workingPanel.skills.section.agent': 'Agent skills',
'workingPanel.skills.section.device': 'Device skills',
'workingPanel.skills.section.project': 'Project skills',
diff --git a/src/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.test.tsx b/src/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.test.tsx
index 656a223009e..146c5ad8a45 100644
--- a/src/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.test.tsx
+++ b/src/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.test.tsx
@@ -4,7 +4,7 @@ import {
AGENT_DOCUMENT_SKILL_CATEGORY,
AGENT_SIGNAL_SOURCE_TYPE,
} from '@lobechat/const';
-import { fireEvent, render, screen } from '@testing-library/react';
+import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import type { ReactNode } from 'react';
import type * as ReactRouterDom from 'react-router';
import { beforeEach, describe, expect, it, vi } from 'vitest';
@@ -106,7 +106,9 @@ vi.mock('@/features/Workspace/useWorkspaceAwareNavigate', () => ({
useWorkspaceAwareNavigate: () => navigateMock,
}));
-vi.mock('@/features/SkillsList', () => {
+vi.mock('@/features/SkillsList', async () => {
+ const { filterSkillItems } = await import('@/features/SkillsList/filterSkillItems');
+ const { default: SkillsSearchBar } = await import('@/features/SkillsList/SkillsSearchBar');
type Item = { fileCount?: number; id: string; name: string };
const SkillsList = ({
items,
@@ -158,7 +160,7 @@ vi.mock('@/features/SkillsList', () => {
</div>
);
const useProjectSkills = (...args: unknown[]) => useProjectSkillsMock(...args);
- return { SkillSection, SkillsList, useProjectSkills };
+ return { filterSkillItems, SkillSection, SkillsList, SkillsSearchBar, useProjectSkills };
});
// UserLevelSkills owns its own store wiring and is exercised separately. We
@@ -650,6 +652,70 @@ describe('AgentDocumentsGroup', () => {
expect(screen.queryByTestId('skills-list')).not.toBeInTheDocument();
});
+ describe('skill search', () => {
+ const search = (value: string) =>
+ fireEvent.change(screen.getByLabelText('workingPanel.skills.searchPlaceholder'), {
+ target: { value },
+ });
+
+ beforeEach(() => {
+ documentListMock.mockReturnValue({
+ data: [skillBundleRow, skillIndexRow],
+ error: undefined,
+ isLoading: false,
+ mutate: vi.fn(),
+ });
+ });
+
+ it('filters skills and shows a no-match state while keeping the input', async () => {
+ render(<AgentDocumentsGroup />);
+ expect(screen.getByText('YouTube Comment Retrieval Workflow')).toBeInTheDocument();
+
+ search('no-such-skill');
+ await waitFor(() =>
+ expect(screen.getByText('workingPanel.skills.noSearchResults')).toBeInTheDocument(),
+ );
+ expect(screen.queryByText('YouTube Comment Retrieval Workflow')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('workingPanel.skills.searchPlaceholder')).toHaveValue(
+ 'no-such-skill',
+ );
+
+ search('youtube');
+ await waitFor(() =>
+ expect(screen.getByText('YouTube Comment Retrieval Workflow')).toBeInTheDocument(),
+ );
+ });
+
+ it('does not keep filtering after the search bar unmounts with the Skills tab', async () => {
+ render(<AgentDocumentsGroup />);
+
+ search('no-such-skill');
+ await waitFor(() =>
+ expect(screen.getByText('workingPanel.skills.noSearchResults')).toBeInTheDocument(),
+ );
+
+ fireEvent.click(screen.getByRole('tab', { name: 'Documents' }));
+ fireEvent.click(screen.getByRole('tab', { name: 'Skills' }));
+
+ expect(screen.getByLabelText('workingPanel.skills.searchPlaceholder')).toHaveValue('');
+ expect(screen.getByText('YouTube Comment Retrieval Workflow')).toBeInTheDocument();
+ });
+
+ it('hides the search bar when there are no skills at all', () => {
+ documentListMock.mockReturnValue({
+ data: [fileDocRow],
+ error: undefined,
+ isLoading: false,
+ mutate: vi.fn(),
+ });
+ render(<AgentDocumentsGroup />);
+
+ expect(
+ screen.queryByLabelText('workingPanel.skills.searchPlaceholder'),
+ ).not.toBeInTheDocument();
+ });
+ });
+
it('shows the web empty state when no web items are present', () => {
documentListMock.mockReturnValue({
data: [fileDocRow],
diff --git a/src/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.tsx b/src/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.tsx
index 21270d72d37..8d850a6c300 100644
--- a/src/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.tsx
+++ b/src/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.tsx
@@ -35,11 +35,13 @@ import {
} from '@/features/AgentDocumentsExplorer';
import { startSkillDrag } from '@/features/ChatInput/InputEditor/ActionTag/skillDragData';
import {
+ filterSkillItems,
openRenameSkillModal,
type SkillListItem,
type SkillRowAction,
SkillSection,
SkillsList,
+ SkillsSearchBar,
useProjectSkills,
} from '@/features/SkillsList';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
@@ -333,6 +335,7 @@ const AgentDocumentsGroup = memo<AgentDocumentsGroupProps>(
const [filter, setFilter] = useState<ResourceFilter>(() =>
isDocumentMode ? 'documents' : 'skills',
);
+ const [skillSearchQuery, setSkillSearchQuery] = useState('');
const activeDocumentIdentifier = docId ? standardizeIdentifier(docId) : undefined;
const filterOptions = isDocumentMode ? DOCUMENT_MODE_FILTER_OPTIONS : FILTER_OPTIONS;
const resolvedFilter = controlledFilter ?? filter;
@@ -403,6 +406,11 @@ const AgentDocumentsGroup = memo<AgentDocumentsGroupProps>(
[skillBundleViews],
);
+ const matchedSkillItems = useMemo(
+ () => filterSkillItems(skillItems, skillSearchQuery),
+ [skillItems, skillSearchQuery],
+ );
+
const openAgentDocument = useCallback(
(documentId: string, agentDocumentId?: string) => {
if (!agentId) return;
@@ -573,7 +581,7 @@ const AgentDocumentsGroup = memo<AgentDocumentsGroupProps>(
const renderAgentSkillsList = () => (
<SkillsList
getRowActions={getAgentSkillActions}
- items={skillItems}
+ items={matchedSkillItems}
onOpenFile={openAgentSkillFile}
onOpenSkill={openAgentSkill}
onSkillDragStart={handleAgentSkillDragStart}
@@ -619,38 +627,54 @@ const AgentDocumentsGroup = memo<AgentDocumentsGroupProps>(
);
}
+ // `flat` keys off the unfiltered sources so typing doesn't make headers jump.
const flat = activeCount === 1;
+ const hasMatchedAgent = matchedSkillItems.length > 0;
+ const hasMatchedProject =
+ hasProject && filterSkillItems(projectSkillItems, skillSearchQuery).length > 0;
+ const hasMatchedDevice =
+ hasDevice && filterSkillItems(deviceSkillItems, skillSearchQuery).length > 0;
+ const hasMatchedUser = filterSkillItems(userSkillItems, skillSearchQuery).length > 0;
+ const hasMatch = hasMatchedAgent || hasMatchedProject || hasMatchedDevice || hasMatchedUser;
return (
<Flexbox gap={16} style={{ paddingBottom: 16 }}>
- {hasAgent &&
+ <SkillsSearchBar onSearch={setSkillSearchQuery} />
+ {!hasMatch && (
+ <Center flex={1} gap={8} paddingBlock={24}>
+ <Empty description={t('workingPanel.skills.noSearchResults')} icon={SkillsIcon} />
+ </Center>
+ )}
+ {hasMatchedAgent &&
(flat ? (
renderAgentSkillsList()
) : (
<SkillSection
sectionHeader={{
- count: skillItems.length,
+ count: matchedSkillItems.length,
title: t('workingPanel.skills.section.agent'),
}}
>
{renderAgentSkillsList()}
</SkillSection>
))}
- {hasProject && (
+ {hasMatchedProject && (
<ProjectLevelSkills
deviceId={deviceId}
hideHeader={flat}
+ searchQuery={skillSearchQuery}
workingDirectory={workingDirectory!}
/>
)}
- {hasDevice && (
+ {hasMatchedDevice && (
<DeviceLevelSkills
deviceId={deviceId}
hideHeader={flat}
+ searchQuery={skillSearchQuery}
workingDirectory={workingDirectory!}
/>
)}
- {hasUser && <UserLevelSkills hideHeader={flat} />}
+ {hasMatchedUser && <UserLevelSkills hideHeader={flat} searchQuery={skillSearchQuery} />}
</Flexbox>
);
};
diff --git a/src/features/Conversation/WorkingSidebar/ResourcesSection/DeviceLevelSkills.tsx b/src/features/Conversation/WorkingSidebar/ResourcesSection/DeviceLevelSkills.tsx
index cade7901899..eefb093589c 100644
--- a/src/features/Conversation/WorkingSidebar/ResourcesSection/DeviceLevelSkills.tsx
+++ b/src/features/Conversation/WorkingSidebar/ResourcesSection/DeviceLevelSkills.tsx
@@ -1,9 +1,10 @@
import type React from 'react';
-import { memo } from 'react';
+import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { startSkillDrag } from '@/features/ChatInput/InputEditor/ActionTag/skillDragData';
import {
+ filterSkillItems,
type SkillListItem,
SkillSection,
SkillsList,
@@ -26,17 +27,24 @@ interface DeviceLevelSkillsProps {
* collapsed to a single visible source and wants the list rendered flat.
*/
hideHeader?: boolean;
+ /** Only render skills matching this query. */
+ searchQuery?: string;
workingDirectory: string;
}
const DeviceLevelSkills = memo<DeviceLevelSkillsProps>(
- ({ deviceId, hideHeader, workingDirectory }) => {
+ ({ deviceId, hideHeader, searchQuery = '', workingDirectory }) => {
const { t } = useTranslation('chat');
const { deviceItems, error, getRowActions, mutate, onOpenFile, onOpenSkill } = useProjectSkills(
workingDirectory,
deviceId,
);
+ const items = useMemo(
+ () => filterSkillItems(deviceItems, searchQuery),
+ [deviceItems, searchQuery],
+ );
+
if (deviceItems.length === 0) {
if (!error) return null;
if (hideHeader) return <SkillSection isEmpty error={error} onRetry={mutate} />;
@@ -50,10 +58,12 @@ const DeviceLevelSkills = memo<DeviceLevelSkillsProps>(
);
}
+ if (items.length === 0) return null;
+
const list = (
<SkillsList
getRowActions={getRowActions}
- items={deviceItems}
+ items={items}
onOpenFile={onOpenFile}
onOpenSkill={onOpenSkill}
onSkillDragStart={handleSkillDragStart}
@@ -65,7 +75,7 @@ const DeviceLevelSkills = memo<DeviceLevelSkillsProps>(
return (
<SkillSection
sectionHeader={{
- count: deviceItems.length,
+ count: items.length,
title: t('workingPanel.skills.section.device'),
}}
>
diff --git a/src/features/Conversation/WorkingSidebar/ResourcesSection/ProjectLevelSkills.tsx b/src/features/Conversation/WorkingSidebar/ResourcesSection/ProjectLevelSkills.tsx
index bf4c215eb4e..f5a5b8f478c 100644
--- a/src/features/Conversation/WorkingSidebar/ResourcesSection/ProjectLevelSkills.tsx
+++ b/src/features/Conversation/WorkingSidebar/ResourcesSection/ProjectLevelSkills.tsx
@@ -1,9 +1,10 @@
import type React from 'react';
-import { memo } from 'react';
+import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { startSkillDrag } from '@/features/ChatInput/InputEditor/ActionTag/skillDragData';
import {
+ filterSkillItems,
type SkillListItem,
SkillSection,
SkillsList,
@@ -28,15 +29,22 @@ interface ProjectLevelSkillsProps {
* collapsed to a single visible source and wants the list rendered flat.
*/
hideHeader?: boolean;
+ /** Only render skills matching this query. */
+ searchQuery?: string;
workingDirectory: string;
}
const ProjectLevelSkills = memo<ProjectLevelSkillsProps>(
- ({ deviceId, hideHeader, workingDirectory }) => {
+ ({ deviceId, hideHeader, searchQuery = '', workingDirectory }) => {
const { t } = useTranslation('chat');
const { error, getRowActions, mutate, onOpenFile, onOpenSkill, projectItems } =
useProjectSkills(workingDirectory, deviceId);
+ const items = useMemo(
+ () => filterSkillItems(projectItems, searchQuery),
+ [projectItems, searchQuery],
+ );
+
// A failed scan must surface an error + Retry, not silently vanish (ux Read
// §1.1). Only genuinely-empty (no error) keeps the "hide the section" behavior.
if (projectItems.length === 0) {
@@ -52,10 +60,12 @@ const ProjectLevelSkills = memo<ProjectLevelSkillsProps>(
);
}
+ if (items.length === 0) return null;
+
const list = (
<SkillsList
getRowActions={getRowActions}
- items={projectItems}
+ items={items}
onOpenFile={onOpenFile}
onOpenSkill={onOpenSkill}
onSkillDragStart={handleSkillDragStart}
@@ -67,7 +77,7 @@ const ProjectLevelSkills = memo<ProjectLevelSkillsProps>(
return (
<SkillSection
sectionHeader={{
- count: projectItems.length,
+ count: items.length,
title: t('workingPanel.skills.section.project'),
}}
>
diff --git a/src/features/Conversation/WorkingSidebar/ResourcesSection/SkillsGroup.tsx b/src/features/Conversation/WorkingSidebar/ResourcesSection/SkillsGroup.tsx
index c6c0f0431bb..22bea3b1870 100644
--- a/src/features/Conversation/WorkingSidebar/ResourcesSection/SkillsGroup.tsx
+++ b/src/features/Conversation/WorkingSidebar/ResourcesSection/SkillsGroup.tsx
@@ -1,13 +1,15 @@
import { isDesktop } from '@lobechat/const';
import type React from 'react';
-import { memo } from 'react';
+import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { startSkillDrag } from '@/features/ChatInput/InputEditor/ActionTag/skillDragData';
import {
+ filterSkillItems,
type SkillListItem,
SkillSection,
SkillsList,
+ SkillsSearchBar,
useProjectSkills,
} from '@/features/SkillsList';
@@ -29,6 +31,7 @@ interface SkillsGroupProps {
const SkillsGroup = memo<SkillsGroupProps>(({ deviceId, workingDirectory }) => {
const { t } = useTranslation('chat');
+ const [searchQuery, setSearchQuery] = useState('');
// Local desktop reads over IPC; a bound device reads over RPC. Either path
// makes the skills list reachable even when this client isn't the desktop.
const enabled = (isDesktop || !!deviceId) && !!workingDirectory;
@@ -59,28 +62,37 @@ const SkillsGroup = memo<SkillsGroupProps>(({ deviceId, workingDirectory }) => {
const hasDevice = deviceItems.length > 0;
if (hasProject || hasDevice) {
+ const matchedProjectItems = filterSkillItems(projectItems, searchQuery);
+ const matchedDeviceItems = filterSkillItems(deviceItems, searchQuery);
+ const hasMatchedProject = matchedProjectItems.length > 0;
+ const hasMatchedDevice = matchedDeviceItems.length > 0;
+
return (
<>
- {hasProject && (
+ <SkillsSearchBar onSearch={setSearchQuery} />
+ {!hasMatchedProject && !hasMatchedDevice && (
+ <SkillSection isEmpty emptyText={t('workingPanel.skills.noSearchResults')} />
+ )}
+ {hasMatchedProject && (
<SkillSection
sectionHeader={{
collapsible: false,
- count: projectItems.length,
+ count: matchedProjectItems.length,
title: t('workingPanel.skills.section.project'),
}}
>
- {renderList(projectItems)}
+ {renderList(matchedProjectItems)}
</SkillSection>
)}
- {hasDevice && (
+ {hasMatchedDevice && (
<SkillSection
sectionHeader={{
collapsible: false,
- count: deviceItems.length,
+ count: matchedDeviceItems.length,
title: t('workingPanel.skills.section.device'),
}}
>
- {renderList(deviceItems)}
+ {renderList(matchedDeviceItems)}
</SkillSection>
)}
</>
diff --git a/src/features/Conversation/WorkingSidebar/ResourcesSection/UserLevelSkills.tsx b/src/features/Conversation/WorkingSidebar/ResourcesSection/UserLevelSkills.tsx
index a366633905e..fa7c94e61f4 100644
--- a/src/features/Conversation/WorkingSidebar/ResourcesSection/UserLevelSkills.tsx
+++ b/src/features/Conversation/WorkingSidebar/ResourcesSection/UserLevelSkills.tsx
@@ -8,6 +8,7 @@ import { useTranslation } from 'react-i18next';
import { startSkillDrag } from '@/features/ChatInput/InputEditor/ActionTag/skillDragData';
import {
+ filterSkillItems,
openRenameSkillModal,
type SkillListItem,
type SkillRowAction,
@@ -80,13 +81,16 @@ interface UserLevelSkillsProps {
* matching the agent-only layout this used to ship with.
*/
hideHeader?: boolean;
+ /** Only render skills matching this query. */
+ searchQuery?: string;
}
-const UserLevelSkills = memo<UserLevelSkillsProps>(({ hideHeader }) => {
+const UserLevelSkills = memo<UserLevelSkillsProps>(({ hideHeader, searchQuery = '' }) => {
const { t } = useTranslation('chat');
const { t: tCommon } = useTranslation('common');
- const items = useUserSkills();
+ const userItems = useUserSkills();
+ const items = useMemo(() => filterSkillItems(userItems, searchQuery), [userItems, searchQuery]);
// The row shape keys off `identifier`, but the store mutations key off the DB
// id — resolve one from the other through the raw skill list.
const agentSkills = useToolStore(agentSkillsSelectors.getAgentSkills, isEqual);
diff --git a/src/features/SkillsList/SkillsSearchBar.tsx b/src/features/SkillsList/SkillsSearchBar.tsx
new file mode 100644
index 00000000000..4ce07a612a7
--- /dev/null
+++ b/src/features/SkillsList/SkillsSearchBar.tsx
@@ -0,0 +1,45 @@
+import { Icon, Input, stopPropagation } from '@lobehub/ui';
+import { SearchIcon } from 'lucide-react';
+import { useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+const SEARCH_DEBOUNCE_MS = 180;
+
+interface SkillsSearchBarProps {
+ /** Must be stable: it receives the debounced query, and '' on unmount. */
+ onSearch: (query: string) => void;
+}
+
+// Keystrokes stay local to this component: only the debounced query reaches the
+// host, so typing never re-renders the skill rows.
+const SkillsSearchBar = ({ onSearch }: SkillsSearchBarProps) => {
+ const { t } = useTranslation('chat');
+ const [value, setValue] = useState('');
+
+ useEffect(() => {
+ const timer = setTimeout(() => onSearch(value), SEARCH_DEBOUNCE_MS);
+ return () => clearTimeout(timer);
+ }, [onSearch, value]);
+
+ // The input remounts empty, so the host must not keep filtering by the old query.
+ useEffect(() => () => onSearch(''), [onSearch]);
+
+ return (
+ <Input
+ allowClear
+ aria-label={t('workingPanel.skills.searchPlaceholder')}
+ placeholder={t('workingPanel.skills.searchPlaceholder')}
+ prefix={<Icon icon={SearchIcon} size={13} />}
+ size={'small'}
+ style={{ flexShrink: 0 }}
+ value={value}
+ onChange={(e) => setValue(e.target.value)}
+ onKeyDown={(event) => {
+ stopPropagation(event);
+ if (event.key === 'Escape') setValue('');
+ }}
+ />
+ );
+};
+
+export default SkillsSearchBar;
diff --git a/src/features/SkillsList/filterSkillItems.test.ts b/src/features/SkillsList/filterSkillItems.test.ts
new file mode 100644
index 00000000000..774d6172e26
--- /dev/null
+++ b/src/features/SkillsList/filterSkillItems.test.ts
@@ -0,0 +1,26 @@
+import { describe, expect, it } from 'vitest';
+
+import { filterSkillItems } from './filterSkillItems';
+
+const items = [
+ { description: 'Query PostgreSQL databases', id: 'access-pg', name: 'access-pg' },
+ { id: 'add-model', name: 'add-model' },
+];
+
+describe('filterSkillItems', () => {
+ it('returns the same list for a blank query', () => {
+ expect(filterSkillItems(items, ' ')).toBe(items);
+ });
+
+ it('matches the name case-insensitively and ignores surrounding spaces', () => {
+ expect(filterSkillItems(items, ' ADD-MO ').map((item) => item.id)).toEqual(['add-model']);
+ });
+
+ it('matches the description', () => {
+ expect(filterSkillItems(items, 'postgres').map((item) => item.id)).toEqual(['access-pg']);
+ });
+
+ it('returns nothing when no skill matches', () => {
+ expect(filterSkillItems(items, 'nope')).toEqual([]);
+ });
+});
diff --git a/src/features/SkillsList/filterSkillItems.ts b/src/features/SkillsList/filterSkillItems.ts
new file mode 100644
index 00000000000..b4d2bf2ed78
--- /dev/null
+++ b/src/features/SkillsList/filterSkillItems.ts
@@ -0,0 +1,12 @@
+import type { SkillListItem } from './SkillsList';
+
+/** Case-insensitive match on the skill name and its description. */
+export const filterSkillItems = (items: SkillListItem[], query: string): SkillListItem[] => {
+ const keyword = query.trim().toLowerCase();
+ if (!keyword) return items;
+
+ return items.filter(
+ ({ description, name }) =>
+ name.toLowerCase().includes(keyword) || description?.toLowerCase().includes(keyword),
+ );
+};
diff --git a/src/features/SkillsList/index.ts b/src/features/SkillsList/index.ts
index 05d46434fc9..b166d4b155b 100644
--- a/src/features/SkillsList/index.ts
+++ b/src/features/SkillsList/index.ts
@@ -1,6 +1,8 @@
+export { filterSkillItems } from './filterSkillItems';
export { openRenameSkillModal } from './RenameSkillModal';
export type { SkillSectionHeader, SkillSectionProps } from './SkillSection';
export { default as SkillSection } from './SkillSection';
export type { SkillListItem, SkillRowAction } from './SkillsList';
export { default as SkillsList } from './SkillsList';
+export { default as SkillsSearchBar } from './SkillsSearchBar';
export { useProjectSkills, type UseProjectSkillsResult } from './useProjectSkills';