code-commenting-strategy

A strategic approach to code commenting that covers when to add comments, optimizing comment density, considering performance impacts, and integrating comments into the development workflow. Suitable for creating commenting policies, addressing performance concerns, or applying PPP.

Last repository push
GitHub Stars
140
Forks
36
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "code-commenting-strategy" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-ca2d14ff960395546fe3baeb2d419611c8ee523bb472f2a94022e6ac611e4830. Verify the upstream source and version against https://github.com/kitchen-engineer42/pdf2skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

A strategic approach to code commenting that covers when to add comments, optimizing comment density, considering performance impacts, and integrating comments into the development workflow. Suitable for creating commenting policies, addressing performance concerns, or applying PPP.

0 Downloads

Introduction source: third_party · kitchen-engineer42 · 0.0.1 Reference

SkillPi interpretation

Tasks
Apply strategic approaches to code commenting including when to comment, optimal comment density, performance considerations, and integration with development workflow. Use when establishing commenting standards, addressing performance concerns, implementing Pseudocode Programming Process (PPP), or determining appropriate comment frequency.
Audience
Establishing or updating code commenting standards for a project Addressing concerns about comment performance impact Implementing Pseudocode Programming Process (PPP) Determining optimal comment density for codebases Training developers on commenting best practices
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: code-commenting-strategy
description: Apply strategic approaches to code commenting including when to comment, optimal comment density, performance considerations, and integration with development workflow. Use when establishing commenting standards, addressing performance concerns, implementing Pseudocode Programming Process (PPP), or determining appropriate comment frequency.

Code Commenting Strategy

When to Use This Skill

  • Establishing or updating code commenting standards for a project
  • Addressing concerns about comment performance impact
  • Implementing Pseudocode Programming Process (PPP)
  • Determining optimal comment density for codebases
  • Training developers on commenting best practices

Core Principles

1. Integrate Comments with Development Workflow

Write comments synchronously with code, not as a separate task.

Why delay comments?

  • Perceived workload: Commenting at the end becomes a separate, overwhelming task
  • Time cost: Requires recalling or re-understanding code logic
  • Accuracy loss: Design assumptions and nuances are forgotten

Handling the "interruption" objection:

  • If commenting interrupts your coding flow, this is a warning sign of complexity
  • Use pseudocode for design first
  • Convert pseudocode to comments
  • Fill in the code implementation
  • High concentration needs indicate overly complex design—simplify first

2. Performance Considerations

For interpreted languages and resource-constrained environments:

  • Comments can add measurable performance overhead
  • Never skip comments to improve performance
  • Create separate build/release versions
  • Use build tools to strip comments during the build process

For compiled languages:

  • Comments are typically stripped automatically during compilation
  • No performance impact concern

3. Optimal Comment Density

Research-based guideline:

  • IBM research shows clarity peaks at approximately 1 comment per 10 statements
  • Below this density: Code becomes difficult to understand
  • Above this density: Also reduces code comprehensibility

Avoid arbitrary standards:

  • Don't use mandatory rules like "1 comment per 5 lines"
  • Arbitrary standards address symptoms, not root causes
  • Focus on code clarity, not comment quotas

4. Pseudocode Programming Process (PPP) Integration

When using PPP effectively:

  • You may naturally achieve high comment density (every few lines)
  • This is a side effect, not a goal
  • Focus on efficiency, not quantity

Evaluate each comment:

  • Does it describe why the code was written?
  • Does it meet established quality standards?
  • If yes, you have sufficient comments

Decision Flow

IF writing code
    THEN write comments synchronously
    IF concentration is too high for commenting
        THEN simplify design using pseudocode first

IF concerned about comment performance
    IF compiled language
        THEN no action needed (auto-stripped)
    IF interpreted language
        THEN implement build-time comment stripping

IF evaluating comment density
    THEN aim for ~1 comment per 10 statements
    Avoid arbitrary minimum quotas

IF using PPP
    THEN focus on comment efficiency (describing "why")
    Not on achieving specific quantity

Warning Signs

  • Coding requires such extreme concentration that commenting feels disruptive
  • Comment density significantly deviates from 1:10 ratio without justification
  • Comments are treated as a separate "cleanup" phase
  • Performance concerns lead to reduced commenting

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value78/100

Highlights

  • 提供基于研究的注释密度指导(1:10),解决开发者常见困惑
  • 覆盖编译型与解释型语言的性能差异处理方案
  • 集成伪代码编程流程(PPP)提升开发效率
Trigger Precision85/100

Highlights

  • description 明确列出四大使用场景,边界清晰
  • When to Use 章节进一步细化触发条件
Structure and Standards92/100

Highlights

  • 结构完整:原则→决策流→警告信号,逻辑闭环
  • 决策流程图提供清晰的执行路径
  • frontmatter 完整且符合规范
Execution Reliability95/100

Highlights

  • 策略基于 IBM 研究数据,可信度高
  • 针对不同技术栈给出差异化解决方案
  • 覆盖主要异常场景(如高专注度、性能顾虑)
Evidence Verifiability (mean of the first four)88/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.