We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Dynamic Prompts

OpenCode's command pipeline supports a few useful prompt features:

  • Positional arguments like $1, $2, and $ARGUMENTS
  • Shell output injection like !`bun test`

These are command features. Invoking a skill with @skill-id activates the skill body without parsing command arguments or shell blocks (but it's still valid to invoke a skill and provide additional instructions in the same prompt).

For example, a file at .opencode/commands/linusfunc.md could contain:

---
description: Builds a function like Linus Torvalds would
---

Write a new function, complete with tests the way Linus Torvalds would. The function is $ARGUMENTS

The $ARGUMENTS variable is replaced by whatever you type after the command:

/linusfunc a sum function that adds two numbers together

You can also break the arguments into separate positional variables if you like:

The function is $1
It should $2 include tests
/linusfunc sum not

Which produces this prompt:

The function is sum
It should not include tests

File References

While using @path-to-file works in the OpenCode prompt box to select a file and include its contents, it doesn't work in a command prompt: it just stays plain text. Instead, just tell the agent to read the file:

Read `src/asteroid.py`, then make me a new asteroid with jaggier edges.

Assignment

With the playground still running, tell OpenCode to run and submit the CLI tests from the project root.