# Class InMemorySkillSource

java.lang.Object
com.google.adk.skills.InMemorySkillSource

All Implemented Interfaces:
  `SkillSource`

public final class InMemorySkillSource extends Object implements SkillSource
An in-memory implementation of `SkillSource`.

Everything is provided upfront using a builder pattern.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `InMemorySkillSource.Builder`
  Builder for `InMemorySkillSource`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static InMemorySkillSource.Builder`
  `builder()`
  `io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableMap<String, Frontmatter>>`
  `listFrontmatters()`
  Lists all available `Frontmatter`s for discovered skills.
  `io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableList<String>>`
  `listResources(String skillName, String resourceDirectory)`
  Lists all resource files for a specific skill within a given directory.
  `io.reactivex.rxjava3.core.Single<Frontmatter>`
  `loadFrontmatter(String skillName)`
  Loads the `Frontmatter` for a specific skill.
  `io.reactivex.rxjava3.core.Single<String>`
  `loadInstructions(String skillName)`
  Loads the instructions (body of SKILL.md) for a specific skill.
  `io.reactivex.rxjava3.core.Single<com.google.common.io.ByteSource>`
  `loadResource(String skillName, String resourcePath)`
  Loads a specific resource file content.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### builder

    public static InMemorySkillSource.Builder builder()

  - ### listFrontmatters

    public io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableMap<String, Frontmatter>> listFrontmatters()
    Description copied from interface: `SkillSource`
    Lists all available `Frontmatter`s for discovered skills.

    If the source is misconfigured, such as directory doesn't exist, or having malformed skill, the returned `Single` will terminate with a `SkillSourceException` with the reason in the message.

    Specified by:
      `listFrontmatters` in interface `SkillSource`
    Returns:
      a `Single` emitting a map where keys are skill names and values are their `Frontmatter`

  - ### listResources

    public io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableList<String>> listResources(String skillName, String resourceDirectory)
    Description copied from interface: `SkillSource`
    Lists all resource files for a specific skill within a given directory.

    If the skill or the resource directory does not exist, the returned `Single` will terminate with a `SkillSourceException`.

    Specified by:
      `listResources` in interface `SkillSource`
    Parameters:
      `skillName` - the name of the skill
      `resourceDirectory` - the relative directory within the skill to list (e.g., "assets", "scripts")
    Returns:
      a `Single` emitting a list of resource paths relative to the skill directory

  - ### loadFrontmatter

    public io.reactivex.rxjava3.core.Single<Frontmatter> loadFrontmatter(String skillName)
    Description copied from interface: `SkillSource`
    Loads the `Frontmatter` for a specific skill.

    If the skill is not found or its frontmatter is malformed, the returned `Single` will terminate with a `SkillSourceException` or parsing error.

    Specified by:
      `loadFrontmatter` in interface `SkillSource`
    Parameters:
      `skillName` - the name of the skill
    Returns:
      a `Single` emitting the `Frontmatter` for the skill

  - ### loadInstructions

    public io.reactivex.rxjava3.core.Single<String> loadInstructions(String skillName)
    Description copied from interface: `SkillSource`
    Loads the instructions (body of SKILL.md) for a specific skill.

    If the skill is not found or its file structure is invalid (e.g., unclosed frontmatter blocks), the returned `Single` will terminate with a `SkillSourceException`.

    Specified by:
      `loadInstructions` in interface `SkillSource`
    Parameters:
      `skillName` - the name of the skill
    Returns:
      a `Single` emitting the instructions as a String

  - ### loadResource

    public io.reactivex.rxjava3.core.Single<com.google.common.io.ByteSource> loadResource(String skillName, String resourcePath)
    Description copied from interface: `SkillSource`
    Loads a specific resource file content.

    If the skill or the specific resource path cannot be found, the returned `Single` will terminate with a `SkillSourceException`.

    Specified by:
      `loadResource` in interface `SkillSource`
    Parameters:
      `skillName` - the name of the skill
      `resourcePath` - the path to the resource file relative to the skill directory
    Returns:
      a `Single` emitting the `ByteSource` for the resource content