Skip to main content

SkillDraft

Struct SkillDraft 

Source
pub struct SkillDraft { /* private fields */ }
Expand description

A skill to be written to disk.

name and description are required by the specification; everything else is optional and is omitted from the generated file when unset.

§Example

use adk_skill::SkillDraft;

let draft = SkillDraft::new("disk-triage", "Diagnose low disk space. Use when a disk alert fires.")
    .with_body("1. Check the largest directories.\n2. Report growth rate.")
    .with_tags(["ops"])
    .with_allowed_tools(["read_file"]);

assert_eq!(draft.name(), "disk-triage");

Implementations§

Source§

impl SkillDraft

Source

pub fn new(name: impl Into<String>, description: impl Into<String>) -> Self

Creates a draft with the two required fields.

Source

pub fn with_body(self, body: impl Into<String>) -> Self

Sets the instructional Markdown body.

Source

pub fn with_version(self, version: impl Into<String>) -> Self

Sets the version identifier.

Source

pub fn with_license(self, license: impl Into<String>) -> Self

Sets the license identifier.

Source

pub fn with_compatibility(self, compatibility: impl Into<String>) -> Self

Sets the environment requirements.

Source

pub fn with_tags<I, S>(self, tags: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Sets the discovery tags.

Source

pub fn with_allowed_tools<I, S>(self, tools: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Sets the pre-approved tool names.

Source

pub fn with_references<I, S>(self, references: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Sets the supporting resource paths.

Source

pub fn with_trigger(self, trigger: bool) -> Self

Requires explicit invocation by name rather than automatic selection.

Source

pub fn with_hint(self, hint: impl Into<String>) -> Self

Sets the guided-input hint.

Source

pub fn with_metadata(self, metadata: HashMap<String, Value>) -> Self

Sets the extension metadata.

Useful for recording provenance — which incident a learned skill came from, when it was promoted, and what evidence supported it.

Source

pub fn with_metadata_entry(self, key: impl Into<String>, value: Value) -> Self

Adds one extension metadata entry.

Source

pub fn with_triggers<I, S>(self, triggers: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Sets the file glob patterns that activate this skill.

Source

pub fn name(&self) -> &str

The skill’s name.

Source

pub fn validate(&self) -> SkillResult<()>

Checks the draft against the specification.

§Errors

Returns SkillError::Validation when the name is invalid or the description is empty.

Source

pub fn to_markdown(&self) -> SkillResult<String>

Renders the draft as skill Markdown: YAML frontmatter, then the body.

The output is what parse_skill_markdown accepts, so a draft written and reparsed yields equivalent content.

§Errors

Returns an error if the draft fails validate or the frontmatter cannot be serialized.

Trait Implementations§

Source§

impl Clone for SkillDraft

Source§

fn clone(&self) -> SkillDraft

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SkillDraft

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SkillDraft

Source§

fn default() -> SkillDraft

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more