Skip to content

[rust] Add a skills flag that will install a skills.md file#17364

Merged
AutomatedTester merged 7 commits into
trunkfrom
sel-cli-skills
Apr 27, 2026
Merged

[rust] Add a skills flag that will install a skills.md file#17364
AutomatedTester merged 7 commits into
trunkfrom
sel-cli-skills

Conversation

@AutomatedTester

Copy link
Copy Markdown
Member

The file will be installed into the repo for people to be able to guide the LLM with good practises.

🔗 Related Issues

This is a feature from #17326

💥 What does this PR do?

🔧 Implementation Notes

💡 Additional Considerations

🔄 Types of changes

  • New feature (non-breaking change which adds functionality and tests!)

The file will be installed into the repo for people to be able to
guide the LLM with good practises.
Copilot AI review requested due to automatic review settings April 20, 2026 10:42
@selenium-ci selenium-ci added C-rust Rust code is mostly Selenium Manager B-manager Selenium Manager labels Apr 20, 2026

Copilot AI left a comment

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.

Pull request overview

Adds a new Selenium Manager CLI flag to generate a skills.md file in the current working directory, intended to provide Selenium language examples and best practices for guiding LLM usage.

Changes:

  • Introduces --init-skills CLI flag to create skills.md and exit.
  • Adds a new skills module containing the embedded markdown content and file-writing helper.
  • Adds an integration test to verify skills.md creation and expected contents.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
rust/src/main.rs Adds --init-skills flag handling and calls the skills file writer before normal execution flow.
rust/src/skills.rs Implements the embedded SKILLS_CONTENT markdown and write_skills_file helper.
rust/src/lib.rs Exposes the new skills module from the library crate.
rust/tests/skills_tests.rs Adds an integration test validating skills.md creation and content markers.

Comment thread rust/src/main.rs Outdated
Comment thread rust/src/main.rs Outdated
Comment thread rust/src/skills.rs
Comment thread rust/tests/skills_tests.rs Outdated
- Consolidate Logger initialization in main.rs
- Ensure proper flushing and exit code in early-exit paths
- Prevent overwriting existing skills.md file
- Use temporary directory for integration tests to avoid state leakage
- Fix binary path resolution when tests change current directory
- Change --init-skills to take an optional file name
- Default path to skills/skills.md
- Fallback to selenium.md if default exists
- Create parent directories if they don't exist
- Update integration tests to cover new logic

Copilot AI left a comment

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.

Pull request overview

Adds a new Selenium Manager CLI flag to initialize a repository “skills” guide file (markdown) containing Selenium best practices, along with integration tests to validate default, fallback, and no-overwrite behaviors.

Changes:

  • Add --init-skills [FILE_NAME] flag that writes a skills guide to skills/skills.md by default (or a custom path).
  • Implement skills module with embedded guide content and safe file creation (no clobbering).
  • Add integration tests for default creation, fallback naming, and overwrite protection; adjust test binary path resolution for current_dir usage.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
rust/src/main.rs Adds CLI flag handling and early-exit flow to write the skills file.
rust/src/skills.rs Introduces embedded guide content and write_skills_file helper.
rust/src/lib.rs Exposes the new skills module from the library crate.
rust/tests/common.rs Makes the test binary path absolute so cmd.current_dir(...) won’t break execution.
rust/tests/skills_tests.rs Adds integration coverage for default, fallback, custom name, and no-overwrite cases.

Comment thread rust/src/skills.rs Outdated

@bonigarcia bonigarcia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with Copilot about not hardcoding the skill content within a Rust variable (SKILLS_CONTENT). But instead of a local MD file read by Rust, I propose creating an MD file with that content, committing it to our GitHub repository, and having Selenium Manager read it via a raw.githubusercontent.com URL. For example, something similar is already done in firefox.rs with this URL:

const DRIVER_VERSIONS_URL: &str = "https://raw.githubusercontent.com/SeleniumHQ/selenium/trunk/common/geckodriver/geckodriver-support.json";

The content of that URL can be easily read in SM with one line:

let content = read_content_from_link(http_client, url)?;

This way, we can maintain the skills independently of the SM release.

@AutomatedTester

Copy link
Copy Markdown
Member Author

@bonigarcia I pushed without looking at your comment moving things into a resource that we can ship. Part of me prefers that so that we can be faster at writing since we don't need to be changing this as often as the Firefox code.

Copilot AI review requested due to automatic review settings April 20, 2026 16:34

Copilot AI left a comment

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.

Pull request overview

Adds a new Selenium Manager CLI option to initialize a repository-local “skills” markdown guide (embedded in the binary) and validates the behavior with new Rust integration tests.

Changes:

  • Introduces --init-skills [FILE_NAME] to write an embedded skills/best-practices document into the current working directory (with fallback naming to avoid overwrites).
  • Adds a new skills module embedding src/resources/skills.md and a helper to write it safely (no clobbering).
  • Adds integration tests for default, fallback, custom filename, and no-overwrite behaviors; improves test binary path resolution.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
rust/src/main.rs Adds the --init-skills CLI flow and exits after creating the file.
rust/src/skills.rs Implements file creation with create_new(true) and embeds the markdown content.
rust/src/resources/skills.md New end-user guidance content to be written by the flag.
rust/src/lib.rs Exposes the new skills module from the library crate.
rust/tests/skills_tests.rs New integration tests covering default/fallback/custom/no-overwrite scenarios.
rust/tests/common.rs Makes the resolved test binary path absolute when needed.
rust/BUILD.bazel Ensures Bazel compilation can see the embedded markdown via compile_data.

Comment thread rust/src/resources/skills.md Outdated
Comment thread rust/BUILD.bazel
Comment thread rust/src/skills.rs Outdated
@iampopovich

Copy link
Copy Markdown
Contributor

@AutomatedTester
I suggest keeping these three elements separate:
• Skills (describe WHAT to do)
• Rules (describe HOW to do it + set boundaries)
• Agents (describe the roles of the executors)
Adding skills separately won’t give a noticeable boost to the LLM’s performance. Making skills a standalone command doesn’t seem efficient to me either. I’d recommend looking into CLI tools that deploy everything at once, or agent frameworks like BMAD or Hermes-agent. When you initialize the CLI tooling, it automatically sets up a full network of agents with predefined roles and skills.
This approach is fine as a starting point, but in my view, we should design a single unified environment for all parts of AI-driven development from day one.
The structure should be split as follows:
• Skills: page-object-model-processing.md, test-implementation.md, etc.
• Agents: already exist in every binding.
• Rules: guidelines we want agents to always follow, e.g., selector-usage-policy.md, selenium-manager-usage-policy.md, etc.
• Examples: java-test.md, csharp-test.md, java-package-install.md, etc.
This kind of granular file storage is much easier for LLMs to process. Finding a reference to a specific skill or rule in a small, focused file is far simpler than tokenizing and parsing one large, monolithic rules document.

@AutomatedTester

Copy link
Copy Markdown
Member Author

That is my plan. The documents are going to be somewhat living for the next few iterations

@AutomatedTester AutomatedTester merged commit 97ec921 into trunk Apr 27, 2026
64 of 66 checks passed
@AutomatedTester AutomatedTester deleted the sel-cli-skills branch April 27, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-manager Selenium Manager C-rust Rust code is mostly Selenium Manager

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants