Package com.tnsai.skills
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
- Discovery: store enumerates available skills at startup; only the
descriptionof each is in the always-on system prompt. - Resolution: per user message, a
SkillResolverranks candidates by relevance. - Activation: user invocation (
/skill-name) or model tool call injects the fullbodyinto the conversation context for the remainder of the session.
Skill vs Tool vs Capability vs RAG
| Layer | Loaded | Granularity |
|---|---|---|
| Tool | Always | Atomic action |
| Capability | Always (compile-time) | Method-level declaration |
| RAG hit | Per-query (similarity) | Evidence text |
| Skill | On-demand (intent-matched) | Multi-step procedure |
- Since:
- 0.10.0 (TNS-289)
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionSkill(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 aSkillrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theallowedToolsrecord component.Returns the value of theargumentHintrecord component.Returns the value of theargumentsrecord component.body()Returns the value of thebodyrecord component.static Skill.BuilderConvenience builder for tests and programmatic registration.Returns the value of thedescriptionrecord component.booleanReturns the value of thedisableModelInvocationrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.paths()Returns the value of thepathsrecord component.Returns the value of thesupportingFilesrecord component.final StringtoString()Returns a string representation of this record class.booleanReturns the value of theuserInvocablerecord component.Returns the value of thewhenToUserecord component.
-
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 aSkillrecord class.- Parameters:
name- the value for thenamerecord componentdescription- the value for thedescriptionrecord componentwhenToUse- the value for thewhenToUserecord componentbody- the value for thebodyrecord componentallowedTools- the value for theallowedToolsrecord componentpaths- the value for thepathsrecord componentdisableModelInvocation- the value for thedisableModelInvocationrecord componentuserInvocable- the value for theuserInvocablerecord componentargumentHint- the value for theargumentHintrecord componentarguments- the value for theargumentsrecord componentsupportingFiles- the value for thesupportingFilesrecord component
-
-
Method Details
-
builder
Convenience builder for tests and programmatic registration. -
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
whenToUse
Returns the value of thewhenToUserecord component.- Returns:
- the value of the
whenToUserecord component
-
body
Returns the value of thebodyrecord component.- Returns:
- the value of the
bodyrecord component
-
allowedTools
Returns the value of theallowedToolsrecord component.- Returns:
- the value of the
allowedToolsrecord component
-
paths
Returns the value of thepathsrecord component.- Returns:
- the value of the
pathsrecord component
-
disableModelInvocation
public boolean disableModelInvocation()Returns the value of thedisableModelInvocationrecord component.- Returns:
- the value of the
disableModelInvocationrecord component
-
userInvocable
public boolean userInvocable()Returns the value of theuserInvocablerecord component.- Returns:
- the value of the
userInvocablerecord component
-
argumentHint
Returns the value of theargumentHintrecord component.- Returns:
- the value of the
argumentHintrecord component
-
arguments
Returns the value of theargumentsrecord component.- Returns:
- the value of the
argumentsrecord component
-
supportingFiles
Returns the value of thesupportingFilesrecord component.- Returns:
- the value of the
supportingFilesrecord component
-