ask-skills 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a4229cd07f55413b7de34a7463c2f582aac94898d804e8017cb9c0c02f2117b
4
- data.tar.gz: d5c96783d0bbd7b5a9a79af85a1c33bdc59f5ffa41f9a612ff24fd61ccea37ef
3
+ metadata.gz: 865bd7d0c3e8690a68427e17e2aa43a18a8989121efde557e0286aaa164dcb92
4
+ data.tar.gz: f055f61588d77a5db7c7feb69e947d1ad8f67380dda23eb5ae79e0ea2befa3d2
5
5
  SHA512:
6
- metadata.gz: 10c8342db4297f6d9417be6b63beb7962cd93a0476b421e15c736660a51ccde2c93141ecf6740f53755be02c0371c914ccf1a617759037964810dca38ab37c42
7
- data.tar.gz: b5f26a5d36086ab1b918375672215fc9e7875ad5a58d43e149a4f744bf4841478bf2bdc1e20a29f9bd8d5f32769680605fe5fd4181cea1cd7b9e4e7d46c5b40b
6
+ metadata.gz: 86fd99532c1c93c1bd43b66931a626ecd2478fc22dae6668ee1902441bfaef6b643cfc7008d952a5a7e43be63b44de0fa876f914d2e30980dff531312f9c1445
7
+ data.tar.gz: 7c49b38d6ac9678f051b85eed6f3b4841536e38861fcd8ee012556376fe3857033dd915844a53c05f549e5724da2dc1b5a3c003634ea8aa7e977cc0b8e89d1af
data/CHANGELOG.md CHANGED
@@ -1,28 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.0] - 2026-06-10
4
+
5
+ ### Added
6
+ - Skills shipped with methodology gems (ask-rails, ask-github, ask-slack,
7
+ ask-tools-shell, ask-llm-providers) — 8 skills total
8
+ - `Ask::Skills.load_file(path)` — load any markdown file as an ad-hoc skill
9
+ - ask-agent integration: auto-discovery and system prompt injection on
10
+ `Ask::Agent::Session` initialization
11
+ - `session.skill(name)` — load a skill by name (or file path) and inject
12
+ its full instructions into the conversation
13
+
14
+ ### Changed
15
+ - `Ask::Skills.discover` now discovers skills from methodology gem gems too
16
+ (via `Gem.find_files`)
17
+
3
18
  ## [0.1.0] - 2026-06-10
4
19
 
5
20
  ### Added
6
21
  - Initial release
7
22
  - `Ask::Skills::Skill` — Data.define with name, description, instructions, source
8
- - `to_s` and `to_prompt_entry` formatting methods
9
- - `Ask::Skills::Registry` — holds discovered skills with:
10
- - `[]` lookup, `names` list, `format_for_prompt` markdown output
11
- - Priority resolution: first source wins
23
+ - `Ask::Skills::Registry` holds discovered skills
12
24
  - `Ask::Skills::Formatter` — generates markdown and XML output
13
25
  - `Ask::Skills::Validator` — validates required fields, name format, duplicates
14
- - `Ask::Skills.discover` — discover skills from all configured sources:
15
- 1. Project-local (`.agents/skills/`) highest priority
16
- 2. User-global (`~/.config/ask/skills/`)
17
- 3. Installed gems (via `Gem.find_files`)
18
- 4. Built-in (skill.design, skill.compose) — lowest priority
19
- - `Ask::Skills::Source::Filesystem` — scan a directory for `*/SKILL.md` files
20
- - `Ask::Skills::Source::Gems` — discover skills from all installed gems
21
- - Built-in skills:
22
- - `skill.design` — How to design and write effective skills
23
- - `skill.compose` — How skills interact, combine, and resolve
26
+ - `Ask::Skills.discover` — discover skills from all configured sources
27
+ - Built-in skills (skill.design, skill.compose)
24
28
  - Full test suite with 68 tests
25
- - Frontmatter parsing (name, description, optional metadata)
26
- - YAML frontmatter support with quoted value handling
27
- - Error handling for missing directories, malformed skills
28
- - Thread-safe read-only registry access
@@ -1,5 +1,5 @@
1
1
  module Ask
2
2
  module Skills
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
data/lib/ask/skills.rb CHANGED
@@ -36,6 +36,56 @@ module Ask
36
36
  # The skill directories are in lib/ask/skills/
37
37
  File.join(__dir__, "skills")
38
38
  end
39
+
40
+ # Load a skill from an arbitrary markdown file path.
41
+ # Parses frontmatter if present, otherwise uses the filename as the skill name.
42
+ #
43
+ # @param path [String] absolute or relative path to a markdown (.md) file
44
+ # @return [Skill] a skill with the file's content as instructions
45
+ # @raise [Errno::ENOENT] if the file does not exist
46
+ def load_file(path)
47
+ path = File.expand_path(path)
48
+ content = File.read(path)
49
+ frontmatter = parse_frontmatter(content)
50
+ body = extract_body(content)
51
+
52
+ name = frontmatter["name"] || File.basename(path, ".md")
53
+ description = frontmatter["description"] || "Ad-hoc skill loaded from #{File.basename(path)}"
54
+
55
+ Skill.new(
56
+ name: name,
57
+ description: description,
58
+ instructions: body.empty? ? content : body,
59
+ source: path
60
+ )
61
+ end
62
+
63
+ # Simple frontmatter parsing for skill files.
64
+ # Returns a hash of key-value pairs from between --- markers.
65
+ def parse_frontmatter(content)
66
+ return {} unless content.start_with?("---\n")
67
+ end_idx = content.index("\n---\n", 4)
68
+ return {} unless end_idx
69
+ yaml_str = content[4...end_idx]
70
+ yaml = {}
71
+ yaml_str.split("\n").each do |line|
72
+ if (m = line.match(/\A(\w+):\s*(.+)\z/))
73
+ value = m[2].strip
74
+ value = value.gsub(/\A"|"\z/, "").gsub(/\A'|'\z/, "")
75
+ yaml[m[1]] = value
76
+ end
77
+ end
78
+ yaml
79
+ end
80
+
81
+ # Extract the markdown body from a file with frontmatter.
82
+ def extract_body(content)
83
+ return content unless content.start_with?("---\n")
84
+ end_idx = content.index("\n---\n", 4)
85
+ return content unless end_idx
86
+ body = content[(end_idx + 5)..] || ""
87
+ body.sub(/\A\n/, "").strip
88
+ end
39
89
  end
40
90
  end
41
91
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-skills
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto