Skip to content

product-development: link code to features with @feature tags #38

In review

Description

@prometheas

Problem

Nothing links code back to the feature it implements. An agent changing a module can't find the spec that governs it. Canonization needs to know which code belongs to a change's feature, and today it has to guess from names and history.

Proposal

Tags in code

A comment tag names the feature: @feature <feature-id>. It goes in the language's documentation comment, at file or symbol level. A file can carry more than one tag. The check recognizes these forms: /** … */ block comments (JavaScript, TypeScript, Java, Kotlin, Swift and similar), Python docstrings, /// and //! doc comments (Rust, Swift), and # comments in shell and YAML. A tag in a string literal or ordinary prose is ignored.

/**
 * Sends invitation reminders.
 * @feature workspace-invitations
 */

A path convention for files without comments

Assets, strict JSON and some configuration files can't hold comments. These map by path instead: a file under a features/<feature-id>/ directory inside a scanned source root belongs to that feature.

Files whose location the tooling fixes, such as lockfiles or framework-mandated entry points, stay unmapped.

Check

The skill ships a check script. It scans the source roots it is given, skipping docs/product/, dot-directories and any directory passed as an exclusion, such as test fixtures or a framework's own features folder. It verifies that every @feature tag and every features/<feature-id>/ path names an existing feature directory under docs/product/features/. When a feature is renamed, split or dropped, the check fails until the code is updated, so tags can't silently go stale. Projects run it in CI.

What stays out of the feature directory

The mapping lives in the code. Feature index.md files list documents only. They never carry generated lists of code files.

Handoff and retrofit

Acceptance criteria

  • A reference file documents the tag, the path convention, the source roots and exclusions, the unmapped cases and the check, and SKILL.md links it.
  • The check script exists in the skill's scripts/, with bats tests covering a valid tag in each supported comment form, an unknown feature ID, a valid path, an unknown path, a skipped docs/product/features/ directory, an excluded directory, and no false positive from @feature inside a string literal or a Markdown file.
  • The skill documents how to run the check in CI, with a GitHub Actions example.
  • The handoff reference from Improve product-development plugin with lifecycle review and handoff workflows #18 (lifecycle review and handoff) includes the tagging instruction.

Non-goals

  • Requiring every file to be tagged.
  • Generating code listings inside docs/product/.
  • Mapping tests to features. Scenarios already do that.

Activity

  1. added
    enhancement
    on Nov 29, 2026
  2. added 20 commits that reference this issue on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions