다언어 지원 docstring/코멘트를 체계적으로 관리하고, 고품질 문서를 유지합니다.
Generates and updates multilingual docstrings following language-specific best practices.
/plugin marketplace add wasabeef/claude-code-cookbook/plugin install cook-ko@claude-code-cookbook다언어 지원 docstring/코멘트를 체계적으로 관리하고, 고품질 문서를 유지합니다.
# 언어를 자동 검출해서 실행
「docstring 이 없는 클래스·함수에 추가하고, 기준을 만족하지 않는 코멘트를 업데이트하세요」
# 언어를 지정해서 실행
/update-doc-string --lang python
「Python 파일의 docstring 을 PEP 257 준수로 업데이트하세요」
# 특정 디렉터리의 문서 정비
「src/components/ 하위의 함수에 JSDoc 을 추가하세요」
--lang <en|ko> : 문서의 기술 언어(기본값: 기존 코멘트에서 자동 판정, 없으면 en)--style <스타일> : 문서 스타일을 지정(언어 고유의 기본값 있음)--marker <true|false> : Claude 마커를 부여할지(기본값: true)# 1. 대상 파일의 분석(프로그래밍 언어는 자동 검출)
find . -type f \( -name "*.py" -o -name "*.js" -o -name "*.ts" -o -name "*.dart" -o -name "*.go" -o -name "*.rs" \) | grep -v test
「docstring 이 부족한 요소(코멘트 행수 0 또는 30 자 미만)를 특정하세요」
# 2. 문서 추가(언어 자동 판정)
「특정된 요소에 언어 고유의 필수 요소를 포함하는 docstring 을 추가하세요」
# → 기존 코멘트에 한국어가 있으면 한국어로, 없으면 영어로 기술
# 3. 문서 추가(명시적으로 영어 지정)
/update-doc-string --lang en
「Add docstrings with required elements to the identified elements」
# 4. 마커 확인
「추가·업데이트한 모든 docstring 에 Claude 마커가 있는지 확인하세요」
대상 요소(언어 공통):
Python (PEP 257):
# 한국어판(기본값)
def calculate_total(items: List[Item]) -> float:
"""아이템 리스트의 합계 금액을 계산합니다.(30-60 자)
각 아이템의 가격과 수량을 곱하여, 세금 포함 합계를 반환합니다.
빈 리스트의 경우 0.0 을 반환합니다.(50-200 자)
Args:
items: 계산 대상의 아이템 리스트
Returns:
세금 포함 합계 금액
Generated by Claude 🤖
"""
# 영어판(--lang en)
def calculate_total(items: List[Item]) -> float:
"""Calculate the total amount for a list of items. (30-60 chars)
Multiplies the price and quantity of each item and returns
the total with tax. Returns 0.0 for empty lists. (50-200 chars)
Args:
items: List of items to calculate
Returns:
Total amount with tax
Generated by Claude 🤖
"""
JavaScript/TypeScript (JSDoc):
/**
* 사용자 프로필을 표시하는 컴포넌트입니다.(30-60 자)
*
* 아바타 이미지, 사용자명, 상태 정보를 표시하고,
* 클릭 시 프로필 상세 화면으로 전환합니다.(50-200 자)
*
* @param {Object} props - 컴포넌트의 프로퍼티
* @param {string} props.userId - 사용자 ID
* @param {boolean} [props.showStatus=true] - 상태 표시 플래그
* @returns {JSX.Element} 렌더링된 컴포넌트
*
* @generated by Claude 🤖
*/
const UserProfile = ({ userId, showStatus = true }) => {
Go:
// CalculateTotal 은 아이템 리스트의 합계 금액을 계산합니다.(30-60 자)
//
// 각 아이템의 가격과 수량을 곱하여, 세금 포함 합계를 반환합니다.
// 빈 슬라이스의 경우 0.0 을 반환합니다.(50-200 자)
//
// Generated by Claude 🤖
func CalculateTotal(items []Item) float64 {
Rust:
/// 아이템 리스트의 합계 금액을 계산합니다.(30-60 자)
///
/// 각 아이템의 가격과 수량을 곱하여, 세금 포함 합계를 반환합니다.
/// 빈 벡터의 경우 0.0 을 반환합니다.(50-200 자)
///
/// Generated by Claude 🤖
pub fn calculate_total(items: &[Item]) -> f64 {
Dart (DartDoc):
/// 사용자 프로필을 표시하는 Widget 입니다.(30-60 자)
///
/// 아바타 이미지, 사용자명, 상태 정보를 세로로 배치하고,
/// 탭 시 프로필 상세 화면으로 전환합니다.(50-200 자)
///
/// Generated by Claude 🤖
class UserProfileWidget extends StatelessWidget {
보존해야 할 중요 정보:
See also:, @see, 참조: 등TODO:, FIXME:, XXX: 형식Note:, Warning:, 주의: 등Example:, 예:, # Examples 등# 언어별 기본 설정
languages:
python:
style: "google" # google, numpy, sphinx
indent: 4
quotes: '"""'
javascript:
style: "jsdoc"
indent: 2
prefix: "/**"
suffix: "*/"
typescript:
style: "tsdoc"
indent: 2
prefix: "/**"
suffix: "*/"
go:
style: "godoc"
indent: 0
prefix: "//"
rust:
style: "rustdoc"
indent: 0
prefix: "///"
dart:
style: "dartdoc"
indent: 0
prefix: "///"
🔴 절대 금지사항:
실행과 검증:
# 실행 결과의 기록
ADDED_COMMENTS=0
UPDATED_COMMENTS=0
ERRORS=0
# 기존 코멘트에서 언어를 자동 판정
# 한국어 문자(한글)를 검출하면 ko, 그 외는 en
DOC_LANGUAGE="en" # 기본값
if grep -r '[가-힣]' --include="*.py" --include="*.js" --include="*.ts" --include="*.dart" --include="*.go" --include="*.rs" . 2>/dev/null | head -n 1; then
DOC_LANGUAGE="ko"
fi
# 프로그래밍 언어의 자동 검출과 정적 분석
if [ -f "*.py" ]; then
pylint --disable=all --enable=missing-docstring .
elif [ -f "*.js" ] || [ -f "*.ts" ]; then
eslint . --rule 'jsdoc/require-jsdoc: error'
elif [ -f "*.go" ]; then
golint ./...
elif [ -f "*.rs" ]; then
cargo doc --no-deps
elif [ -f "*.dart" ]; then
melos analyze
fi
if [ $? -ne 0 ]; then
echo "🔴 에러: 정적 분석이 실패했습니다"
exit 1
fi
# 실행 요약의 출력
echo "📊 실행 결과:"
echo "- 문서 언어: $DOC_LANGUAGE"
echo "- 추가한 코멘트: $ADDED_COMMENTS 건"
echo "- 업데이트한 코멘트: $UPDATED_COMMENTS 건"
echo "- 에러 발생 수: $ERRORS 건"
완료 판정: 다음을 모두 만족하는 경우에 성공
부분 성공: 다음의 경우
실패: 다음의 경우
# 프로젝트 전체의 분석(언어 자동 판정)
find . -type f \( -name "*.py" -o -name "*.js" -o -name "*.ts" \)
/update-doc-string
「이 프로젝트의 docstring 을 언어별 베스트 프랙티스에 따라 업데이트하세요」
# → 기존 코멘트에 한국어가 있으면 ko, 없으면 en 으로 실행
# 명시적으로 영어 문서로 실행
/update-doc-string --lang en
"Update docstrings following language-specific best practices"
# 명시적으로 한국어 문서로 실행
/update-doc-string --lang ko
「이 프로젝트의 docstring 을 언어별 베스트 프랙티스에 따라 업데이트하세요」
# 마커 없이 실행(언어 자동 판정)
/update-doc-string --marker false
"Improve existing docstrings without adding Claude markers"
# 영어 문서, 마커 없음
/update-doc-string --lang en --marker false
"Improve existing docstrings without adding Claude markers"