← 返回
未分类 中文

Update Docs on Code Change

Automatically update README.md and documentation files when application code changes require documentation updates. Use when adding new features, changing AP...
当应用程序代码变更需要更新文档时,自动更新 README.md 和文档文件。适用于添加新功能、修改 API...
jhauga jhauga 来源
未分类 clawhub v1.0.0 1 版本 99720.7 Key: 无需
★ 0
Stars
📥 357
下载
💾 0
安装
1
版本
#latest

概述

Update Documentation on Code Change

A skill for keeping documentation synchronized with code changes. Automatically detects when README.md, API documentation, configuration guides, and other documentation files need updates based on code modifications.

When to Use This Skill

  • Adding new features or functionality
  • Changing API endpoints, methods, or interfaces
  • Introducing breaking changes
  • Modifying dependencies or requirements
  • Changing configuration options or environment variables
  • Updating installation or setup procedures
  • Modifying CLI commands or scripts
  • When code examples in documentation become outdated

Prerequisites

  • Understanding of the project's documentation structure
  • Access to code changes being made
  • Knowledge of documentation files that may need updates

Documentation Update Workflows

README.md Updates

Update README.md when:

  1. Adding new features or capabilities
    • Add feature description to "Features" section
    • Include usage examples if applicable
    • Update table of contents if present
  1. Modifying installation or setup process
    • Update "Installation" or "Getting Started" section
    • Revise dependency requirements
    • Update prerequisite lists
  1. Adding new CLI commands or options
    • Document command syntax and examples
    • Include option descriptions and default values
    • Add usage examples
  1. Changing configuration options
    • Update configuration examples
    • Document new environment variables
    • Update config file templates

API Documentation Updates

Sync API documentation when:

  1. New endpoints are added
    • Document HTTP method, path, parameters
    • Include request/response examples
    • Update OpenAPI/Swagger specs
  1. Endpoint signatures change
    • Update parameter lists
    • Revise response schemas
    • Document breaking changes
  1. Authentication or authorization changes
    • Update authentication examples
    • Revise security requirements
    • Update API key/token documentation

Code Example Synchronization

Verify and update code examples when:

  1. Function signatures change
    • Update all code snippets using the function
    • Verify examples still compile/run
    • Update import statements if needed
  1. API interfaces change
    • Update example requests and responses
    • Revise client code examples
    • Update SDK usage examples

Changelog Management

Add changelog entries for:

  • New features (under "Added" section)
  • Bug fixes (under "Fixed" section)
  • Breaking changes (under "Changed" section with BREAKING prefix)
  • Deprecated features (under "Deprecated" section)
  • Removed features (under "Removed" section)
  • Security fixes (under "Security" section)

Changelog format:

## [Version] - YYYY-MM-DD

### Added
- New feature description with reference to PR/issue

### Changed
- **BREAKING**: Description of breaking change
- Other changes

### Fixed
- Bug fix description

Migration Guides

Create migration guides when:

  1. Breaking API changes occur
    • Document what changed
    • Provide before/after examples
    • Include step-by-step migration instructions
  1. Major version updates
    • List all breaking changes
    • Provide upgrade checklist
    • Include common migration issues and solutions
  1. Deprecating features
    • Mark deprecated features clearly
    • Suggest alternative approaches
    • Include timeline for removal

Documentation File Structure

Maintain these documentation files and update as needed:

  • README.md: Project overview, quick start, basic usage
  • CHANGELOG.md: Version history and user-facing changes
  • docs/: Detailed documentation
  • installation.md: Setup and installation guide
  • configuration.md: Configuration options and examples
  • api.md: API reference documentation
  • contributing.md: Contribution guidelines
  • migration-guides/: Version migration guides
  • examples/: Working code examples and tutorials

Documentation Quality Standards

Writing Guidelines

  • Use clear, concise language
  • Include working code examples
  • Provide both basic and advanced examples
  • Use consistent terminology
  • Include error handling examples
  • Document edge cases and limitations

Code Example Format

### Example: [Clear description of what example demonstrates]

\`\`\`language
// Include necessary imports/setup
import { function } from 'package';

// Complete, runnable example
const result = function(parameter);
console.log(result);
\`\`\`

**Output:**
\`\`\`
expected output
\`\`\`

API Documentation Format

### `functionName(param1, param2)`

Brief description of what the function does.

**Parameters:**
- `param1` (type): Description of parameter
- `param2` (type, optional): Description with default value

**Returns:**
- `type`: Description of return value

**Example:**
\`\`\`language
const result = functionName('value', 42);
\`\`\`

**Throws:**
- `ErrorType`: When and why error is thrown

Best Practices

Do's

  • Update documentation in the same commit as code changes
  • Include before/after examples for changes to be reviewed
  • Test code examples before committing
  • Use consistent formatting and terminology
  • Document limitations and edge cases
  • Provide migration paths for breaking changes
  • Keep documentation DRY (link instead of duplicating)

Don'ts

  • Commit code changes without updating documentation
  • Leave outdated examples in documentation
  • Document features that don't exist yet
  • Use vague or ambiguous language
  • Forget to update changelog
  • Ignore broken links or failing examples
  • Document implementation details users don't need

Validation Commands

Example scripts for documentation validation:

{
  "scripts": {
    "docs:build": "Build documentation",
    "docs:test": "Test code examples in docs",
    "docs:lint": "Lint documentation files",
    "docs:links": "Check for broken links",
    "docs:spell": "Spell check documentation",
    "docs:validate": "Run all documentation checks"
  }
}

Review Checklist

Before completing documentation updates:

  • [ ] README.md reflects current project state
  • [ ] All new features are documented
  • [ ] Code examples are tested and work
  • [ ] API documentation is complete and accurate
  • [ ] Configuration examples are up to date
  • [ ] Breaking changes are documented with migration guide
  • [ ] CHANGELOG.md is updated
  • [ ] Links are valid and not broken
  • [ ] Installation instructions are current
  • [ ] Environment variables are documented

Troubleshooting

IssueSolution
-----------------
Outdated code examplesRe-run examples against current code and update
Missing API documentationReview all public interfaces and document each
Broken linksUse link checker tools to identify and fix
Inconsistent terminologyCreate a glossary and standardize usage
Missing changelog entryAdd entry following the changelog format

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 07:46 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

design-media

HTML Designer

jhauga
资深网页平面设计师,专长于HTML/CSS设计,精通平面设计原理、排版、色彩理论及视觉层级。
★ 8 📥 2,141
dev-programming

Game Engine

jhauga
{"answer":"精通使用HTML5、Canvas、WebGL和JavaScript开发网页游戏引擎及游戏。适用于创建游戏、构建引擎、模..."}
★ 3 📥 1,607
dev-programming

HTML Coder

jhauga
专业HTML开发技能,构建网页、表单和交互内容。用于创建HTML文档、结构化网页内容、实现...
★ 5 📥 1,922