Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

requirements.cli.skill_conventions

Requirements index · View definition

evidence Valid

Requirement

Each bundled skill’s description MUST state when to use it in terms of the user’s task. It MAY name another bundled skill to use instead where an agent could confuse the two. Each bundled skill, recognized by its front matter, is a site:
::{sites} skills
language: markdown
paths: [assets/skills]
rule:
  kind: minus_metadata
match:
  - "---\nname: example\n---\n\n# Example\n"
no_match:
  - "# Example\n"

:::

Rationale

Obligations. requirements.cli.skill_conventions has one MUST: each bundled skill’s description states when to use it in terms of the user’s task. It also has one MAY, naming another bundled skill to use instead, which imposes nothing to check. Each skill’s own review upholds the MUST, because each skill is a site. No separate code carries it out.

Site query skills.

  • I ran requirements.cli.skill_conventions/skills. It selects exactly the five assets/skills/*/SKILL.md files: habeas, habeas-requirements, habeas-evidence, habeas-bootstrap-requirements and habeas-refactor.
  • A search of assets for --- lines found front matter only in those five files. The query therefore misses no skill, and no references/*.md file or other file outside scope is selected.
  • The SKILLS constant in tests/authoring_cli.rs lists the same five skills.

Query snippets. The match snippet is a document with front matter followed by a heading. The no_match snippet is the same document without front matter. Together they show that the minus_metadata node selects a skill by its front matter and ignores plain Markdown. That is adequate for a single-condition rule.

Test. tests/authoring_cli.rs#fn[bundled_skill_descriptions_say_when_to_use_them] carries the {test} reference.

  • It checks that every skill has exactly one name and one non-empty description of at most 1024 characters.
  • It checks that each description starts with a “Use …” phrase stating when to use the skill.
  • It checks that any habeas-* skill a description names is a bundled one.
  • It checks that skills an agent could confuse name the other skill to use instead.

The test covers the MUST and the optional MAY.

No gaps found.

Inputs

Tests

Input 2: outline tests/authoring_cli.rs fn[bundled_skill_descriptions_say_when_to_use_them]
// {test}`requirements.cli.skill_conventions`
#[test]
fn bundled_skill_descriptions_say_when_to_use_them() {
    // Each skill's front matter is valid YAML with the name and description
    // Symposium requires; a skill whose front matter fails to parse is skipped.
    for name in SKILLS {
        let fields = front_matter(name);
        let field = |key: &str| {
            let values = fields
                .iter()
                .filter(|(k, _)| *k == key)
                .map(|(_, v)| *v)
                .collect::<Vec<_>>();
            assert_eq!(values.len(), 1, "{name}: {key}");
            values[0]
        };
        assert_eq!(field("name"), name);
        let description = field("description");
        assert!(!description.trim().is_empty(), "{name}");
        assert!(
            description.chars().count() <= 1024,
            "{name}: description has {} characters",
            description.chars().count()
        );
        assert_eq!(description, self::description(name));
    }
    for (name, when) in [
        (
            "habeas",
            "Use at the start of any work in a project that tracks requirements with Habeas",
        ),
        (
            "habeas-requirements",
            "Use during design sessions and before changing code, tests, or requirement text",
        ),
        (
            "habeas-evidence",
            "Use when Habeas evidence needs creating or refreshing",
        ),
        (
            "habeas-bootstrap-requirements",
            "Use when adopting Habeas in an existing codebase",
        ),
        (
            "habeas-refactor",
            "Use when a change moves code, tests, or requirements",
        ),
    ] {
        let description = description(name);
        assert!(description.starts_with(when), "{name}: {description}");
        // A skill a description names is a bundled one.
        for word in description.split(|c: char| !(c.is_alphanumeric() || c == '-')) {
            if word.starts_with("habeas-") {
                assert!(SKILLS.contains(&word), "{name} names {word}");
            }
        }
    }
    // Skills an agent could confuse name the other to use instead.
    for (name, instead) in [
        ("habeas-requirements", "use habeas-refactor"),
        ("habeas-requirements", "use habeas-evidence"),
        ("habeas-evidence", "use habeas-refactor first"),
        ("habeas-bootstrap-requirements", "use habeas-evidence"),
        ("habeas-refactor", "use habeas-requirements"),
    ] {
        assert!(description(name).contains(instead), "{name}: {instead}");
    }
}

Other sources

Input 1: requirements selection requirements.cli.skill_conventions
::::{req} skill_conventions
Each bundled skill's description MUST state when to use it in terms of the user's task. It MAY name another bundled skill to use instead where an agent could confuse the two. Each bundled skill, recognized by its front matter, is a site:

:::{sites} skills
```yaml
language: markdown
paths: [assets/skills]
rule:
  kind: minus_metadata
match:
  - "---\nname: example\n---\n\n# Example\n"
no_match:
  - "# Example\n"
```
:::
::::