/update-doc-string
Systematically manage multilingual docstrings/comments and maintain high-quality documentation.
> /plugin marketplace add wasabeef/claude-code-cookbookHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/update-doc-string
Context preview
What this command does when you run it.
Systematically manage multilingual docstrings/comments and maintain high-quality documentation.
Command definition
update-doc-string.mdManage multilingual docstrings and comments
Systematically manage multilingual docstrings/comments and maintain high-quality documentation.
Usage
# Run with automatic language detection
"Please add docstrings to classes and functions without them, and update comments that don't meet standards"
# Run with specified language
/update-doc-string --lang python
"Please update docstrings in Python files to comply with PEP 257"
# Maintain documentation for specific directories
"Please add JSDoc to functions under src/components/"
Options
- `--lang <language>` : Documentation language (default: en)
- `--style <style>` : Specify documentation style (has language-specific defaults)
- `--marker <true|false>` : Whether to add Claude markers (default: true)
Basic Examples
# 1. Analyze target files (programming language is auto-detected)
find . -type f \( -name "*.py" -o -name "*.js" -o -name "*.ts" -o -name "*.dart" -o -name "*.go" -o -name "*.rs" \) | grep -v test
"Please identify elements with insufficient docstrings (0 comment lines or fewer than 30 characters)"
# 2. Add documentation (uses English by default)
"Please add docstrings containing language-specific required elements to the identified elements"
# β Uses English for all documentation
# 3. Add documentation (explicitly specify English)
/update-doc-string --lang en
"Add docstrings with required elements to the identified elements"
# 4. Check markers
"Please confirm that all added/updated docstrings have Claude markers"
Execution Steps
1. Priority of Target Elements
1. π΄ **Highest Priority**: Elements without docstrings/comments (0 comment lines) 2. π‘ **Next Priority**: Elements not meeting standards (fewer than 30 characters or missing required elements) 3. π’ **Verification Target**: Existing comments without Claude markers
**Target Elements (Common Across Languages)**:
- Class definitions
- Functions/methods
- Modules (Python, Go)
- Enums
- Interfaces (TypeScript, Go)
2. Language-Specific Documentation Rules
**Python (PEP 257)**:
# English version (default)
def calculate_total(items: List[Item]) -> float:
"""Calculate the total amount for a list of items. (30-60 characters)
Multiplies the price and quantity of each item and returns
the total with tax. Returns 0.0 for empty lists. (50-200 characters)
Args:
items: List of items to calculate
Returns:
Total amount with tax
Generated by Claude π€
"""
# English version (--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)**:
/**
* Component that displays a user profile. (30-60 characters)
*
* Displays avatar image, username, and status information,
* and navigates to the profile detail screen when clicked. (50-200 characters)
*
* @param {Object} props - Component properties
* @param {string} props.userId - User ID
* @param {boolean} [props.showStatus=true] - Status display flag
* @returns {JSX.Element} Rendered component
*
* @generated by Claude π€
*/
const UserProfile = ({ userId, showStatus = true }) => {**Go**:
// CalculateTotal calculates the total amount for a list of items. (30-60 characters)
//
// Multiplies the price and quantity of each item and returns
// the total with tax. Returns 0.0 for empty slices. (50-200 characters)
//
// Generated by Claude π€
func CalculateTotal(items []Item) float64 {**Rust**:
/// Calculate the total amount for a list of items. (30-60 characters)
///
/// Multiplies the price and quantity of each item and returns
/// the total with tax. Returns 0.0 for empty vectors. (50-200 characters)
///
/// Generated by Claude π€
pub fn calculate_total(items: &[Item]) -> f64 {**Dart (DartDoc)**:
/// Widget that displays a user profile. (30-60 characters)
///
/// Vertically arranges avatar image, username, and status information,
/// and navigates to the profile detail screen when tapped. (50-200 characters)
///
/// Generated by Claude π€
class UserProfileWidget extends StatelessWidget {3. Existing Content Retention Rules
1. **If existing comments meet standards**: Keep as-is (do not add new ones)
- Standards: At least 30 characters and includes required elements (summary, details, marker)
2. **If existing comments do not meet standards**: Completely replace (no duplication) 3. **If no existing comments**: Add new comments
**Important Information to Retain**:
- URLs and links: `See also:`, `@see`, `References:` etc.
- TODO comments: `TODO:`, `FIXME:`, `XXX:` format
- Notes: `Note:`, `Warning:`, `Important:` etc.
- Examples: `Example:`, `Usage:`, `# Examples` etc.
- Existing parameter and return value descriptions
Language-Specific Settings
# Language-specific default settings
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: "///"Quality Checklist
- β
**Character Count**: Strictly adhere to 30-60 characters for summary, 50-200 for details
- β
**Required Elements**: Always include summary, detailed description, and Claude marker
- β
**Completeness**: Describe role, usage context, and notes
- β
**Language Conventions**: Comply with official style guides for each language
- β
**Exceptions**:
Read more
Manage multilingual docstrings and comments
Systematically manage multilingual docstrings/comments and maintain high-quality documentation.
Usage
# Run with automatic language detection "Please add docstrings to classes and functions without them, and update comments that don't meet standards" # Run with specified language /update-doc-string --lang python "Please update docstrings in Python files to comply with PEP 257" # Maintain documentation for specific directories "Please add JSDoc to functions under src/components/"
Options
- `--lang <language>` : Documentation language (default: en)
- `--style <style>` : Specify documentation style (has language-specific defaults)
- `--marker <true|false>` : Whether to add Claude markers (default: true)
Basic Examples
# 1. Analyze target files (programming language is auto-detected) find . -type f \( -name "*.py" -o -name "*.js" -o -name "*.ts" -o -name "*.dart" -o -name "*.go" -o -name "*.rs" \) | grep -v test "Please identify elements with insufficient docstrings (0 comment lines or fewer than 30 characters)" # 2. Add documentation (uses English by default) "Please add docstrings containing language-specific required elements to the identified elements" # β Uses English for all documentation # 3. Add documentation (explicitly specify English) /update-doc-string --lang en "Add docstrings with required elements to the identified elements" # 4. Check markers "Please confirm that all added/updated docstrings have Claude markers"
Execution Steps
1. Priority of Target Elements
1. π΄ **Highest Priority**: Elements without docstrings/comments (0 comment lines) 2. π‘ **Next Priority**: Elements not meeting standards (fewer than 30 characters or missing required elements) 3. π’ **Verification Target**: Existing comments without Claude markers
**Target Elements (Common Across Languages)**:
- Class definitions
- Functions/methods
- Modules (Python, Go)
- Enums
- Interfaces (TypeScript, Go)
2. Language-Specific Documentation Rules
**Python (PEP 257)**:
# English version (default)
def calculate_total(items: List[Item]) -> float:
"""Calculate the total amount for a list of items. (30-60 characters)
Multiplies the price and quantity of each item and returns
the total with tax. Returns 0.0 for empty lists. (50-200 characters)
Args:
items: List of items to calculate
Returns:
Total amount with tax
Generated by Claude π€
"""
# English version (--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)**:
/**
* Component that displays a user profile. (30-60 characters)
*
* Displays avatar image, username, and status information,
* and navigates to the profile detail screen when clicked. (50-200 characters)
*
* @param {Object} props - Component properties
* @param {string} props.userId - User ID
* @param {boolean} [props.showStatus=true] - Status display flag
* @returns {JSX.Element} Rendered component
*
* @generated by Claude π€
*/
const UserProfile = ({ userId, showStatus = true }) => {**Go**:
// CalculateTotal calculates the total amount for a list of items. (30-60 characters)
//
// Multiplies the price and quantity of each item and returns
// the total with tax. Returns 0.0 for empty slices. (50-200 characters)
//
// Generated by Claude π€
func CalculateTotal(items []Item) float64 {**Rust**:
/// Calculate the total amount for a list of items. (30-60 characters)
///
/// Multiplies the price and quantity of each item and returns
/// the total with tax. Returns 0.0 for empty vectors. (50-200 characters)
///
/// Generated by Claude π€
pub fn calculate_total(items: &[Item]) -> f64 {**Dart (DartDoc)**:
/// Widget that displays a user profile. (30-60 characters)
///
/// Vertically arranges avatar image, username, and status information,
/// and navigates to the profile detail screen when tapped. (50-200 characters)
///
/// Generated by Claude π€
class UserProfileWidget extends StatelessWidget {3. Existing Content Retention Rules
1. **If existing comments meet standards**: Keep as-is (do not add new ones)
- Standards: At least 30 characters and includes required elements (summary, details, marker)
2. **If existing comments do not meet standards**: Completely replace (no duplication) 3. **If no existing comments**: Add new comments
**Important Information to Retain**:
- URLs and links: `See also:`, `@see`, `References:` etc.
- TODO comments: `TODO:`, `FIXME:`, `XXX:` format
- Notes: `Note:`, `Warning:`, `Important:` etc.
- Examples: `Example:`, `Usage:`, `# Examples` etc.
- Existing parameter and return value descriptions
Language-Specific Settings
# Language-specific default settings
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: "///"Quality Checklist
- β **Character Count**: Strictly adhere to 30-60 characters for summary, 50-200 for details
- β **Required Elements**: Always include summary, detailed description, and Claude marker
- β **Completeness**: Describe role, usage context, and notes
- β **Language Conventions**: Comply with official style guides for each language
- β **Exceptions**:
A collection of commands, roles, and automation scripts for Claude Code. Automate your workflow without unnecessary confirmations, allowing you to focus on what matters.
Repo: wasabeef/claude-code-cookbook
Other commands on claude-code-cookbook.
- /analyze-dependencies
Analyzes your project's dependencies and checks architecture health.
Open command - /analyze-performance
Analyzes application performance from a user experience perspective and quantifies experience improvements from optimizations. Calculates UX scores based on Core Web Vitals and proposes prioritized optimization strategies.
Open command - /check-fact
Verifies if a statement is true by checking your project's code and documentation.
Open command - /check-prompt
A comprehensive collection of best practices for evaluating and improving the quality of prompts for AI Agents. It systematizes knowledge gained from actual prompt improvement processes, covering all important aspects such as ambiguity elimination, information integration,
Open command - /commit-message
Generates commit messages from staged changes (git diff --staged). This command only creates messages and copies them to your clipboardβit doesn't run any git commands.
Open command - /context7
Searches technical documentation using MCP's Context7.
Open command

