Record Class Skill

java.lang.Object
java.lang.Record
com.tnsai.skills.Skill

public record Skill(String name, String description, Optional<String> whenToUse, String body, List<String> allowedTools, List<String> paths, boolean disableModelInvocation, boolean userInvocable, Optional<String> argumentHint, List<String> arguments, Map<String,String> supportingFiles) extends Record
On-demand modular knowledge layer between role and tools (TNS-289).

A Skill is a multi-step procedure / domain knowledge / structured workflow that activates when relevant to the user's intent rather than being pinned in every system prompt. Modeled after Anthropic's Claude Code Skills (official docs) and the agentskills.io open standard, so a SKILL.md file authored for Claude Code parses into a TnsAI Skill unchanged.

Lifecycle

  1. Discovery: store enumerates available skills at startup; only the description of each is in the always-on system prompt.
  2. Resolution: per user message, a SkillResolver ranks candidates by relevance.
  3. Activation: user invocation (/skill-name) or model tool call injects the full body into the conversation context for the remainder of the session.

Skill vs Tool vs Capability vs RAG

LayerLoadedGranularity
ToolAlwaysAtomic action
CapabilityAlways (compile-time)Method-level declaration
RAG hitPer-query (similarity)Evidence text
SkillOn-demand (intent-matched)Multi-step procedure
Since:
0.10.0 (TNS-289)
  • Constructor Details

    • Skill

      public Skill(String name, String description, Optional<String> whenToUse, String body, List<String> allowedTools, List<String> paths, boolean disableModelInvocation, boolean userInvocable, Optional<String> argumentHint, List<String> arguments, Map<String,String> supportingFiles)
      Creates an instance of a Skill record class.
      Parameters:
      name - the value for the name record component
      description - the value for the description record component
      whenToUse - the value for the whenToUse record component
      body - the value for the body record component
      allowedTools - the value for the allowedTools record component
      paths - the value for the paths record component
      disableModelInvocation - the value for the disableModelInvocation record component
      userInvocable - the value for the userInvocable record component
      argumentHint - the value for the argumentHint record component
      arguments - the value for the arguments record component
      supportingFiles - the value for the supportingFiles record component
  • Method Details

    • builder

      public static Skill.Builder builder(String name)
      Convenience builder for tests and programmatic registration.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • whenToUse

      public Optional<String> whenToUse()
      Returns the value of the whenToUse record component.
      Returns:
      the value of the whenToUse record component
    • body

      public String body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component
    • allowedTools

      public List<String> allowedTools()
      Returns the value of the allowedTools record component.
      Returns:
      the value of the allowedTools record component
    • paths

      public List<String> paths()
      Returns the value of the paths record component.
      Returns:
      the value of the paths record component
    • disableModelInvocation

      public boolean disableModelInvocation()
      Returns the value of the disableModelInvocation record component.
      Returns:
      the value of the disableModelInvocation record component
    • userInvocable

      public boolean userInvocable()
      Returns the value of the userInvocable record component.
      Returns:
      the value of the userInvocable record component
    • argumentHint

      public Optional<String> argumentHint()
      Returns the value of the argumentHint record component.
      Returns:
      the value of the argumentHint record component
    • arguments

      public List<String> arguments()
      Returns the value of the arguments record component.
      Returns:
      the value of the arguments record component
    • supportingFiles

      public Map<String,String> supportingFiles()
      Returns the value of the supportingFiles record component.
      Returns:
      the value of the supportingFiles record component