Skip to content

Commit bb02e8f

Browse files
authored
Skills (#421)
1 parent 411206b commit bb02e8f

File tree

31 files changed

+1030
-76
lines changed

31 files changed

+1030
-76
lines changed

.agents/skills/cleanup/SKILL.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: cleanup
3+
description: Simplify and clean code
4+
---
5+
6+
# Cleanup
7+
8+
Please review the uncommitted changes (staged and unstaged) and find ways to simplify the code. Clean up logic. Find a simpler design. Reuse existing functions. Move utilities to utility files. Lower the cyclomatic complexity. Remove try/catch statements when not completely necessary.

.agents/skills/review/SKILL.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: review
3+
description: Review uncommitted changes
4+
---
5+
6+
# Review
7+
8+
Run commands to get the current unstaged and stage changes. Read those files and any other that are relevant. Find ways to simplify, improve the code, find any bugs, etc.

agents/base2/base2.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export function createBase2(
6262
'propose_str_replace',
6363
'propose_write_file',
6464
!noAskUser && 'ask_user',
65+
'skill',
6566
'set_output',
6667
),
6768
spawnableAgents: buildArray(

agents/types/tools.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export type ToolName =
1919
| 'run_terminal_command'
2020
| 'set_messages'
2121
| 'set_output'
22+
| 'skill'
2223
| 'spawn_agents'
2324
| 'str_replace'
2425
| 'suggest_followups'
@@ -49,6 +50,7 @@ export interface ToolParamsMap {
4950
run_terminal_command: RunTerminalCommandParams
5051
set_messages: SetMessagesParams
5152
set_output: SetOutputParams
53+
skill: SkillParams
5254
spawn_agents: SpawnAgentsParams
5355
str_replace: StrReplaceParams
5456
suggest_followups: SuggestFollowupsParams
@@ -246,6 +248,14 @@ export interface SetMessagesParams {
246248
*/
247249
export interface SetOutputParams {}
248250

251+
/**
252+
* Load a skill's full instructions when relevant to the current task. Skills are loaded on-demand - only load them when you need their specific guidance.
253+
*/
254+
export interface SkillParams {
255+
/** The name of the skill to load */
256+
name: string
257+
}
258+
249259
/**
250260
* Spawn multiple agents and send a prompt and/or parameters to each of them. These agents will run in parallel. Note that that means they will run independently. If you need to run agents sequentially, use spawn_agents with one agent at a time instead.
251261
*/

bun.lock

Lines changed: 16 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/src/chat.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { MessageWithAgents } from './components/message-with-agents'
2121
import { PendingBashMessage } from './components/pending-bash-message'
2222
import { StatusBar } from './components/status-bar'
2323
import { TopBanner } from './components/top-banner'
24-
import { SLASH_COMMANDS } from './data/slash-commands'
24+
import { getSlashCommandsWithSkills } from './data/slash-commands'
2525
import { useAgentValidation } from './hooks/use-agent-validation'
2626
import { useAskUserBridge } from './hooks/use-ask-user-bridge'
2727
import { useChatInput } from './hooks/use-chat-input'
@@ -63,6 +63,7 @@ import {
6363
createDefaultChatKeyboardState,
6464
} from './utils/keyboard-actions'
6565
import { loadLocalAgents } from './utils/local-agent-registry'
66+
import { getLoadedSkills } from './utils/skill-registry'
6667
import {
6768
getStatusIndicatorState,
6869
type AuthStatus,
@@ -205,15 +206,20 @@ export const Chat = ({
205206
const setInputMode = useChatStore((state) => state.setInputMode)
206207
const askUserState = useChatStore((state) => state.askUserState)
207208

209+
// Get loaded skills for slash commands
210+
const loadedSkills = useMemo(() => getLoadedSkills(), [])
211+
208212
// Filter slash commands based on current ads state - only show the option that changes state
213+
// Also merge in skill commands
209214
const filteredSlashCommands = useMemo(() => {
210215
const adsEnabled = getAdsEnabled()
211-
return SLASH_COMMANDS.filter((cmd) => {
216+
const allCommands = getSlashCommandsWithSkills(loadedSkills)
217+
return allCommands.filter((cmd) => {
212218
if (cmd.id === 'ads:enable') return !adsEnabled
213219
if (cmd.id === 'ads:disable') return adsEnabled
214220
return true
215221
})
216-
}, [inputValue]) // Re-evaluate when input changes (user may have just toggled)
222+
}, [inputValue, loadedSkills]) // Re-evaluate when input changes (user may have just toggled)
217223

218224
const {
219225
slashContext,

0 commit comments

Comments
 (0)