AgentSkillsCN

maintaining

保持项目依赖与配置文件的及时更新,确保项目始终处于最新状态。

SKILL.md
--- frontmatter
name: maintaining
description: Maintenance skill for keeping project dependencies and configuration files up to date
license: MIT
compatibility: opencode
metadata:
  audience: developers
  workflow: maintenance

Maintaining Skill

Dependency Management

When a new package is added:

  1. Update package.json (npm/Node.js projects)
  2. Update requirements.txt (Python projects)
  3. Update Cargo.toml (Rust projects)
  4. Update go.mod (Go projects)

Keep lockfiles in sync:

  • package-lock.json or pnpm-lock.yaml
  • requirements.txt with pinned versions
  • Cargo.lock

Configuration Files

Update .gitignore when:

  • Adding new build outputs
  • Adding new cache directories
  • Adding new IDE configurations
  • Adding new environment files

Update .dockerignore when:

  • Adding files not needed in container
  • Adding development-only files
  • Adding large files that shouldn't be copied

Ignore Files Best Practices

Critical .gitignore Rules:

ALWAYS use patterns that match nested directories:

gitignore
# Use **/pattern to match nested folders
**/node_modules/          # Matches node_modules anywhere in the tree
**/.next/                 # Matches .next anywhere
**/.turbo/                # Matches .turbo anywhere
**/dist/                  # Matches dist anywhere
**/build/                 # Matches build anywhere
**/__pycache__/           # Matches __pycache__ anywhere
**/.pytest_cache/         # Matches pytest cache anywhere

# VS Code Local History Extension
.history/                 # Root level .history folder

# Environment files
**/.env                   # Match .env at any level
**/.env.local
**/.env.*.local

# IDE and Editor files
**/.vscode/
**/.idea/
**/*.swp
**/*.swo
**/*~

# OS files
**/.DS_Store
**/Thumbs.db
**/.Spotlight-V100
**/.Trashes

# Build outputs (nested too)
**/coverage/
**/.nyc_output/
**/out/
**/*.log
**/*.pid
**/*.seed
**/*.pid.lock

# Dependency directories (nested)
**/node_modules/
**/jspm_packages/
**/bower_components/
**/vendor/
**/.pnp/
**/.pnp.js

Special Folders to Handle

Required entries in every .gitignore:

  1. .history/ - VS Code Local History Extension

Critical .dockerignore Rules:

dockerignore
# Use same nested pattern matching
**/node_modules/
**/.next/
**/.turbo/
**/dist/
**/build/
**/__pycache__/
**/.pytest_cache/

# VS Code Local History
.history/

# Version control
**/.git/
**/.gitignore
**/.gitattributes

# Documentation
**/README.md
**/docs/
**/*.md

# IDE
**/.vscode/
**/.idea/
**/*.swp

# Environment files
**/.env
**/.env.*

# Test files
**/*.test.js
**/*.spec.js
**/tests/
**/test/
**/__tests__/

# CI/CD
**/.github/
**/.gitlab-ci.yml

Why **/ prefix is important:

  • node_modules/ only matches at root level
  • **/node_modules/ matches node_modules at ANY depth
  • Example: apps/frontend/node_modules/ will be ignored with **/
  • Example: packages/shared/node_modules/ will be ignored with **/

Special case - .history folder:

  • VS Code Local History extension creates .history/ at project root
  • ALWAYS add .history/ to .gitignore
  • Contains automatic file backups and should never be committed

Environment Variables

Work directly with .env:

  • Read and modify .env files directly
  • Do not create .env.local or .env.example unless requested
  • Ensure .env is listed in .gitignore (use **/.env to catch nested ones)
  • Document required variables in README.md

File Updates Checklist

After code changes, verify:

  • package.json updated with new dependencies
  • requirements.txt updated if Python packages added
  • .gitignore updated with **/ patterns for nested directories
  • .gitignore includes .history/ for VS Code Local History
  • .dockerignore updated with **/ patterns if needed
  • turbo.json updated if new workspaces added
  • README.md updated with new setup steps
  • Environment variables documented

Version Management

  • Use semantic versioning when applicable
  • Keep dependency versions up to date
  • Check for security vulnerabilities regularly
  • Update deprecated packages

Common Ignore Pattern Examples

For JavaScript/TypeScript projects:

gitignore
**/node_modules/
**/.next/
**/.turbo/
**/dist/
**/build/
**/.cache/
**/coverage/
.history/
**/.env
**/.env.local

For Python projects:

gitignore
**/__pycache__/
**/.pytest_cache/
**/.venv/
**/venv/
**/*.pyc
**/*.pyo
**/*.egg-info/
.history/
**/.env

For monorepos:

gitignore
**/node_modules/
**/.next/
**/.turbo/
**/dist/
**/build/
.history/
**/.env
**/.env.local
**/coverage/

Always use **/ prefix to ensure nested directories are properly ignored!