src/skills/x-internal-select-knowledge/SKILL.md
Selects canonical knowledge assets by knowledge_kind and phase/stage via knowledge-catalog.md discovery. Technical knowledge is matched by --phase + capabilities; domain knowledge by --stage + segment/product.
npx skillsauth add edercnj/claude-environment x-internal-select-knowledgeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
🔒 INTERNAL SKILL Invoked only by orchestrator/specialist skills to avoid duplicated hardcoded knowledge lists.
Resolve the canonical set of knowledge assets for a given knowledge_kind:
--phase (plan|implement|review) + active capabilities.--stage (ideate|refine|story|feature) + segment/product.The selection source of truth is the filesystem: knowledge-catalog.md files discovered via glob under src/knowledge/.
This is the knowledge counterpart of x-internal-select-context-packs (which handles patterns). It is deliberately separate so the patterns critical path (arch_questions, scoring_summary, conflict-groups) is never coupled to knowledge selection. Knowledge has no arch_questions, no scoring, and no conflict-groups.
Used only through inline invocation:
Skill(skill: "x-internal-select-knowledge",
args: "--kind domain --stage feature --segment payments")
Skill(skill: "x-internal-select-knowledge",
args: "--kind technical --phase plan --capabilities java,security")
| Parameter | Required | Description |
|-----------|----------|-------------|
| --kind | Yes | technical or domain |
| --phase | When --kind technical | plan, implement, or review |
| --stage | When --kind domain | ideate, refine, story, or feature |
| --capabilities | No | Comma-separated capabilities (technical match): java,api,database,security,... |
| --segment | No | Comma-separated product segments (domain match): payments,lending,... |
| --product | No | Comma-separated products (domain match): pix,card-issuing,... |
| --grouper | No | Filter to a specific grouper (default: include shared + project groupers) |
| --include-optional | No | Include assets with mandatory: optional |
knowledge-catalog.md files:
find src/knowledge -name "knowledge-catalog.md" -type f
---).artifact: knowledge-catalog (ignore files without this field).status != removed and status != deprecated (unless --include-optional and status == deprecated).knowledge_kind == --kind.--kind):
--kind technical: load_phase list intersects --phase, AND capability match (any of):
scope includes shared, orgrouper is shared, orstack list intersects at least one requested capability, ortype value maps to a requested capability (see Capability–Type mapping in x-internal-select-context-packs).--kind domain: lifecycle_stage list intersects --stage, AND domain match (any of):
segment is empty [] (cross-cutting), orsegment intersects --segment, orproduct intersects --product, orgrouper is shared.src/patterns/, unless --grouper restricts to a specific one.mandatory to bucket:
mandatory: required → requiredmandatory: recommended → recommendedmandatory: optional → optional (only when --include-optional)knowledge-catalog.md file itself) in its bucket.Step 6 — Catalog Dependency Chain Resolution (depends-on):
After the initial catalog set is resolved, expand it by following depends-on declarations (format {grouper}/{knowledge-catalog}):
depends-on. For each referenced catalog not yet active:
src/knowledge/{grouper}/{knowledge-catalog}/knowledge-catalog.md.required > recommended > optional).depends-on.visited set; on repeat, skip and log [WARN] cycle detected in knowledge depends-on: {path}.Note: knowledge has no conflict-groups. There is no conflict-detection pass.
For each active catalog resolved in Layer A:
knowledge_items list from the catalog's frontmatter.{catalog_dir}/{knowledge-item-name}/knowledge.md
depends-on and load_scope.load_scope:
load_scope: baseline → include whenever the parent catalog is active.load_scope: stage → include ONLY if the item's load_phase/lifecycle_stage intersects the requested --phase/--stage.depends-on (executable — skip item if not satisfied):
{grouper}/{knowledge-catalog} or {grouper}/{knowledge-catalog}/{knowledge-item}.[SKIP] {path}: depends-on not satisfied ({unresolved-dep}).required > recommended > optional.status: removed or status: deprecated assets in active buckets.deprecated only with assets explicitly marked status: deprecated that were matched.asset_path.There is no Layer C/D: knowledge carries no
arch_questionsand noscoring_summary.
{
"kind": "domain",
"stage": "feature",
"phase": null,
"segment": ["payments"],
"product": [],
"capabilities": [],
"required": [
"src/knowledge/shared/refinement-decomposition/knowledge-catalog.md",
"src/knowledge/shared/refinement-decomposition/decomposition-guide/knowledge.md"
],
"recommended": [],
"optional": [],
"deprecated": []
}
For --kind technical, phase is set and stage is null:
{
"kind": "technical",
"phase": "plan",
"stage": null,
"capabilities": ["security"],
"segment": [],
"product": [],
"required": [
"src/knowledge/shared/governance-baselines/knowledge-catalog.md",
"src/knowledge/shared/governance-baselines/quality-gates/knowledge.md",
"src/knowledge/shared/security-knowledge/knowledge-catalog.md"
],
"recommended": [],
"optional": [],
"deprecated": []
}
Compatibility rules:
kind, required, recommended, optional, deprecated are stable and mandatory.required and recommended contain both knowledge-catalog.md and knowledge.md item paths — consumers read all paths.x-internal-select-context-packs, so consumers can union results from both selectors and run a single "Read every path" loop.Caller skills MUST:
x-internal-select-context-packs.required (both knowledge-catalog.md and knowledge.md files).recommended when relevant to the current scope.Domain consumers (x-create-feature, x-refine-feature, x-internal-create-feature, x-add-story-to-feature) call with --kind domain --stage <stage> + the active --segment/--product.
Technical consumers (x-plan-architecture, x-internal-plan-arch-story, x-plan-story, x-plan-task, x-implement-*, x-review-*) call with --kind technical --phase <phase> + the active --capabilities.
| Scenario | Action |
|----------|--------|
| No knowledge-catalog.md files found | Return empty arrays with INFO note; caller continues |
| --kind missing or invalid | Abort: KNOWLEDGE_KIND_INVALID |
| --kind technical without --phase | Abort: KNOWLEDGE_PHASE_REQUIRED |
| --kind domain without --stage | Abort: KNOWLEDGE_STAGE_REQUIRED |
| No assets matched | Return empty arrays with INFO note |
| Malformed catalog frontmatter | Skip that catalog; log [WARN] malformed frontmatter: {path}; do not abort |
| depends-on not satisfied (item level) | Skip item; log [SKIP] {path}: depends-on not satisfied ({dep}); do not abort |
| depends-on chain cycle (catalog level) | Log [WARN] cycle detected; break cycle; do not abort |
development
Documentation freshness gate: validates 6 dimensions (readme, api, adr, etc.) per PR.
testing
Conditional dep-policy gate: CVEs, licenses, versions, freshness; SARIF + report.
documentation
Incrementally updates the service or system architecture document; never regenerative.
development
Scans code and git history for leaked credentials, API keys, and tokens; SARIF output.