Using AI skills in SourceCraft

You can automate recurring tasks and extend the functionality of the chat with Code Assistant in the SourceCraft interface using AI skills.

An AI skill starts in the chat with Code Assistant and supplies the AI agent with instructions and context specific to the particular task and repository the chat has been opened in.

Instead of providing the AI agent with multi-step instructions each time, describe them once and call them as an AI skill as needed. AI skills also allow you to standardize your workflow within your team and replicate it across different repositories.

For example, you can do the following using AI skills:

  • Complete interactive training for SourceCraft users.
  • Request help with repository configuration.
  • Decompose an issue.
  • Summarize issue-related information.
  • Gather the context of your actions in the repository for the last few hours.

For more information, see AI skills in SourceCraft.

Note

Follow these guides to set up skills in the SourceCraft interface. Learn more about the Configuration as Code setup format in Skill configuration files.

Running a skill

Only system skills are immediately available for running in any repository by default. To run a skill from the catalog or a public skill, first import it. To run a custom skill, first create it in the repository.

To run a skill:

  1. Open the SourceCraft home page.

  2. On the Home tab, under Your craftspace, navigate to Repositories.

  3. Select the repository you want to run a skill in.

  4. In the panel on the left, click Code Assistant Chat.

    You can also run a skill from CI/CD in the AI section.

  5. Click in the bottom-right corner of the chat and select the skill you want to run.

    Tip

    If you know the command corresponding to the skill, you can also start typing it in the chat beginning with /, e.g., /configs, and then select the command from the drop-down menu, e.g., /configs-helper.

  6. Click or press Enter.

  7. Optionally, if the skill implies any parameters, enter them or select them from the drop-down menu and click Accept.

  8. Code Assistant may ask you clarifying questions as you go along. Answer them in the chat in natural language.

    Tip

    If you change your mind and want to stop Code Assistant, click Stop.

    Wait for the Finished skill scenario message to appear in the chat.

  9. If changes were applied to the repository when executing a skill:

    1. In the top-right corner, click Commit changes.

    2. In the window that opens, configure the procedure for changes:

      • In the Commit message field, give a comment that will describe the changes you make.
      • Under Commit branch, select the branch you want to change. Create a new branch as needed.
      • Under After commit action, select an action to take after saving changes: Save and create a new change proposal or Just save.
    3. Confirm your changes.

Importing a skill

You can import a skill from the catalog or any public skill into your repository.

Warning

Imported skills contain instructions for Code Assistant that will be executed within your repository. Make sure to review the contents of these instructions before using a skill.

Note that an imported skill can be modified by its author, which may, in turn, lead to unexpected behavior.

Importing a skill from the catalog

  1. Open the SourceCraft home page.

  2. Click Browse AI skills in the top center section.

  3. Select the skill you want to import.

    You can search by name or keyword and sort skills by command or name.

  4. Click Import in the skill card.

    The catalog also displays system skills which you cannot import as they are available in any repository by default.

    Tip

    To test a skill, click Launch.

  5. Select the repository you want to import the skill into.

  6. Review the skill's instructions and parameters.

  7. Optionally, set Additional instructions for model and Launch parameters.

  8. Click Save.

  9. In the window that opens:

    • In the Commit message field, give a comment that will describe the changes you make.
    • Under Commit branch, select the branch you want to change. Create a new branch as needed.
    • Under After commit action, select an action to take after saving changes: Save and create a new change proposal or Just save.
  10. Confirm your changes.

  11. Test the skill.

Importing a public skill

  1. In the repository you want to import the skill into, create a file named .sourcecraft/ai.yaml with the following contents:

    skills:
      - source:
          repo: <organization_slug>/<repository_slug>
          path: .sourcecraft/skills/<command_to_run>
        settings:
          instructions: |-
            <additional_instructions>
          inputs:
            <parameter>: <default_value>
    

    Where:

    • source.repo: Path to the public repository you are importing a skill from, e.g., examples/skills.
    • source.path: Path to the directory housing the skill, e.g., .sourcecraft/skills/issue-summary.
    • settings.instructions: Additional instructions for the agent, e.g., Return results in English only.
    • settings.inputs: Default skill settings, e.g., config_type: Brach rules.
  2. Test the skill.

Configuring a system skill or imported skill

You can configure additional instructions and default parameters for system and public skills, or skills from the catalog:

  1. Open the SourceCraft home page.

  2. On the Home tab, under Your craftspace, navigate to Repositories.

  3. Select the repository you want to configure a skill in.

  4. Under CI/CD, navigate to AI.

  5. Click next to the skill you want to configure.

  6. Set Additional instructions for model and Launch parameters.

  7. Click Save.

  8. In the window that opens:

    • In the Commit message field, give a comment that will describe the changes you make.
    • Under Commit branch, select the branch you want to change. Create a new branch as needed.
    • Under After commit action, select an action to take after saving changes: Save and create a new change proposal or Just save.
  9. Confirm your changes.

Creating a custom skill

  1. Open the SourceCraft home page.

  2. On the Home tab, under Your craftspace, navigate to Repositories.

  3. Select the repository you want to create a skill in.

  4. Under CI/CD, navigate to AI.

  5. In the top-right corner, click New AI skill.

  6. In the window that opens, set the following:

    • Name you are going to see in the SourceCraft interface, e.g., Issue summary.

    • Description, e.g., Creates a brief summary of the issue. Use for a quick look into large issues or issues with extensive threads of comments.

    • Launch command, e.g., issue-summary.

    • Description for model: Text instructions for the agent in Markdown markup.

      Tip

      For examples of skills, see these repositories: sourcecraft/ai and examples/skills.

  7. Optionally, under Launch parameters, click Add parameter and configure it:

    1. Select the parameter type:
      • String.
      • Choice. Add possible options for this parameter type.
      • Boolean.
    2. Enter a name for the parameter.
    3. Optionally, select or set the default parameter value.
    4. Optionally, enter the parameter description.
    5. Specify if this is a required parameter.

    To add another parameter, click Add parameter.

    Note

    In text instructions for the agent, parameters are specified in {{ <parameter_name>}} format.

  8. Click Save.

  9. In the window that opens:

    • In the Commit message field, give a comment that will describe the changes you make.
    • Under Commit branch, select the branch you want to change. Create a new branch as needed.
    • Under After commit action, select an action to take after saving changes: Save and create a new change proposal or Just save.
  10. Confirm your changes.

  11. Test the skill.

Editing a custom skill

  1. Open the SourceCraft home page.

  2. On the Home tab, under Your craftspace, navigate to Repositories.

  3. Select the repository you want to edit a custom skill in.

  4. Under CI/CD, navigate to AI.

  5. Next to the custom skill to edit, click and select Edit.

  6. Edit the custom parameter settings. For more information, see Creating a custom skill.

  7. Click Save.

  8. In the window that opens:

    • In the Commit message field, give a comment that will describe the changes you make.
    • Under Commit branch, select the branch you want to change. Create a new branch as needed.
    • Under After commit action, select an action to take after saving changes: Save and create a new change proposal or Just save.
  9. Confirm your changes.

Deleting a custom or imported skill

  1. Open the SourceCraft home page.

  2. On the Home tab, under Your craftspace, navigate to Repositories.

  3. Select the repository you want to delete a skill in.

  4. Under CI/CD, navigate to AI.

  5. Next to the skill to delete, click and select Delete.

  6. In the window that opens:

    • In the Commit message field, give a comment that will describe the changes you make.
    • Under Commit branch, select the branch you want to change. Create a new branch as needed.
    • Under After commit action, select an action to take after saving changes: Save and create a new change proposal or Just save.
  7. Confirm your changes.

See also