Skip to content

cmd: add --no-skills, --skill, and --skills-dir CLI flags & config#55

Merged
ezynda3 merged 5 commits into
mark3labs:masterfrom
kskarthik:skills
Jun 12, 2026
Merged

cmd: add --no-skills, --skill, and --skills-dir CLI flags & config#55
ezynda3 merged 5 commits into
mark3labs:masterfrom
kskarthik:skills

Conversation

@kskarthik

@kskarthik kskarthik commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

The pkg/kit Options struct already had full backend support for skills control (NoSkills, Skills []string, SkillsDir) wired into loadSkills() in pkg/kit/kit.go, but there were no corresponding CLI flags to drive them. This commit closes that gap.

Changes in cmd/root.go:

  • Add three package-level flag variables alongside the existing noExtensionsFlag/extensionPaths group: noSkillsFlag bool skillsPaths []string
    skillsDir string

  • Register three persistent cobra flags in init():
    --no-skills disable skill loading (auto-discovery and explicit)
    --skill load a skill file or directory (repeatable)
    --skills-dir

    override the project-local skills directory
    used for auto-discovery

  • Wire all three into the kitOpts struct literal in runNormalMode() so they flow directly into kit.New() -> loadSkills().

No changes to pkg/kit or internal/skills -- the backend was already complete. No viper binding is needed because kit.go reads these fields directly from opts rather than from viper (unlike NoExtensions which uses the viper fallback path).

Example usage:
kit --no-skills "prompt"
kit --skill ./my-skill.md --skill ./other-skill.md "prompt"
kit --skills-dir /path/to/skills "prompt"

Summary by CodeRabbit

  • New Features

    • Added CLI flags to control skill loading: --no-skills to disable loading, repeatable --skill to specify one or more skill sources, and --skills-dir to set a custom auto-discovery directory.
    • CLI flags and config now merge at startup so skill sources can come from flags or config.
  • Documentation

    • Updated configuration and CLI docs to describe the new skill-related options, defaults, and behavior.

The pkg/kit Options struct already had full backend support for skills
control (NoSkills, Skills []string, SkillsDir) wired into loadSkills()
in pkg/kit/kit.go, but there were no corresponding CLI flags to drive
them. This commit closes that gap.

Changes in cmd/root.go:

- Add three package-level flag variables alongside the existing
  noExtensionsFlag/extensionPaths group:
    noSkillsFlag bool
    skillsPaths  []string
    skillsDir    string

- Register three persistent cobra flags in init():
    --no-skills        disable skill loading (auto-discovery and explicit)
    --skill <path>     load a skill file or directory (repeatable)
    --skills-dir <dir> override the project-local skills directory
                       used for auto-discovery

- Wire all three into the kitOpts struct literal in runNormalMode()
  so they flow directly into kit.New() -> loadSkills().

No changes to pkg/kit or internal/skills -- the backend was already
complete. No viper binding is needed because kit.go reads these fields
directly from opts rather than from viper (unlike NoExtensions which
uses the viper fallback path).

Example usage:
  kit --no-skills "prompt"
  kit --skill ./my-skill.md --skill ./other-skill.md "prompt"
  kit --skills-dir /path/to/skills "prompt"

Co-authored-by: Claude <claude@anthropic.com>
@mark-iii-labs-huly

Copy link
Copy Markdown

Connected to Huly®: KIT-56

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds three CLI flags and corresponding config keys to control KIT skill loading: --no-skills (disable), --skill (repeatable explicit paths), and --skills-dir (auto-discovery directory override). Flags are declared, bound into viper, forwarded into kit.Options, and New() resolves options from viper+opts; docs and config reference updated.

Changes

Skills CLI Flags and Option Wiring

Layer / File(s) Summary
Skills CLI flags and SDK option wiring
cmd/root.go
Declares package-level variables for skills control (noSkillsFlag, skillsPaths, skillsDir), registers three new persistent CLI flags (--no-skills, --skill, --skills-dir), binds them into viper, and wires these values into kit.Options during SDK construction.
SDK option resolution for skills
pkg/kit/kit.go
New() now resolves NoSkills, Skills, and SkillsDir by merging explicit opts with the populated viper store; when skills are enabled it loads from the merged options, otherwise it skips loading.
Documentation and configuration reference
README.md, www/pages/cli/commands.md, www/pages/cli/flags.md, www/pages/configuration.md
Adds "Skills" keys to the README example, a "Skills" subsection to CLI docs and flags reference, and updates the configuration keys table with no-skills, skill, and skills-dir.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • mark3labs/kit#37: Touches overlapping skills initialization and system-prompt composition code.

Poem

🐰 I found a flag beneath the log,
--skill to show the path to jog,
--no-skills hushes every tune,
--skills-dir points to the moon,
Kit hops on, commands all agog.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.
Title check ✅ Passed The PR title accurately describes the primary changes: adding three new CLI flags (--no-skills, --skill, --skills-dir) and corresponding configuration support for skills-loading control.

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

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

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.

Add the three new skills CLI flags to all relevant documentation:

- README.md: add Skills section under Global Flags CLI reference
- www/pages/cli/flags.md: add Skills table (mirrors Extensions section pattern)
- www/pages/cli/commands.md: expand the Skills section with usage examples
  and a description of auto-discovery vs explicit loading vs --no-skills

Co-authored-by: Claude <claude@anthropic.com>
@kskarthik

Copy link
Copy Markdown
Contributor Author

would it be nice to have a config option too?

@ezynda3

ezynda3 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

would it be nice to have a config option too?

Yes I think so since you already have the plumbing for this

kskarthik and others added 3 commits June 11, 2026 19:40
Skills could previously only be controlled via CLI flags or SDK Options
fields. This commit wires all three skills settings into viper so they
can also be set in .kit.yml / .kit.yaml / .kit.json and via KIT_*
environment variables — matching the pattern used by no-extensions,
no-core-tools, and prompt-template.

cmd/root.go:
- Bind --no-skills, --skill, and --skills-dir flags to viper keys
  (no-skills, skill, skills-dir) so config file values flow through.

pkg/kit/kit.go:
- At skill-load time, merge opts fields with viper values:
  - noSkills = opts.NoSkills || v.GetBool("no-skills")
  - skillPaths: opts.Skills if non-empty, else v.GetStringSlice("skill")
  - skillsDir: opts.SkillsDir if non-empty, else v.GetString("skills-dir")
- Build a shallow-copied mergedOpts so loadSkills() picks up the
  resolved values without mutating the original Options struct.

docs:
- README.md: add skills keys to the Basic Configuration YAML example
- www/pages/configuration.md: add no-skills, skill, skills-dir rows to
  the All configuration keys table

Config file example (.kit.yml):
  no-skills: false
  skill:
    - /path/to/skill.md
  skills-dir: /path/to/skills/

Co-authored-by: Claude <claude@anthropic.com>
Add no-skills, skill, and skills-dir as commented-out examples in the
default config file generated by EnsureConfigExists(), alongside the
existing application settings block.

Co-authored-by: Claude <claude@anthropic.com>
Four test locations updated:

pkg/kit/export_test.go:
- Add ConfigStringSliceForTest() helper to expose v.GetStringSlice()
  from the Kit's isolated viper store, needed to assert skill list values.

pkg/kit/kit_test.go (TestNewWithSkillsOptions):
- NoSkills=true: GetSkills() returns empty slice
- SkillsDir=<empty dir>: kit.New() succeeds with zero skills
- Skills=[file]: single explicit skill file is loaded and name parsed correctly

pkg/kit/viper_isolation_test.go:
- TestSkillsViperKeys: no-API-key struct-level checks for NoSkills, Skills,
  and SkillsDir fields on Options
- TestSkillsConfigFileKeys: full kit.New() round-trips via a written .kit.yml
  for each of the three config keys:
    no-skills: true  → GetSkills() returns empty
    skill: [path]    → named skill loaded from config file path
    skills-dir: dir  → custom discovery root accepted without error

internal/config/config_test.go (TestEnsureConfigExists):
- Assert generated ~/.kit.yml template contains '# Skills configuration',
  'no-skills:', and 'skills-dir:' comment blocks.

Co-authored-by: Claude <claude@anthropic.com>
@kskarthik kskarthik changed the title cmd: add --no-skills, --skill, and --skills-dir CLI flags cmd: add --no-skills, --skill, and --skills-dir CLI flags & config Jun 11, 2026
@kskarthik

Copy link
Copy Markdown
Contributor Author

@ezynda3 please review!

@ezynda3 ezynda3 merged commit 7f366ea into mark3labs:master Jun 12, 2026
3 checks passed
@kskarthik kskarthik deleted the skills branch June 12, 2026 15:09
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