contextualize
ALWAYS invoke this skill when asking about status, progress, or what exists in the Product Tree. NEVER work on any part of the Product Tree without loading context through this skill first.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 1
- Forks
- 1
01 前言 Front Matter
- name
- contextualize
- arguments
- target
- description
- ALWAYS invoke this skill when asking about status, progress, or what exists in the Product Tree. NEVER work on any part of the Product Tree without loading context through this skill first.
- allowed-tools
- Read, Glob, Grep, {{! tool('use_skill') !}}
- argument-hint
- <spx-root-or-full-node-path>
03 SKILL.md 正文
<objective>
A <PRODUCT_TREE_CONTEXT target="..."> marker carrying a structured context manifest for a product-root or node target — every applicable ancestor spec, lower-index sibling spec, ADR, PDR, cited methodology-governance decision, guide file, and the local lifecycle overlay read into the conversation, with no heuristic selection.
</objective>
<essential_principles>
COMPLETE CONTEXT OR ABORT. NO EXCEPTIONS.
- Every node along the path must have its spec file (
{slug}.spec.md, or the prior{slug}.mda 3.x-authored tree still carries) - Missing spec file = ABORT with remediation guidance
- Read order: product root → ancestors → target (top-down)
- All ADRs and PDRs at all levels must be read — no skipping based on title relevance
- Lower-index siblings' specs must be read at each directory level — they constrain the target
- Explicit full-path ADR/PDR citations in loaded specs and decision records must be read before the context marker is emitted; notes never add cited decisions.
- A context-grounded answer requires the matching
<PRODUCT_TREE_CONTEXT target="...">marker. Loading this skill or reading a pre-compaction summary supplies no context. - Context loading reads the checkout as it stands. It never runs
/sync-base, fetches, rebases, or otherwise moves the checkout, so the context it reports describes the head it found. - Test files are not read here. The node target spec or product-root product document already exposes inline
[test](tests/...)links; list those links and the applicabletests/directory state, then leave test-body inspection to/test,/audit-tests, or/apply. - Always use canonical full paths from
spx/for targets and references. The product-root target is exactlyspx/; a node target begins withspx/and contains only node-directory segments. Never refer to nodes, ADRs, or PDRs by bare name or numeric prefix; sibling numbers repeat under different parents and decision files cannot be found without their parent path.- Wrong:
/contextualize 32-parser.capability - Right:
/contextualize spx/{path-to-node}
- Wrong:
BOOTSTRAP MODE: Bootstrap is derived from the documented target and tree state, never from an undeclared operation. When $target is exactly spx/, one product document exists, and no node directories exist, emit the product-root manifest with bootstrap=true. A missing node target always aborts; a node that does not yet exist takes its context from its existing parent (spx/ for a top-level node or the canonical full parent node path for a nested node).
</essential_principles>
<workflow>
<step name="gate">
Step GATE: Check foundation
Check the live conversation for the <PRODUCT_TREE_FOUNDATION> marker.
A marker mentioned only in a compaction summary, Handoff, prior run description, or statement that /understand ran does not count. Reading the /understand SKILL.md file alone does not count.
If absent → STOP. Use skill product-tree:understand. Then continue with Step 0. Do not inspect git, session state, product files, or product-tree content before the live marker is present.
</step>
<step name="locate">
Step 0: Locate target
If the invocation supplies no target path, ABORT: "A canonical target is required. Invoke /contextualize spx/ for the product root or /contextualize spx/{path-to-node} for a node."
Before the first filesystem lookup, accept $target only when it is the exact product-root target spx/ or a repository-relative node target beginning with spx/ whose non-empty segments after spx/ each match {index}-{slug}.{kind} — one of the seven kinds, or the prior enabler and outcome forms a tree authored under a 3.x version still carries. Reject absolute paths, empty targets, repeated separators, . or .. segments, trailing separators on node targets, and malformed node segments. Otherwise ABORT: "Invalid target path: $target. Supply spx/ or one canonical full spx/... node path."
Set product_root_target=true only for the exact target spx/. Every other accepted target is a node target.
# Find the product file
Glob: "spx/*.spec.md" # the root product document carries kind: product
Glob: "spx/*.product.md" # the prior form a 3.x-authored tree still carries
# Verify a node target exists; product-root mode already addresses spx/
Glob: "$target/*.md" (node targets only)
If the product file is missing, ABORT: "No product file found in spx/. Create one with /bootstrap first."
If a node target path doesn't exist, ABORT: "Target path not found: $target. Check the path, or target its existing parent while the node does not yet exist."
For the exact product-root target spx/, list top-level node directories after locating the product document. Set bootstrap=true when none exist and bootstrap=false otherwise. For every node target, set bootstrap=false.
For a node target, extract the path segments from product root to target. Each segment is a directory to walk. For the product-root target, the segment list is empty.
</step>
<step name="product">
Step 1: Load product-level context
# Read product document
Read: spx/{product-name}.spec.md # or the prior form spx/{product-name}.product.md
# Read runtime product guide if present
Read: {{! file('root_guide') !}} (if exists)
# Read ALL product-level ADRs and PDRs
Glob: "spx/*-*.adr.md"
Glob: "spx/*-*.pdr.md"
# Check for product-level notes
Glob: "spx/PLAN.md"
Glob: "spx/ISSUES.md"
# Enumerate local overlays
Glob: "spx/local/*.md"
# Read local lifecycle overlay if present
Read: spx/local/merging.md (if exists)
Read EVERY file returned by the ADR/PDR globs. Do not filter by title. Decision records contain cross-cutting constraints that may not be obvious from the title.
Verification: Count files returned by globs. Count files actually read. These must match.
Guide files: Read {{! file('root_guide') !}} when present and record it in the manifest. A freshly bootstrapped tree may lack the guide; absence is normal.
Notes: Read product-level ISSUES.md when present, and any PLAN.md a tree authored under a 3.x version still carries — the methodology admits ISSUES.md as the only note and routes work ordering to a Change. Reconcile them against product truth before use, and never scan their prose for cited governance decisions.
Local overlays: Record the list of files returned by spx/local/*.md for the manifest. Read spx/local/merging.md when present because default-branch lifecycle routing governs whether local implementation, validation, and commits are terminal. Do not read the other local overlays here — they are consumed by the relevant language skill, not by the context loader.
</step>
<step name="walk">
Step 2: Walk the tree from root to target
For each directory along the path from product root to a node target. In product-root mode the path contains zero node directories, so skip Step 2.
2a. Read the directory's spec file
# The spec file is {slug}.spec.md; a 3.x-authored tree carries {slug}.md
Read: {path-to-dir}/{slug}.spec.md # or the prior {path-to-dir}/{slug}.md
# Read harness guide in this directory if present
Read: {path-to-dir}/{{! file('root_guide') !}} (if exists)
ABORT if the spec file is missing.
A missing on-path guide is normal. Read a guide only when it exists, and record every guide read in the manifest.
2b. Read all ADRs and PDRs in this directory
Glob: "{path-to-dir}/*-*.adr.md"
Glob: "{path-to-dir}/*-*.pdr.md"
Read EVERY file returned. Verification: glob count must equal read count.
2c. Check for notes in this directory
Glob: "{path-to-dir}/PLAN.md"
Glob: "{path-to-dir}/ISSUES.md"
If ISSUES.md, or a prior-form PLAN.md, exists, read it. These are stale-prone notes left by previous agents. Deferred plans or known issues in an ancestor node may bear on the target, but they are fallible inputs, not authority — reconcile each against the specs, decisions, assertions, tests, implementation, and current user intent before letting it steer work.
2d. Read all lower-index siblings' specs
The target node has an index (e.g., 43 in 43-feature.capability). Existing lower-index sibling specs constrain the target's context and must be read.
# List all sibling directories (same parent, different from target)
Glob: "{parent-path}/*-*.*/" # any kind suffix, including the prior forms
# For each sibling with a lower index than the target:
Read: {parent-path}/{sibling-dir}/{sibling-slug}.spec.md # or the prior {parent-path}/{sibling-dir}/{sibling-slug}.md
Lower-index siblings' ADRs/PDRs are NOT read — only the sibling's spec itself. Existing numeric order makes the sibling's spec part of the target context, while the sibling's internal decisions are its own concern.
2e. Note same-index siblings (independent)
Siblings with the same index as the target are independent — they neither constrain nor are constrained by the target. List them but do not read.
</step>
<step name="target">
Step 3: Load target context
For a node target, load the target context below.
# Read target spec
Read: $target/{slug}.spec.md # or the prior $target/{slug}.md
# Read target ADRs and PDRs
Glob: "$target/*-*.adr.md"
Glob: "$target/*-*.pdr.md"
# Enumerate children (if any)
Glob: "$target/*-*.*/"
# Check for tests directory
Glob: "$target/tests/*"
# Check for notes
Glob: "$target/PLAN.md"
Glob: "$target/ISSUES.md"
If ISSUES.md, or a prior-form PLAN.md, exists, read it. These are stale-prone notes left by previous sessions. They carry deferred plans or known issues that subsequent work may account for, but verify each before acting — reconcile it against the specs, decisions, assertions, tests, implementation, and current user intent rather than treating it as settled truth.
Do not read test file bodies. Record the test links visible in the target spec and whether co-located test files exist. Context loading does not infer implementation state from test imports. When the next workflow needs test details, route to /test, /audit-tests, or /apply.
For the product-root target, the product document and product-level decisions and notes were already read in Step 1. Enumerate top-level child nodes with Glob: "spx/*-*.*/", list test links from the product document, check Glob: "spx/tests/*" without reading test bodies, and skip node-spec and node-decision lookup. Report the target as spx/ (product root) and render the hierarchy as {product-name} ← TARGET.
</step>
<step name="cited_governance">
Step 4: Read cited methodology-governance decisions
Scan only the spec files and ADR/PDR files read by context loading for full-path decision citations:
Grep: "spx/[^[:space:])]+\\.(adr|pdr)\\.md" in the loaded spec and decision files
Read each cited spx/.../*.adr.md or spx/.../*.pdr.md file exactly once when it exists and has not already been read. Then scan each newly read cited decision for further full-path ADR/PDR citations, repeating until no unread cited decision remains. Preserve the citing file path for the manifest. Do not scan or trust citations in PLAN.md, ISSUES.md, or any note; those notes are stale-prone workflow inputs, not context-loading authority.
If a loaded spec or decision cites a missing ADR/PDR path, ABORT with the missing citation path, the citing file, and remediation guidance to fix the stale citation or restore the decision file. A context marker that omits a cited governing decision is partial context.
</step>
<step name="summary">
Step 5: Emit context marker and summary
Emit the <PRODUCT_TREE_CONTEXT> marker with all collected information:
<PRODUCT_TREE_CONTEXT target="{full-target-path}">
Product: {product-name}
Target: $target ({kind}|product root)
Bootstrap: {true|false}
Documents loaded:
Product document: {product-file}
Ancestor specs: {count} read
Lower-index sibling specs: {count} read
ADRs: {count} found, {count} read
PDRs: {count} found, {count} read
Cited governance decisions: {list of path cited by path} | none
Guide files: {list} | none
Hierarchy (node target):
{product-name}
└── {ancestor-1} ({kind})
└── {ancestor-2} ({kind})
└── {target} ({kind}) ← TARGET
Hierarchy (product-root target):
{product-name} ← TARGET
Children: {count} ({list if any})
Test links: {list from target spec, full paths resolved from target} | none
Co-located tests: {count} listed | none
Implementation: unknown unless already established by a prior workflow
Notes: {list of {path}/PLAN.md and {path}/ISSUES.md found at any level} | none
Local skill overlays: {comma-separated list from spx/local/} | none
Lifecycle overlays read: spx/local/merging.md | none
Default-branch completion boundary: delivered value is value merged to the default branch on origin through /merge; local verification, review, audit, and commits are progress, not completion, while the branch carries changes ahead of its resolved base
Governed next workflow: /merge after local verification when the work changes files and is destined for the default branch, unless explicitly scoped to proposal, analysis, review, or local-only work, or stopped at an explicit lifecycle gate with no independent local action remaining
Progress verdict rule: status and progress answers must classify the lifecycle as complete, continuing, or blocked; a clean worktree, committed branch, or passing local gate cannot classify default-branch work as complete while changes remain ahead of the resolved base
Continuation action: if the lifecycle is continuing, proceed to the governed next workflow instead of ending the turn; if blocked, report the exact gate, evidence, and operator decision required
Lower-index siblings read: {list}
Same-index siblings (independent): {list}
Higher-index siblings listed: {list}
</PRODUCT_TREE_CONTEXT>
</step>
</workflow>
<abort_protocol>
When a required document is missing, ABORT immediately with:
- What's missing — exact file path expected
- Why it's needed — what context it provides
- How to fix — specific remediation action
| Missing | Remediation |
|---|---|
| Product file | "Create with /bootstrap — every tree needs a product document" |
| Ancestor spec | "Node directory exists but spec file is missing. Create {slug}.spec.md" |
| Target spec | "Target directory exists but spec file is missing. Create {slug}.spec.md with /author" |
Do NOT proceed with partial context. The whole point of deterministic context is completeness.
</abort_protocol>
<failure_modes>
Failure 1: Skipped ADRs/PDRs based on title relevance
Claude globbed 12 decision records but only read 3 whose titles seemed relevant. The answer to the user's question was in one of the 9 skipped documents. The verification gate ("glob count must equal read count") prevents this.
Failure 2: Missed lower-index siblings
Claude walked the ancestor chain but didn't read lower-index siblings' specs. A lower-index provider contained infrastructure the target depended on. Existing numeric order means lower-index sibling specs are constraining context, so they must be read.
Failure 3: Read higher-index siblings
Claude read ALL siblings including higher-index ones. Higher-index siblings may depend on the target but don't constrain it. Reading them wastes context window and may introduce irrelevant information.
Failure 4: Inferred implementation state from tests during context loading
Claude read test file imports during context loading and reported implementation state from those imports. That made context loading expensive and mixed it with testing work. Context loading lists test links and co-located test files only; /test, /audit-tests, and /apply inspect test bodies.
Failure 5: Reported a bare node or decision name
Claude wrote "see 15-build.adr.md" or "continue in 32-parser.capability" without the full path. Those references are ambiguous because numeric prefixes are sibling-local. Always report the complete path from spx/, using the shape spx/{parent-node}/{target-node}/{decision-file} or spx/{parent-node}/{target-node}, so the file can be found.
Failure 6: Omitted lifecycle continuation from the context marker
Claude loaded /understand, completed edits, passed deterministic verification, committed the branch, then stopped because the context packet carried document context but no branch-lifecycle state. Context loading now reads spx/local/merging.md when present and records the default-branch completion boundary plus /merge continuation in <PRODUCT_TREE_CONTEXT>, so local readiness is not mistaken for delivered value.
Failure 7: Treated status reporting as permission to stop
Claude answered a progress question by reporting the clean worktree and local verification, then ended the turn while the branch still carried changes destined for the default branch. Context loading now requires a progress verdict and continuation action: complete only after the change reaches the default branch on origin, continuing when /merge remains available, or blocked when an explicit lifecycle gate leaves no independent local action.
Failure 8: Moved the checkout while loading context
Claude ran a base sync before reading the tree, and the rebase replaced the head under inspection with a different commit. The loaded context then described a commit nobody had asked about. Context loading reads the checkout as it stands; branch movement belongs to the workflows that own it.
Failure 9: Missed cited methodology governance
Claude loaded the structural ancestor context for a plugin-shipping node and saw full-path citations to methodology-governance decisions under an independent sibling subtree, but did not read the cited PDRs because they were outside the structural ancestor path. The answer used an incomplete methodology model. Scan loaded specs and decision records for full-path ADR/PDR citations, including citations from newly read cited decisions, before emitting <PRODUCT_TREE_CONTEXT>.
Failure 10: Omitted product-level notes
Claude checked PLAN.md and ISSUES.md only inside node directories, so product-level notes disappeared from every target context even though it applied tree-wide. Check and read product-level notes before walking the node path, then list them with the ancestor and target notes in the context manifest.
Failure 11: Rejected the canonical product-root target
Claude required at least one node-directory segment after spx/, so the parent of a top-level node could not be contextualized even though spx/ is the canonical product-root address. Treat exact spx/ as product-root mode, walk zero node segments, and emit product-level context without attempting node-spec lookup.
</failure_modes>
<success_criteria>
The emitted <PRODUCT_TREE_CONTEXT target="..."> marker is sound when:
- [ ] A live
<PRODUCT_TREE_FOUNDATION>marker precedes it in the conversation - [ ] Its target is exact
spx/or a canonical fullspx/...node path, accepted before any filesystem lookup - [ ] At every level it names, the ADR and PDR read counts equal their glob counts
- [ ] It lists the product document, every ancestor spec, and every lower-index sibling spec as read, and no higher-index sibling spec as read
- [ ] Every full-path ADR/PDR cited by a loaded spec or decision appears with its citing file, and no cited decision comes from a note
- [ ] Every guide file and note present at the product root, on the path, and at the target is listed
- [ ] Test links and co-located test files are listed, implementation state reads
unknownunless a prior workflow established it, and no test body was read - [ ] Local overlays are listed, and when
spx/local/merging.mdexists the lifecycle continuation fields carry its routing - [ ] Every node, ADR, PDR, test, and note reference is a full path from
spx/ - [ ] Bootstrap is
trueonly for exactspx/with a product document and no nodes, andfalsefor every node target - [ ] The checkout's head is the same before and after context loading
- [ ] An ABORT emits no marker and names the missing path with its remediation
</success_criteria>
04 同仓库更多 Skills
plugin
暂无简介
sanitize-powerpoint
ALWAYS invoke this skill when sanitizing, cleaning up, auditing, or aligning a PowerPoint (.pptx) deck — slide-master and layout structure, layout type attributes, stray fonts, non-theme colors, or layout naming. NEVER hand-edit pptx XML without this skill.
draw-excalidraw
ALWAYS invoke this skill when creating Excalidraw diagrams, visualizing workflows, architectures, or concepts. NEVER generate Excalidraw JSON without this skill.
typescript-test-standards
TypeScript test standards enforced across all skills. Loaded by other skills, not invoked directly.
typescript-code-standards
TypeScript code standards enforced across all skills. Loaded by other skills, not invoked directly.
typescript-architecture-standards
TypeScript ADR conventions enforced across architect and auditor skills. Loaded by other skills, not invoked directly.