搜索

PythonReactSEOPDF
GitHub Skill

doc-sync

Sync .claude/ documentation with code changes. Use when models/migrations/routes change, after completing features, or user says "update docs", "sync documentation", "docs out of date", "update DATABASE.md/API.md/TASKS.md".

GangWooLee☆ 0 仓库 Stars0 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Documentation Sync

Keep .claude/ docs current with code changes.

Quick Start

Task Progress (copy and check off):
- [ ] 1. Detect changes (git diff or user input)
- [ ] 2. Determine which docs to update
- [ ] 3. Read current schema/routes/code
- [ ] 4. Generate updated content
- [ ] 5. Update documentation files
- [ ] 6. Validate consistency

Target Documents

Doc Update When Content
DATABASE.md New models, migrations ERD, table schemas, indexes
API.md Routes, controllers Routes table, controller docs
TASKS.md Features complete Progress checkboxes, percentages
ARCHITECTURE.md Gems, services Tech stack, infrastructure

Auto-Detection

Map file changes to docs:

db/migrate/*.rb → DATABASE.md
db/schema.rb → DATABASE.md
app/models/*.rb → DATABASE.md, API.md
app/controllers/*.rb → API.md
config/routes.rb → API.md
Gemfile → ARCHITECTURE.md

DATABASE.md Updates

Generate ERD
┌─────────────────────┐
│       users         │
├─────────────────────┤
│ id (PK)             │
│ email (unique)      │
│ name                │
└─────────────────────┘
          │ 1
          │ has_many
          ▼ N
┌─────────────────────┐
│       posts         │
├─────────────────────┤
│ id (PK)             │
│ user_id (FK)        │
│ title               │
└─────────────────────┘
Table Schema

Read db/schema.rb and generate:

## users 테이블

| 컬럼명 | 타입 | Null | Default | 설명 |
|--------|------|------|---------|------|
| id | bigint | NO | AUTO | Primary Key |
| email | string | NO | - | 이메일 (unique) |
| name | string | NO | - | 사용자 이름 |

**인덱스**:
- UNIQUE INDEX index_users_on_email (email)

**연관관계**:
- has_many :posts
- has_many :comments

API.md Updates

Routes Table
rails routes --expanded

Parse into markdown:

| HTTP | Path | Controller#Action | 설명 |
|------|------|-------------------|------|
| GET | / | posts#index | 커뮤니티 홈 |
| GET | /posts/:id | posts#show | 게시글 상세 |
| POST | /posts | posts#create | 게시글 생성 |
Controller Actions

Document each action:

### PostsController#index

**경로**: `GET /posts`
**인증**: 불필요
**N+1 방지**: `includes(:user)`

TASKS.md Updates

Calculate Progress
total = 20
completed = 8
progress = (8.0 / 20 * 100).round  # => 40%

Update:

## 📊 전체 진행률

- 1주차: ✅✅✅✅✅ 100% (5/5)
- 2주차: ✅✅✅⬜⬜ 60% (3/5)

**전체**: 40% (8/20)
Mark Complete

Check git commits:

git log --grep="notification"

Update checkboxes:

- [x] User 모델 구현 ← 완료
- [x] 알림 시스템 ← 완료
- [ ] 이메일 인증 ← 진행 중

Validation

Compare code vs docs:

⚠️ 문서 불일치:

DATABASE.md:
  - Notification 모델이 코드에만 존재 (문서에 없음)

API.md:
  - /notifications routes가 문서에 없음

수정:
  - DATABASE.md에 Notification 추가
  - API.md에 notifications routes 추가

Automation Scripts

# Run database sync
ruby .claude/skills/doc-sync/scripts/sync_database_docs.rb

# Run API sync
bash .claude/skills/doc-sync/scripts/sync_api_docs.sh

Commands Reference

cat db/schema.rb           # Read schema
rails routes --expanded    # Get routes
ls app/models/*.rb         # List models
git diff HEAD~5            # Recent changes

Examples

New model added:

User: "I added Notification model, update docs"

Actions:
1. Read db/schema.rb for notifications table
2. Update DATABASE.md with ERD and schema
3. Run rails routes
4. Update API.md with notification routes
5. Mark task complete in TASKS.md

Routes changed:

Modified: config/routes.rb

Actions:
1. Run rails routes
2. Update API.md routes table

Checklist

  • DATABASE.md has all current tables
  • ERD shows relationships
  • API.md has all routes
  • TASKS.md progress updated
  • No broken references
  • Manual content preserved

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-26
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!