mcpField
U
update-oo-component-documentation

update-oo-component-documentation

github.com/github开发40.5k7.0k 次安装今天更新
代码仓库

关于 update-oo-component-documentation

此技能指导开发者和维护者通过对照当前源代码,更新现有 OO 组件文档。它规定架构、接口、质量属性及语言专项检查内容,同时要求保留原文档结构。

主要功能

  1. 01检查组件代码与现有文档
  2. 02识别架构和 API 变更
  3. 03更新接口及用法示例
  4. 04复核质量属性与依赖项
  5. 05保留文档结构和历史记录

适用场景

  1. 01使组件文档与当前代码一致
  2. 02记录 API 和依赖项变更
  3. 03更新架构图与设计模式
  4. 04复核安全性和可靠性说明

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/github/awesome-copilot --skill update-oo-component-documentation

安装后在 Claude Code 中输入/update-oo-component-documentation确认已加载。

详细介绍

更新标准 OO 组件文档

通过分析对应组件代码,更新位于 ${file} 的现有文档文件。

从现有文档的 front matter(component_path 字段)中提取组件路径,或从文档内容中推断。分析当前组件实现并相应更新文档。

文档标准:

  • DOC-001:遵循 C4 模型文档层级(上下文、容器、组件、代码)
  • DOC-002:与 Arc42 软件架构文档模板保持一致
  • DOC-003:符合 IEEE 1016 软件设计描述标准
  • DOC-004:使用敏捷文档原则(恰到好处、能带来价值的文档)
  • DOC-005:以开发者和维护者为主要受众

分析说明:

  • ANA-001:阅读现有文档以了解组件上下文和结构
  • ANA-002:从 front matter 或内容分析中识别组件路径
  • ANA-003:检查当前源代码文件中的类结构和继承关系
  • ANA-004:将现有文档与当前实现进行对比
  • ANA-005:识别设计模式和架构变更
  • ANA-006:更新公共 API、接口和依赖
  • ANA-007:识别新增/变更的创建型/结构型/行为型模式
  • ANA-008:更新方法参数、返回值、异常
  • ANA-009:重新评估性能、安全性、可靠性、可维护性
  • ANA-010:更新集成模式和数据流

语言特定优化:

  • LNG-001:C#/.NET - async/await、依赖注入、配置、释放
  • LNG-002:Java - Spring 框架、注解、异常处理、打包
  • LNG-003:TypeScript/JavaScript - 模块、异步模式、类型、npm
  • LNG-004:Python - 包、虚拟环境、类型提示、测试

更新策略:

  • UPD-001:保留现有文档结构和格式
  • UPD-002:将 last_updated 字段更新为当前日期
  • UPD-003:如存在,在 front matter 中维护版本历史
  • UPD-004:若组件已显著扩展,添加新章节
  • UPD-005:标记已弃用功能或破坏性变更
  • UPD-006:更新示例以反映当前 API
  • UPD-007:刷新依赖列表和版本
  • UPD-008:更新 mermaid 图表以反映当前架构

错误处理:

  • ERR-001:文档文件不存在 - 提供文件位置指引
  • ERR-002:文档中未找到组件路径 - 请求澄清
  • ERR-003:源代码已移动 - 建议更新后的路径
  • ERR-004:重大架构变更 - 突出显示破坏性变更
  • ERR-005:源代码访问权限不足 - 记录限制

输出格式:

更新现有 Markdown 文件,保持其结构,同时刷新内容以匹配当前实现。保留格式、标题层级和现有组织决策。

所需文档结构:

按照相同的模板结构更新现有文档,确保所有章节反映当前实现:

---
title: [Component Name] - Technical Documentation
component_path: [Current component path]
version: [Updated version if applicable]
date_created: [Original creation date - preserve]
last_updated: [YYYY-MM-DD - update to current date]
owner: [Preserve existing or update if changed]
tags: [Update tags as needed based on current functionality]
---

# [Component Name] Documentation

[Update introduction to reflect current component purpose and capabilities]

## 1. Component Overview

### Purpose/Responsibility
- OVR-001: Update component's primary responsibility
- OVR-002: Refresh scope (included/excluded functionality)
- OVR-003: Update system context and relationships

## 2. Architecture Section

- ARC-001: Update design patterns used (Repository, Factory, Observer, etc.)
- ARC-002: Refresh internal and external dependencies with current purposes
- ARC-003: Update component interactions and relationships
- ARC-004: Update visual diagrams (UML class, sequence, component)
- ARC-005: Refresh mermaid diagram showing current component structure, relationships, and dependencies

### Component Structure and Dependencies Diagram

Update the mermaid diagram to show current:
- **Component structure** - Current classes, interfaces, and their relationships
- **Internal dependencies** - How components currently interact within the system
- **External dependencies** - Current external libraries, services, databases, APIs
- **Data flow** - Current direction of dependencies and interactions
- **Inheritance/composition** - Current class hierarchies and composition relationships

```mermaid
[Update diagram to reflect current architecture]

3. 接口文档

  • INT-001:更新所有公共接口和当前使用模式
  • INT-002:使用当前 API 刷新方法/属性参考表
  • INT-003:更新事件/回调/通知机制
方法/属性用途参数返回类型使用说明
[使用当前 API 更新表格]

4. 实现细节

  • IMP-001:更新主要实现类和当前职责
  • IMP-002:刷新配置要求和初始化模式
  • IMP-003:更新关键算法和业务逻辑
  • IMP-004:更新性能特征和瓶颈

5. 使用示例

基本用法
// Update basic usage example to current API
高级用法
// Update advanced configuration patterns to current implementation
  • USE-001:更新基本用法示例
  • USE-002:刷新高级配置模式
  • USE-003:更新最佳实践和推荐模式

6. 质量属性

  • QUA-001:更新安全性(认证、授权、数据保护)
  • QUA-002:刷新性能(特性、可扩展性、资源使用)
  • QUA-003:更新可靠性(错误处理、容错、恢复)
  • QUA-004:刷新可维护性(标准、测试、文档)
  • QUA-005:更新可扩展性(扩展点、自定义选项)

7. 参考信息

  • REF-001:更新依赖项及其当前版本和用途
  • REF-002:刷新配置选项参考
  • REF-003:更新测试指南和 mock 设置
  • REF-004:刷新故障排除(常见问题、错误消息)
  • REF-005:更新相关文档链接
  • REF-006:添加本次更新的变更历史和迁移说明

评论

支持 Markdown