Class SkillSubstitution

java.lang.Object
com.tnsai.skills.SkillSubstitution

public final class SkillSubstitution extends Object
Placeholder substitution for skill bodies and frontmatter strings (TNS-289). Mirrors the Claude Code substitution semantics so SKILL.md authored elsewhere works unchanged here.

Placeholders

PlaceholderResolves to
$ARGUMENTSAll positional arguments space-joined
$0, $1, ...The Nth positional argument (0-indexed); empty string if absent
${VAR}Named environment from the supplied env map; empty string if absent

Escaping

Two consecutive dollar signs ($$) emit a single literal dollar sign and skip substitution at that position. This is the same escape Bash and most shells use.

Substitution is single-pass and left-to-right; the result of one substitution is not re-substituted. This keeps behaviour predictable — placeholders that happen to evaluate to other placeholder syntax stay literal in the output.

Since:
0.10.0 (TNS-289)
  • Method Details

    • apply

      public static String apply(String template, List<String> arguments, Map<String,String> env)
      Substitute placeholders in template using arguments for $ARGUMENTS / $N and env for named ${VAR} values. Both maps may be empty; absent placeholders resolve to empty strings rather than throwing — skills are frequently invoked with optional arguments and a missing one shouldn't fail the whole invocation.