[PR #10891] feat(skill): add dynamic context support with !command syntax #13596

Open
opened 2026-02-16 18:18:26 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10891

State: open
Merged: No


Fixes #10892

What does this PR do?

Adds !command`` syntax support in skills to inject dynamic content at load time, compatible with Claude Code's implementation.

Example skill:

---
name: project-context
description: Provides current project context
---

Current branch: !`git branch --show-current`
Recent commits: !`git log --oneline -5`

Implementation approach:

  • Matches the existing prompt.ts pattern for shell execution (simple $ template, no permission prompts)
  • Skills are user-authored config files with the same trust model as prompts
  • Commands execute in the skill's directory
  • Output truncation handled by the Tool framework

How did you verify your code works?

  • Tested locally with a test skill containing dynamic commands
  • 13 tests covering:
    • Basic command execution
    • Multiple commands in one skill
    • Working directory (commands run in skill's directory)
    • Failing command handling
    • Empty output handling
    • Special characters (quotes, pipes)
    • Multiple sequential executions
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10891 **State:** open **Merged:** No --- Fixes #10892 ### What does this PR do? Adds `!`command`` syntax support in skills to inject dynamic content at load time, compatible with [Claude Code's implementation](https://docs.anthropic.com/en/docs/claude-code/skills#inject-dynamic-context). **Example skill:** ```markdown --- name: project-context description: Provides current project context --- Current branch: !`git branch --show-current` Recent commits: !`git log --oneline -5` ``` **Implementation approach:** - Matches the existing `prompt.ts` pattern for shell execution (simple `$` template, no permission prompts) - Skills are user-authored config files with the same trust model as prompts - Commands execute in the skill's directory - Output truncation handled by the Tool framework ### How did you verify your code works? - Tested locally with a test skill containing dynamic commands - 13 tests covering: - Basic command execution - Multiple commands in one skill - Working directory (commands run in skill's directory) - Failing command handling - Empty output handling - Special characters (quotes, pipes) - Multiple sequential executions
yindo added the pull-request label 2026-02-16 18:18:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13596