main
md 53 lines 3.16 KB
Rendered Raw
1 # skills_cli.py DOX
2
3 ## Purpose
4
5 - Own the `skills_cli.py` helper module.
6 - This module provides command-line skill listing, search, validation, and creation helpers.
7 - Keep this file-level DOX profile synchronized with `skills_cli.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `skills_cli.py` owns the runtime implementation.
12 - `skills_cli.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Reuses `helpers.skills.Skill` rather than maintaining a CLI-specific model.
14 - Top-level functions:
15 - `get_skills_dirs() -> list[Path]`: Get all skill directories
16 - `parse_skill_file(skill_path: Path) -> Skill | None`: Parse a SKILL.md file and return a Skill object
17 - `list_skills() -> list[Skill]`: List all available skills
18 - `find_skill(name: str) -> Skill | None`: Find a skill by name
19 - `search_skills(query: str) -> list[Skill]`: Search skills by name, description, or tags
20 - `validate_skill(skill: Skill) -> list[str]`: Validate a skill and return list of issues
21 - `create_skill(name: str, description: str=..., author: str=...) -> Path`: Create a new skill from template
22 - `print_skill_table(skills: list[Skill])`: Print skills in a formatted table
23 - `main()`
24
25 ## Runtime Contracts
26
27 - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together.
28 - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change.
29 - Skill discovery, parsing, search, and validation delegate to `helpers.skills` so CLI behavior matches the runtime contract.
30 - CLI lookup disables eager validation so the `validate` command can report incomplete metadata through the canonical validator.
31 - Created skills use the canonical `triggers` frontmatter field.
32 - Observed side-effect areas: filesystem reads, filesystem writes, settings/state persistence, secret handling.
33 - Imported dependency areas include: `argparse`, `helpers`, `pathlib`, `sys`.
34
35 ## Key Concepts
36
37 - Important called helpers/classes observed in the source: `skills.get_skill_roots`, `skills.skill_from_markdown`, `skills.list_skills`, `skills.find_skill`, `skills.search_skills`, `skills.validate_skill`, `Path`, `custom_dir.mkdir`, `skill_dir.exists`, `skill_dir.mkdir`, `skill_file.write_text`, `readme.write_text`, `argparse.ArgumentParser`, `parser.add_subparsers`, `subparsers.add_parser`.
38 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
39
40 ## Work Guidance
41
42 - Preserve public helper APIs used by core code and plugins unless every caller is updated.
43 - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded.
44 - Prefer adding cohesive helper functions here only when behavior is reused across modules.
45
46 ## Verification
47
48 - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers.
49 - `tests/test_skills_cli.py` verifies that creation, parsing, discovery, lookup, search, and validation use the runtime skill contract.
50
51 ## Child DOX Index
52
53 No child DOX files.