sjennings/polyskills/maintaining-project-context

Claude Code and agent skill by sjennings/polyskills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when completing development phases or branches to identify and update AGENTS.md files that may have become stale - analyzes what changed, determines affected contracts and documentation, and coordinates updates

Install

npx vskill@latest install sjennings/polyskills/maintaining-project-context

SKILL.md

The same SKILL.md was published earlier as scarnecchia/polyskills/maintaining-project-context.

Maintaining Project Context

REQUIRED SUB-SKILL: Use writing-agent-context-files for all AGENTS.md creation and updates.

Core Principle

AGENTS.md files document contracts and architectural intent. When code changes contracts, the documentation must update. Stale documentation is worse than no documentation.

Trigger: End of development phase, branch completion, or any work that changed contracts, APIs, or domain structure.

Format Detection (MANDATORY FIRST STEP)

Before any updates, detect whether the repository already has project context:

bash
# Check for AGENTS.md at root
ls -la AGENTS.md 2>/dev/null
Root AGENTS.md?FormatAction
YesAGENTS.md-canonicalRead and update AGENTS.md files
NoNew AGENTS.md-canonicalCreate AGENTS.md files where context is needed

Key principle: Use AGENTS.md as the canonical shared project context format. Write new and updated context to AGENTS.md by default.

When to Update Context Files

Change TypeUpdate Required?What to Update
New domain/moduleYesCreate domain AGENTS.md
API/interface changeYesContracts section
Architectural decisionYesKey Decisions section
Invariant changeYesInvariants section
Dependency changeYesDependencies section
Bug fix (no contract change)No-
Refactor (same behavior)No-
Test additionsNo-

The Process

Step 1: Identify What Changed

Diff against the base (branch start or phase start):

bash
# Get changed files
git diff --name-only <base-sha> HEAD
# Get detailed changes
git diff <base-sha> HEAD --stat

Categorize changes:

  • Structural: New directories, moved files
  • Contract: Changed exports, interfaces, public APIs
  • Behavioral: Changed invariants, guarantees
  • Internal: Implementation details only
Step 2: Map Changes to AGENTS.md Files

For each significant change, determine which AGENTS.md file should document it:

Change LocationContext File Location
Project-wide patternRoot AGENTS.md
New domain<domain>/AGENTS.md (create)
Existing domain contract<domain>/AGENTS.md (update)
Cross-domain dependencyBoth affected domains

Hierarchy rule: Information belongs at the lowest level where it applies. Domain-specific contracts go in domain files, not root.

Step 3: Verify Contracts Still Hold

For each affected AGENTS.md file, verify:

  1. Contracts section: Do exposes/guarantees/expects match current code?
  2. Dependencies section: Are uses/used-by/boundary accurate?
  3. Invariants section: Are all invariants still enforced?
  4. Key Decisions section: Any new decisions to document?
bash
# Find domain's public exports
grep -r "export" <domain>/index.ts
# Find domain's imports (dependencies)
grep -r "from '\.\." <domain>/
Step 4: Update or Create AGENTS.md Files

For updates:

  1. Read existing AGENTS.md first
  2. Update freshness date via date +%Y-%m-%d
  3. Update affected sections
  4. Remove stale content
  5. Verify under token budget (<100 lines for domain files)

For new domains:

  1. Create <domain>/AGENTS.md using the template from writing-agent-context-files
  2. Document purpose, contracts, dependencies, invariants
  3. Set freshness date
Step 5: Commit Documentation Updates
bash
git add <affected AGENTS.md files>
git commit -m "docs: update project context for <branch-name>"

Decision Tree

Has code changed?
├─ No → Skip (nothing to update)
└─ Yes → What changed?
├─ Only tests/internal details → Skip
└─ Contracts/APIs/structure → Continue
│
├─ New domain created?
│ └─ Create AGENTS.md
│
├─ Existing domain changed?
│ └─ Update domain AGENTS.md (read first!)
│
└─ Project-wide pattern changed?
└─ Update root AGENTS.md

Quick Reference

Always update when:

  • New public exports added
  • Interface signatures changed
  • Invariants added/removed
  • Dependencies changed
  • Architectural decisions made

Never update for:

  • Internal refactoring
  • Bug fixes that don't change contracts
  • Test file changes
  • Comment/documentation-only changes

Common Mistakes

MistakeFix
Updating for every changeOnly update for contract changes
Forgetting freshness dateAlways use date +%Y-%m-%d
Documenting implementationDocument contracts and intent
Putting domain info in rootUse domain AGENTS.md files for domain contracts
Skipping verificationRead the code, confirm contracts hold
Writing AGENTS.md without readingAlways read existing content before updating

Integration Points

Called by:

  • project-context-librarian subagent - Uses this skill to coordinate updates
  • Development phase or branch completion workflows

Uses:

  • writing-agent-context-files - For AGENTS.md creation and updates

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/sjennings/polyskills/maintaining-project-context/badge)](https://verified-skill.com/skills/sjennings/polyskills/maintaining-project-context)

Something wrong with this skill or its page? Tell us.