Maintain project context

From toy-crane/claude-code-playbook-template · View interactive version

Maintain project context is an AI agent skill from the GitHub repository toy-crane/claude-code-playbook-template. Clean, compact, and reconcile durable project context and any configured issue-tracker mirror without changing established meaning. Always use this skill whenever a request cleans, audits, or checks consistency across two or more durable context sources, even when they are called product docs, gloss

How to use this skill

Skill file

Maintain Project Context

This skill requires define-product. Before doing any work, confirm it is

installed. When it is missing, stop and report it with its install command,

npx skills@latest add toy-crane/skills --skill define-product, using the

project's package manager runner where it pins one.

Run a deliberate hygiene pass across the durable context that future work will

reuse. Make the current meaning easier to retrieve without becoming the

decision-maker for any artifact.

Preserve authority

class of decision, or an authoritative project source already states it.

change product code during this pass.

unclear. Ask the exact question required to continue; never choose by file

date, implementation prevalence, labels such as accepted, or silence.

build a parallel summary or copy the same authority across files.

Inspect the durable surfaces

Inspect only the surfaces that exist or are required by the cleanup:

Do nothing merely because an optional file is absent. This is a periodic

cross-artifact pass, not the incremental capture of a single newly settled term,

decision, or follow-up.

Maintain product context

When PRODUCT.md exists, compare its claims with explicit current product

decisions and other authoritative context. Remove duplicated or obsolete

wording and apply already-settled product meaning while preserving still-current

content.

Keep PRODUCT.md product-only: app definition, users and situations, problem

and alternatives, promised change, core loop, app-wide capabilities and

boundaries, experience principles, success signals, assumptions, and unknowns.

Do not move stack, architecture, repository mechanics, screen requirements,

work-unit scope, or acceptance criteria into it.

When a proposed edit would choose a new audience, problem, promise, core loop,

product boundary, or other product intent, leave the file unchanged and ask the

user to settle that meaning. When the user wants to reopen the product

premise, invoke define-product with the current PRODUCT.md, the exact

ambiguity found, and the surfaces that depend on it, so it revises only that

part of the premise; it hands back the updated PRODUCT.md, after which this

pass resumes and reconciles the remaining durable surfaces against it.

Maintain decision contracts

List docs/decisions/ and read its index when it exists. Check for files

missing from the index, then compare relevant subjects with current context and

remaining specs.

Keep one editable decision file per subject. Use Git for history instead of

keeping old decision files in the active folder. When several files clearly

agree on one decision, merge them under the clearest stable subject name. Update

every inbound link before deleting redundant files.

Every decision contract created or edited in this pass needs a subject title

and these required sections:

debate.

Add these sections only when they carry current value:

reproduce.

Remove status fields, supersession chains, adoption or update dates,

pull-request order, and old implementation notes. Keep a date when it sets a

current rule or tells future work when to reconsider.

Before removing other content, ask whether its absence could make a capable

future agent repeat the same proposal, investigation, experiment, or failed

approach under the same conditions. If so, keep the shortest explanation that

prevents repetition. Remove duplicates and alternatives that cannot reasonably

recur.

Maintain related files

- [subject](subject.md) — Read when .... Make every link work. The routing

phrase says when to open the file, not what it decided.

definition only when the project's language has already changed.

qualifying reusable decision in its owning contract, then delete the folder.

A shipped folder whose ## Post-release check holds a check, not None.,

stays until that check is done, because a later session runs the

measurement file at its recorded path inside the folder. With an issue

tracker convention, find the folder's check issue through the convention's

Check issue lookup by its Spec-Folder: line; the check is done when that

issue is closed. Keep the folder and report it when no check issue exists

yet. Without a tracker convention, ask. If shipment is unclear, leave it and

ask. In active specs, update only links

and terms already confirmed elsewhere.

the decision index. Remove copied decision or product content without changing

unrelated instructions.

Create, rename, or rebuild decision contracts and their index when the cleanup

requires it. Do not merge unrelated subjects or remove necessary instructions

to hit a size target. Report an index or always-loaded file that remains hard to

navigate and explain why.

Reconcile the issue-tracker mirror

When AGENTS.md or CLAUDE.md carries an ## Issue tracker section, read both

files and use the first section found and its linked detailed convention when

present. Existing inline conventions remain valid; the setup skill need not be

installed. If the linked document cannot be read, report that tracker work is

blocked and continue repository context maintenance. Treat its issues as a derived coordination

surface, never as authority for product meaning, shipment, terms, or decisions.

Do not import issue prose or comments into durable project context.

Resolve and fetch the remote's advertised default branch. Compare the tracker

with docs/specs/<slug>/ folders on that fetched branch, not with unmerged

changes in the current checkout. Each folder's spec.md names its one issue

with an Issue: <tracker>:<id> line; fetch every issue by that ID. Never list

issues or search them by title to find a folder's issue, and do not hunt for

orphan or duplicate issues; a person tidies duplicates in the tracker. If the

convention still describes a spec:<slug> title key, a Source-Issue line,

or a managed-issue listing, tell the user to rerun setup-issue-tracker

instead of using those operations, and to rename Source-Issue: to Issue:

in active spec folders themselves; the old line is not read.

For each default-branch spec folder, apply the rules below:

and create nothing; the next PR that carries the folder creates its issue.

from the fetched spec.md:

the text of its first section, the remaining section headings, the folder

path, and its Blocked by: docs/specs/<other>/ issue references. Keep the

issue's title and every other part of its body, whether a person or an agent

created it.

Blocked by folders, removing stale edges and adding missing ones while

preserving its assignee and open or closed state. When a blocker folder has

no Issue: line, report it and leave the dependent issue's entire blocker

relation set unchanged rather than removing edges on partial information.

issue merely because its folder remains. Only confirmed implementation

delivery or the recorded tracker convention settles closure.

Search merged PR bodies for exact Issue: <tracker>:<id> lines, including PRs

whose spec folder has since been deleted, and fetch each issue by that ID. A

merged PR is durable retry evidence for a failed close only when its diff and

verification establish implementation delivery for that issue; a Spec-Folder

trailer, linked spec PR, Issue: line, or missing folder alone is

insufficient. Retry the convention's close operation for an open issue, then

verify its state. For a merged spec-only PR with no implementation delivery,

keep the issue open. If it still carries the PR review or active-work signal,

check for newer implementation work, then use the convention's mark-ready

operation and verify the result. Never demote work that has already started.

Report the exact missing PR evidence or failed operation when neither safe

closure nor a ready transition can be established. This catch-up also applies

when the original merge run reported a tracker failure; do not depend on that

run's branch or commit trailers surviving a squash merge.

If the configured tool is unavailable or any operation fails, finish the

repository cleanup, report the incomplete tracker operation and reason, and

preserve the remaining issue state for a later pass.

Finish

Finish when every safely resolvable subject has one owner and one current

representation, confirmed shipped specs are retired, optional current surfaces

contain no known stale duplication, the configured tracker mirror is reconciled

as far as its recorded operations allow, and ambiguous meaning remains

preserved.

Report what changed, what was deleted, what was intentionally left unchanged,

the tracker issues updated, closed, or left unchanged with a reason, and the exact

question needed for every unresolved conflict or unclear shipment.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.