Skip to content

LCORE-2072: Add SkillsConfiguration model to config file#1736

Open
anik120 wants to merge 1 commit into
lightspeed-core:mainfrom
anik120:skills-configuration-model
Open

LCORE-2072: Add SkillsConfiguration model to config file#1736
anik120 wants to merge 1 commit into
lightspeed-core:mainfrom
anik120:skills-configuration-model

Conversation

@anik120
Copy link
Copy Markdown
Contributor

@anik120 anik120 commented May 13, 2026

Description

Adds the SkillsConfiguration Pydantic model to enable configuring skill directory paths in lightspeed-stack.yaml. This is the first step in implementing Agent Skills support.

For more info, refer to docs/design/agent-skills/agent-skills.md.

Scope: This PR adds only the configuration model. Runtime skill loading (load_skills(), frontmatter parsing, tool registration) will be implemented in follow-up commits.

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement
  • Benchmarks improvement

Tools used to create PR

  • Assisted-by: Claude

Related Tickets & Documents

  • Related Issue #
  • Closes #

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

Summary by CodeRabbit

  • New Features

    • Users can now configure skills in their setup with multiple path support
    • Example configuration file provided demonstrating skills configuration alongside user data collection and authentication settings
  • Tests

    • Added unit tests validating skills configuration models and path handling

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

Warning

Rate limit exceeded

@anik120 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 36 minutes and 20 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 21970b28-2ec5-44ce-ba15-e43cf8fc8177

📥 Commits

Reviewing files that changed from the base of the PR and between ac7fa4d and 7203706.

📒 Files selected for processing (5)
  • docs/openapi.json
  • examples/lightspeed-stack-skills.yaml
  • src/models/config.py
  • tests/unit/models/config/test_dump_configuration.py
  • tests/unit/models/config/test_skills_configuration.py

Walkthrough

This PR adds a skills configuration feature to the Lightspeed Core Service. It introduces a SkillsConfiguration model to manage skill directory paths, integrates it into the global configuration system, provides comprehensive unit tests, and includes a complete example configuration demonstrating the feature.

Changes

Skills Configuration Feature

Layer / File(s) Summary
Skills Configuration Model and Integration
src/models/config.py
SkillsConfiguration model is defined with a paths: list[str] field for directory paths, integrated into the global Configuration model as an optional skills section. Documentation describes SKILL.md-based metadata discovery and validation.
Skills Configuration Tests and Example
tests/unit/models/config/test_skills_configuration.py, examples/lightspeed-stack-skills.yaml
Four unit test methods validate model behavior: empty paths lists, rejection of unknown fields, multiple path entries, and mixed absolute/relative paths. A complete YAML example demonstrates skills configuration usage with /var/skills/ directory paths in library-client mode.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: adding a SkillsConfiguration model to the config file. It's concise, clear, and directly reflects the primary objective of the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment on lines +39 to +47
def test_mixed_absolute_and_relative_paths(self) -> None:
"""Test that both absolute and relative paths can be mixed."""
config = SkillsConfiguration(
paths=["/var/skills", "./local-skills", "/opt/skills"]
)
assert len(config.paths) == 3
assert "/var/skills" in config.paths
assert "./local-skills" in config.paths
assert "/opt/skills" in config.paths
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@radofuchs what do you think about this test? From the code's perspective, absolute/relative doesn't matter. It's just "str" at the end of the day - but I added this coz it signals that we'll work with both absolute and relative path - ie this is my attempt at BDD :)

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/models/config.py`:
- Around line 1932-1936: Add validation for the paths field by adding Pydantic
validators for the paths attribute: implement a `@field_validator`("paths",
mode="before", each_item=True) that strips each string and raises ValueError for
blank/whitespace entries, and implement a second `@field_validator`("paths",
mode="after") that deduplicates the list while preserving order (e.g., using an
ordered set pattern) and returns the normalized list; reference the existing
paths: list[str] Field declaration and ensure all validators are annotated and
use Pydantic v2 style `@field_validator` for the "paths" field.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1ec5373b-046b-4cad-bd80-096b14aafda0

📥 Commits

Reviewing files that changed from the base of the PR and between cf6c749 and ac7fa4d.

📒 Files selected for processing (3)
  • examples/lightspeed-stack-skills.yaml
  • src/models/config.py
  • tests/unit/models/config/test_skills_configuration.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
🧰 Additional context used
📓 Path-based instructions (3)
tests/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.py: Use pytest for all unit and integration tests; do not use unittest
Use pytest.mark.asyncio marker for async tests

Files:

  • tests/unit/models/config/test_skills_configuration.py
src/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.py: Use absolute imports for internal modules: from authentication import get_auth_dependency
Llama Stack imports: Use from llama_stack_client import AsyncLlamaStackClient
Check constants.py for shared constants before defining new ones
All modules must start with descriptive docstrings explaining purpose
Use logger = get_logger(__name__) from log.py for module logging
All functions must have complete type annotations for parameters and return types, use modern syntax (str | int), and include descriptive docstrings
Use snake_case with descriptive, action-oriented names for functions (get_, validate_, check_)
Avoid in-place parameter modification anti-patterns; return new data structures instead of modifying function parameters
Use async def for I/O operations and external API calls
Use standard log levels with clear purposes: debug() for diagnostic info, info() for program execution, warning() for unexpected events, error() for serious problems
All classes must have descriptive docstrings explaining purpose and use PascalCase with standard suffixes: Configuration, Error/Exception, Resolver, Interface
Abstract classes must use ABC with @abstractmethod decorators
Follow Google Python docstring conventions with required sections: Parameters, Returns, Raises, and Attributes for classes

Files:

  • src/models/config.py
src/models/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Pydantic models must use @model_validator and @field_validator for validation and complete type annotations for all attributes, avoiding Any type

Files:

  • src/models/config.py
🧠 Learnings (2)
📚 Learning: 2026-01-12T10:58:40.230Z
Learnt from: blublinsky
Repo: lightspeed-core/lightspeed-stack PR: 972
File: src/models/config.py:459-513
Timestamp: 2026-01-12T10:58:40.230Z
Learning: In lightspeed-core/lightspeed-stack, for Python files under src/models, when a user claims a fix is done but the issue persists, verify the current code state before accepting the fix. Steps: review the diff, fetch the latest changes, run relevant tests, reproduce the issue, search the codebase for lingering references to the original problem, confirm the fix is applied and not undone by subsequent commits, and validate with local checks to ensure the issue is resolved.

Applied to files:

  • src/models/config.py
📚 Learning: 2026-02-25T07:46:33.545Z
Learnt from: asimurka
Repo: lightspeed-core/lightspeed-stack PR: 1211
File: src/models/responses.py:8-16
Timestamp: 2026-02-25T07:46:33.545Z
Learning: In the Python codebase, requests.py should use OpenAIResponseInputTool as Tool while responses.py uses OpenAIResponseTool as Tool. This difference is intentional due to differing schemas for input vs output tools in llama-stack-api. Apply this distinction consistently to other models under src/models (e.g., ensure request-related tools use the InputTool variant and response-related tools use the ResponseTool variant). If adding new tools, choose the corresponding InputTool or Tool class based on whether the tool represents input or output, and document the rationale in code comments.

Applied to files:

  • src/models/config.py
🔇 Additional comments (3)
src/models/config.py (1)

2099-2103: LGTM!

tests/unit/models/config/test_skills_configuration.py (1)

1-48: LGTM!

examples/lightspeed-stack-skills.yaml (1)

1-32: LGTM!

Comment thread src/models/config.py
Comment on lines +1932 to +1936
paths: list[str] = Field(
default_factory=list,
title="Skill paths",
description="Paths to skill directories or directories containing skill subdirectories.",
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add validation for individual skills.paths entries.

skills.paths currently accepts blank/whitespace and duplicate values, which can lead to ambiguous or invalid path handling later. Add a field validator to normalize and reject invalid entries.

Suggested patch
 class SkillsConfiguration(ConfigurationBase):
@@
     paths: list[str] = Field(
         default_factory=list,
         title="Skill paths",
         description="Paths to skill directories or directories containing skill subdirectories.",
     )
+
+    `@field_validator`("paths")
+    `@classmethod`
+    def validate_paths(cls, value: list[str]) -> list[str]:
+        """Normalize and validate configured skill paths."""
+        seen: set[str] = set()
+        normalized_paths: list[str] = []
+        for path in value:
+            normalized = path.strip()
+            if not normalized:
+                raise ValueError("Skill paths must not contain empty values")
+            if normalized in seen:
+                raise ValueError(f"Duplicate skill path: '{normalized}'")
+            seen.add(normalized)
+            normalized_paths.append(normalized)
+        return normalized_paths

As per coding guidelines: src/models/**/*.py: “Pydantic models must use @model_validator and @field_validator for validation and complete type annotations for all attributes, avoiding Any type”.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/models/config.py` around lines 1932 - 1936, Add validation for the paths
field by adding Pydantic validators for the paths attribute: implement a
`@field_validator`("paths", mode="before", each_item=True) that strips each string
and raises ValueError for blank/whitespace entries, and implement a second
`@field_validator`("paths", mode="after") that deduplicates the list while
preserving order (e.g., using an ordered set pattern) and returns the normalized
list; reference the existing paths: list[str] Field declaration and ensure all
validators are annotated and use Pydantic v2 style `@field_validator` for the
"paths" field.

# Skills provide domain-specific instructions and reference materials
# that the LLM can load on demand when relevant to the current task
skills:
paths:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason that we need the paths? It would make sense if we had other data fields under skills but if paths is the only one then I think skills can just be a list. wdyt?

Copy link
Copy Markdown
Contributor Author

@anik120 anik120 May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I think that makes total sense. I was going off of what's here https://github.com/lightspeed-core/lightspeed-stack/blob/main/docs/design/agent-skills/agent-skills.md#configuration

but I do remember this discussion and AFAIR we'd decided we don't need path. I'll update the design doc too

Based on further discussions:

It's a little weird to look at now, but the current layout is the safest approach - I can't think of anything else that might be needed under the skills tab (eg, settings etc), but keeping it tabbe-ed future proofs it so keeping it as is

Adds the `SkillsConfiguration` Pydantic model to enable configuring skill
directory paths in `lightspeed-stack.yaml`. This is the first step in
implementing Agent Skills support.

For more info, refer to `docs/design/agent-skills/agent-skills.md`.

**Scope**: This PR adds only the configuration model.
Runtime skill loading (`load_skills()`, frontmatter parsing, tool registration)
will be implemented in follow-up commits.

Signed-off-by: Anik Bhattacharjee <anbhatta@redhat.com>
@anik120 anik120 force-pushed the skills-configuration-model branch from ac7fa4d to 7203706 Compare May 13, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants