Skip to content
Skills Library
Programming · Analysis

code-comments

/code-comments

Extract comment locations from code files for analysis. Use when cleaning comments, auditing documentation, or analyzing comment patterns across languages.

Repository
rp1 ↗
Licence
Apache-2.0
Last repository change
25.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
1
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 25.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What to check before installing
  • SKILL.md zawiera komentarze HTML (1). Nie widać ich w podglądzie Markdown, a model je czyta.

What it does and when to use it

Extract comment locations from code files for analysis. Use when cleaning comments, auditing documentation, or analyzing comment patterns across languages.

Original author description

Extract comment locations from code files for analysis. Use when cleaning comments, auditing documentation, or analyzing comment patterns across languages.

How it works

  1. What This Skill Does
  2. When to Use
  3. Supported Languages
  4. Usage
  5. Error Handling
  6. Integration
  7. Limitations
Original SKILL.md headings · 171 lines, 715 words
SKILL.md preview
---
name: code-comments
description: Extract comment locations from code files for analysis. Use when cleaning comments, auditing documentation, or analyzing comment patterns across languages.
allowed-tools: Bash, Read
metadata:
  category: quality
  is_workflow: false
---

# Comments Extraction Skill

Extract comment locations from manifest-owned code lines for analysis by the comment-cleaner agent.

## What This Skill Does

- Detects comments inside a tightly scoped change manifest
- Extracts all comments with line numbers and context
- Outputs structured JSON for downstream processing
- Supports multiple programming languages

## When to Use

Activate this skill when:

- Preparing manifest-owned comment cleanup operations
- Auditing code documentation coverage
- Analyzing comment patterns in a codebase
- Working with the comment-cleaner agent

## Supported Languages

| Extension | Single-line | Multi-line |
|-----------|-------------|------------|
| `.py`, `.sh`, `.rb`, `.yml`, `.yaml` | `#` | N/A |
| `.js`, `.ts`, `.tsx`, `.jsx`, `.go`, `.rs`, `.java`, `.kt`, `.swift`, `.c`, `.cpp`, `.h`, `.hpp` | `//` | `/* */` |
| `.html`, `.xml`, `.vue`, `.svelte` | N/A | `<!-- -->` |
| `.css`, `.scss`, `.less` | N/A | `/* */` |
| `.php` | `//`, `#` | `/* */` |

## Usage

### Extract Comments from a Change Manifest

Use a generated or validated change manifest as the cleanup boundary. This
skill extracts comments inside that boundary; it does not decide which files or
lines are cleanup-owned.

```bash
# Required for comment-cleaner
rp1 agent-tools comment-extract manifest manifest --change-manifest .rp1/work/features/example/change-manifest-001.json --code-root .
```

Manifest shape:

```json
{
  "version": 1,
  "source": "build",
  "codeRoot": "/absolute/path/to/repo",
  "files": [
    {
      "path": "src/auth.ts",
      "ownedHunks": [{ "startLine": 20, "endLine": 28 }],
      "allowedOperations": ["remove_comments"]
    }
  ]
}
```

Generated manifests can come from `/build`, `/build-fast`, or
`/code-clean-comments`. Build workflows generate manifests from their recorded
baseline; standalone cleanup uses `rp1 agent-tools change-manifest generate`
with `--source code-clean-comments --scope ...` to convert file, directory,
git ref, git range, or existing-manifest input into the same manifest shape.

### Audit-Only Git Scopes

Git scopes remain available for audit/reporting use. Do not use them as a
comment-cleaner cleanup boundary. For cleanup, first generate a change manifest
and then extract with `--change-manifest`.

```bash
rp1 agent-tools comment-extract branch main
rp1 agent-tools comment-extract unstaged main
rp1 agent-tools comment-extract "abc123..def456" main --line-scoped
```

### Output Format

```json
{
  "success": true,
  "tool": "comment-extract",
  "data": {
    "scope": "manifest",
    "base": "manifest",
    "filesScanned": 1,
    "linesAdded": 11,
    "lineScoped": true,
    "changeManifest": ".rp1/work/features/example/change-manifest-001.json",
    "comments": [
      {
        "file": "src/auth.py",
        "line": 45,
        "type": "single",
        "content": "# Check if user is active",
        "contextBefore": "def validate_user(user):",
        "contextAfter": "    if user.is_active:"
      }
    ]
  }
}
```

### Output Fields

| Field | Description |
|-------|-------------|
| `success` | Whether extraction completed successfully |
| `tool` | Tool name (`comment-extract`) |
| `data.scope` | The extraction scope used (`manifest`, `branch`, `unstaged`, or commit range); only `manifest` is valid for cleanup |
| `data.base` | Base branch for comparison, or `manifest` for manifest extraction |
| `data.filesScanned` | Number of files processed |
| `data.linesAdded` | Total lines added in diff, or manifest-owned line count |
| `data.lineScoped` | Whether line-scoped filtering was applied |
| `data.changeManifest` | Manifest path used for extraction, when applicable |
| `data.comments` | Array of comment objects |
| `data.comments[].file` | Relative file path |
| `data.comments[].line` | Line number (1-indexed) |
| `data.comments[].type` | Comment type (`single` or `multi`) |
| `data.comments[].content` | The comment text |
| `data.comments[].contextBefore` | Line before the comment |
| `data.comments[].contextAfter` | Line after the comment |

## Error Handling

The tool handles:

- Git command failures (not a repo, invalid branch)
- Missing files (deleted in working tree)
- Binary files (automatically skipped)
- Encoding issues (UTF-8)

Error output format:

```json
{
  "success": false,
  "tool": "comment-extract",
  "data": {
    "scope": "branch",
    "base": "main",
    "filesScanned": 0,
    "linesAdded": 0,
    "comments": []
  },
  "errors": [{ "message": "Not a git repository" }]
}
```

## Integration

This skill is used by the `comment-cleaner` agent to:

1. Get a manifest-owned list of comments
2. Avoid reading entire files for comment detection
3. Process comments efficiently with context and line/hunk boundaries

The `comment-cleaner` agent should call this skill through the manifest path it
was given. It should not pass branch names, commit ranges, dirty-state labels,
or task-builder-authored hunks as cleanup authority.

## Limitations

- Does not detect comments inside string literals (best effort)
- Multi-line string docstrings in Python are not extracted (intentional - docstrings are kept)
- Very large files (>10000 lines) are skipped to prevent memory issues
- Manifest cleanup includes multi-line comments only when every comment line is inside owned lines/hunks

Versions

RepositoryScoreLicence
This page · rp1-run/rp1100Apache-2.0
zenobi-us/dotfiles100MIT
petekp/claude-code-setup100MIT
portabletext/editor100MIT
caidanw/skills100MIT
caidanw/skills100MIT
izumin5210/dotfiles95MIT
overmind-core/overmind90AGPL-3.0
Amey-Thakur/AI-SKILLS90MIT

Database snapshot: 13.11.2026 · package version 16e5f378710c (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 82code-quality
    Use when writing or reviewing code, comments, tests, or docs.
  • 100comments-docs
    Reviews comment quality and documentation practices: the four comment types, comments-first workflow, and comment rot. Use when reviewing comments or docs, when comments just repeat the code, or when something is hard to describe in a sentence. Not for naming or code obviousness…
  • 100wise-code-comments
    Code-comment rules for EVERY comment and docstring written on the user's behalf in ANY programming language. ALWAYS consult this skill before writing, rewriting, or reviewing a code comment, docstring, or inline annotation - whether adding comments to new code, editing code that…
  • 100write-comments
    Apply codebase commenting conventions for TypeScript, Python, and any language. USE WHEN writing or reviewing comments, adding section comments, organizing code into logical groups, or asked about comment style. Covers when to comment, how to write good comments, section comment…
  • 90lantern-no-comments
    Use whenever writing, editing, or reviewing code and tempted to add a comment. Default to self-explanatory code — no comments that describe what a function/module/line does, no doc-blocks, no commented-out code. Comment ONLY for the non-obvious WHY: workarounds, gotchas,…
  • 100comments
    Comment rules for every language: which comments survive, format, protected comments, placement, TODOs. Use when writing, editing, moving or deleting comments, docstrings or TODOs. Auto-invoke when editing code files.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.