PluginDataSkill Model
PluginDataSkill model for storing SKILL.md-based plugin data configuration.
- class smarter.apps.plugin.models.plugin_data_skill.PluginDataSkill(*args, **kwargs)[source]
Bases:
PluginDataBaseStores the configuration and content of a Smarter plugin based on the.
SKILL.md standard.
This model is used for plugins that expose a “skill”: a self-contained Markdown document with a YAML frontmatter header describing the skill (
name,description, and optionallylicenseandallowed-tools), followed by a Markdown body containing the instructions the LLM should follow when the skill is invoked. Skills may also reference bundled resources (scripts, references, assets) that ship alongside the SKILL.md file.PluginDataSkillprovides methods for:Parsing
skill_documentinto its YAML frontmatter and Markdown body.Validating that the frontmatter conforms to the SKILL.md spec (i.e. contains the required
nameanddescriptionkeys).Returning sanitized skill data (name, description, instructions, allowed tools, license, and bundled resources) for use in LLM prompts.
Extracting and caching the set of top-level keys present in the parsed frontmatter.
This model is a concrete subclass of
PluginDataBase, and is referenced byPluginMetato provide the data payload for skill-type plugins. It is also used in conjunction withPluginSelectorandPluginPromptto enable full plugin lifecycle management.Typical use cases include plugins that teach the LLM a repeatable procedure, workflow, or domain-specific technique – for example, “how to fill out this PDF form” or “how to generate a pptx deck” – without requiring a remote API or SQL connection.
See also:
PluginDataBasePluginDataStaticPluginDataSqlPluginMeta
- Parameters:
id (Unknown) – Primary key: ID
created_at (Unknown) – Created at
updated_at (Unknown) – Updated at
description (Unknown) – Description. A brief description of what this plugin returns. Be verbose, but not too verbose.
parameters (Unknown) – Parameters. A JSON dict containing parameter names and data types. Example: {‘required’: [], ‘properties’: {‘max_cost’: {‘type’: ‘float’, ‘description’: ‘the maximum cost that a student is willing to pay for a course.’}, ‘description’: {‘enum’: [‘AI’, ‘mobile’, ‘web’, ‘database’, ‘network’, ‘neural networks’], ‘type’: ‘string’, ‘description’: ‘areas of specialization for courses in the catalogue.’}}}
test_values (Unknown) – Test values. A JSON dict containing test values for each parameter. Example: {‘city’: ‘San Francisco’}
skill_document (Unknown) –
Skill document. The raw contents of the SKILL.md file for this plugin: a YAML frontmatter block (name, description, and optionally license and allowed-tools) followed by a Markdown body containing the instructions returned to the LLM when this plugin is invoked by the user prompt.
The raw SKILL.md document (frontmatter + Markdown body) that this plugin returns to the LLM.
metadata (Unknown) –
Metadata. Parsed YAML frontmatter from skill_document (name, description, license, allowed-tools, and any additional custom keys).
Cached, parsed representation of the YAML frontmatter block.
Repopulated on every save().
allowed_tools (Unknown) –
Allowed tools. Optional list of tool names this skill is permitted to invoke, mirroring the SKILL.md ‘allowed-tools’ frontmatter key.
Denormalized copy of the frontmatter’s allowed-tools list, kept in sync on save() for efficient querying.
resources (Unknown) –
Resources. Optional list of bundled resource file references (e.g. scripts/, references/, assets/ paths) that accompany this skill, expressed as relative paths.
Relative paths to any bundled files (scripts, references, assets) shipped alongside this skill.
Relationship fields:
- Parameters:
plugin (Unknown) – Plugin (related name:
plugin_data_base_plugin)plugindatabase_ptr (Unknown) – Primary key: Plugindatabase ptr (related name:
plugindataskill)
- exception DoesNotExist
Bases:
DoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
NotUpdated
- allowed_tools
-
Allowed tools. Optional list of tool names this skill is permitted to invoke, mirroring the SKILL.md ‘allowed-tools’ frontmatter key.
Denormalized copy of the frontmatter’s allowed-tools list, kept in sync on save() for efficient querying.
- Type:
Type
- data(params=None)[source]
Return the skill document as a structured dictionary of frontmatter + instructions.
Unlike
sanitized_return_data(), this returns the untruncated body and the full, unfiltered frontmatter mapping (including any custom keys beyond the standard SKILL.md fields).
- classmethod get_cached_data_by_plugin(plugin, invalidate=False)[source]
Return a single instance of PluginDataSkill by plugin.
This method caches the results to improve performance.
- Parameters:
plugin (
PluginMeta) – The plugin whose data should be retrieved.- Returns:
A PluginDataSkill instance if found, otherwise None.
- Return type:
- classmethod get_cached_object(*args, invalidate=False, pk=None, plugin=None, **kwargs)[source]
Retrieve a model instance by primary key, using caching to.
optimize performance. This method is selectively overridden in models that inherit from MetaDataModel to provide class-specific function parameters.
Example usage:
# Retrieve by primary key instance = MyModel.get_cached_object(pk=1)
- Parameters:
- Returns:
The model instance if found, otherwise None.
- Return type:
- metadata
-
Metadata. Parsed YAML frontmatter from skill_document (name, description, license, allowed-tools, and any additional custom keys).
Cached, parsed representation of the YAML frontmatter block.
Repopulated on every save().
- Type:
Type
- static parse_skill_document(skill_document)[source]
Split a SKILL.md document into its parsed YAML frontmatter and Markdown body.
- Parameters:
skill_document (
str) – The raw SKILL.md file contents.- Returns:
A tuple of (frontmatter dict, body markdown string).
- Return type:
- Raises:
SmarterValueError – If the document has no frontmatter block, or the frontmatter is not valid YAML, or does not parse to a dict.
- plugindatabase_ptr
OneToOneFieldtoPluginDataBasePrimary key: Plugindatabase ptr (related name:
plugindataskill)- Type:
Type
- plugindatabase_ptr_id
Internal field, use
plugindatabase_ptrinstead.
- resources
-
Resources. Optional list of bundled resource file references (e.g. scripts/, references/, assets/ paths) that accompany this skill, expressed as relative paths.
Relative paths to any bundled files (scripts, references, assets) shipped alongside this skill.
- Type:
Type
- property return_data_keys: list[str] | None
Return all top-level keys present in the parsed
skill_documentfrontmatter.- Returns:
A list of frontmatter keys (e.g.
['name', 'description', 'license']).- Return type:
- Raises:
SmarterValueError – If skill_document cannot be parsed.
Example:
# If skill_document frontmatter is: # --- # name: pdf-form-filler # description: Fill out a PDF form given field values. # allowed-tools: [bash, view] # --- return_data_keys # ['name', 'description', 'allowed-tools']
- sanitized_return_data(params=None)[source]
Return the skill data for this plugin as a dictionary suitable for the LLM.
This returns the parsed frontmatter fields (
name,description,license,allowed-tools) plus the Markdown instructions body and any bundled resource references. The instructions body is truncated tosmarter_settings.plugin_max_data_resultscharacters if it exceeds that length, to bound prompt size.
- save(*args, **kwargs)[source]
Override the save method to parse/validate skill_document and sync derived fields.
- skill_document
-
Skill document. The raw contents of the SKILL.md file for this plugin: a YAML frontmatter block (name, description, and optionally license and allowed-tools) followed by a Markdown body containing the instructions returned to the LLM when this plugin is invoked by the user prompt.
The raw SKILL.md document (frontmatter + Markdown body) that this plugin returns to the LLM.
- Type:
Type
- validate()[source]
Validate the model.
Attention
Intended to be overridden in subclasses to provide custom validation logic.
- Return type: