Official agent skill

Commenting C And Python

by microsoft in microsoft/bocpy

Follow bocpy commenting and documentation conventions. An agent skill from microsoft/bocpy.

OfficialMITAuto-check passedDevelopment

Install Commenting C And Python

skills CLI
$ npx skills add microsoft/bocpy --skill commenting-c-and-python -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install microsoft/bocpy commenting-c-and-python --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/microsoft/bocpy.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/commenting-c-and-python .claude/skills/commenting-c-and-python && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
commenting-c-and-python
GitHub stars
200
Token cost
~3.3k tokens
SKILL.md length
1,063 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
MIT

At a glance

Follow bocpy commenting and documentation conventions. An agent skill from microsoft/bocpy.

  • Works in 5 steps: @brief — one-line summary (sentence… → @details — optional longer explanation → @note — optional caveats or side-effects → …
  • : adding comments to C
  • SKILL.md covers C Files (_core.c, _math.c), Python Files, Linting Rules (flake8) and Quick Reference, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Commenting C And Python is an agent skill from microsoft/bocpy, published by the product's own GitHub organization. Follow bocpy commenting and documentation conventions. Use when: adding comments to C or Python files, writing docstrings, documenting structs or classes, adding Doxygen doc-comments, using Sphinx param style, suppressing linter warnings with noqa, or following flake8 style rules (Q000, D205, D209, N802).

Its SKILL.md is about 3.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Technical documentation, Linting and formatting and Plain language and style rules. It works with Python. The repository describes itself as: Behavior-Oriented Concurrency in Python. The licence is MIT.

When your agent uses it

  • : adding comments to C
  • Writing docstrings
  • Documenting structs
  • Adding Doxygen doc-comments

Example prompts

  • “/commenting-c-and-python”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. @brief — one-line summary (sentence case, no trailing period)
  2. @details — optional longer explanation
  3. @note — optional caveats or side-effects
  4. @param — one per parameter (description starts uppercase)
  5. @return — what the function returns

What it can do on your machine

Read from SKILL.md and the folder at commit c8f3ceb. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python and c).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Commenting C And Python loads about 3.3k tokens when it runs. Until then it costs about 83 tokens; SKILL.md has 1,063 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~83
When it runs · the whole SKILL.md, loaded when a task matches
~3.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from microsoft/bocpy at commit c8f3ceb, republished under its MIT licence (© microsoft). 1,063 words, ~3,291 tokens.

Download SKILL.mdSave it as .claude/skills/commenting-c-and-python/SKILL.md (or your agent's skills folder).
name
commenting-c-and-python
description
Follow bocpy commenting and documentation conventions. Use when: adding comments to C or Python files, writing docstrings, documenting structs or classes, adding Doxygen doc-comments, using Sphinx param style, suppressing linter warnings with noqa, or following flake8 style rules (Q000, D205, D209, N802).

Commenting C and Python Files

This skill describes the commenting conventions used across the bocpy project. Follow these patterns when adding or editing comments so the codebase stays consistent.

C Files (_core.c, _math.c)

Function-Level Documentation — Doxygen /// Style

Every non-trivial function gets a Doxygen doc-comment block immediately above its signature. Use triple-slash /// lines with @ tags in this order:

  1. @brief — one-line summary (sentence case, no trailing period)
  2. @details — optional longer explanation
  3. @note — optional caveats or side-effects
  4. @param — one per parameter (description starts uppercase)
  5. @return — what the function returns
c
/// @brief Creates a new BOCTag object from a Python Unicode string
/// @details The result object will not be dependent on the argument in any way
/// (i.e., it can be safely deallocated).
/// @param unicode A PyUnicode object
/// @param queue The queue to associate with this tag
/// @return a new BOCTag object
BOCTag *tag_from_PyUnicode(PyObject *unicode, BOCQueue *queue) {

For short helper functions, @brief alone is enough:

c
/// @brief Convenience method to obtain the interpreter ID
/// @return the ID of the currently running interpreter
static inline PY_INT64_T get_interpid() {
Struct Field Documentation

Document struct fields with /// @brief (and optionally /// @details) on the line(s) above the field:

c
typedef struct boc_message {
  /// @brief The tag associated with this message.
  /// @details This will be used by processes calling receive() and will create
  /// an affinity with a queue.
  struct boc_tag *tag;
  /// @brief whether the contents of this message were pickled
  bool pickled;
  /// @brief the threadsafe cross-interpreter data (the contents of the message)
  XIDATA_T *xidata;
} BOCMessage;
Inline Comments — // Style

An inline comment defaults to a single line of at most 120 characters, or it is deleted. Verbose multi-line inline comments rot as the code beneath them changes and make the code harder to read, not easier. Place the comment on the line above the code it describes, at the current indentation level:

c
  // swap the new node in as the new head
  node->next = head;

A multi-line // inline comment is permitted only when it records something the code cannot express and that does not fit on one line: a non-obvious concurrency invariant (2PL lock ordering, MCS handoff, memory-ordering rationale), the rationale above a version-gate #if/#elif ladder, an X-macro / clang-format off table boundary, or a reference anchor that needs a line of context. When in doubt, collapse to one line. (Doxygen /// / /** */ doc-blocks are documentation, not inline comments, and are exempt from this rule — they may carry in-depth prose.)

End-of-line // comments are reserved for preprocessor version annotations:

c
#if PY_VERSION_HEX >= 0x030E0000 // 3.14
/* */ Block Comments — Sentinel Only

Traditional block comments are used exclusively as sentinel markers in PyMethodDef and slot arrays:

c
    {NULL} /* Sentinel */

Do not use /* */ for any other purpose.

Exception: X-macro descriptor tables

Multi-line /* */ blocks immediately above an X(...)-style descriptor table (e.g. the BOC_AGG_OPS, BOC_BINARY_OPS, BOC_UNARY_OPS, BOC_2AGG_OPS tables in src/bocpy/_math.c) are permitted as an exception to the sentinel-only rule. The block must list: (1) the family's purpose, (2) how to add a new op, (3) the stamped symbol-naming scheme, and (4) the names in scope inside the per-op expression.

Method Table Doc Strings

Short one-phrase descriptions in PyMethodDef tables:

c
static PyMethodDef CownCapsule_methods[] = {
    {"get", CownCapsule_get, METH_NOARGS, "internal"},
    {"set", CownCapsule_set, METH_VARARGS, "internal"},
    {"bid", BehaviorCapsule_bid, METH_NOARGS, "Gets the ID for the behavior"},
};
Module Doc String

Set .m_doc in the PyModuleDef to a short description:

c
    .m_doc = "Provides the underlying C implementation for the core BOC "
             "functionality",
TODO Comments

Use // TODO on its own line, followed by the item(s):

c
// TODO
// invert 2x2, 3x3, general algorithm for NxN
// det
// trace

Python Files

Module-Level Docstring

Every .py file starts with a single-line triple-quoted docstring. Sentence case, ends with a period.

python
"""Behavior-oriented Concurrency."""
python
"""AST transformers that export when-decorated functions as behaviors."""
Class Docstrings

Use a triple-quoted docstring immediately after the class statement. For simple classes, a single-line docstring is preferred. For complex classes, use a summary line, a blank line, then a longer description. Sentence case, ends with a period.

python
class Cown(Generic[T]):
    """Lightweight wrapper around the underlying cown capsule."""
python
class MainModuleBinder(ast.NodeTransformer):
    """Prepares a main module for transpiling.

    This transformer collects the names of classes, functions, imports,
    and filters out everything else at the root level.
    """
Function / Method Docstrings

Start with a verb in imperative mood. Single-line for simple functions, multi-line for complex ones. Ends with a period.

Single-line:

python
def acquire(self):
    """Acquires the cown (required for reading and writing)."""

Multi-line (summary + body):

python
def release(self):
    """Release the cown to the next behavior.

    This is called when the associated behavior has completed, and thus can
    allow any waiting behavior to run.

    If there is no next behavior, then the cown's `last` pointer is set to null.
    """
Parameter Documentation — Sphinx Style

Use Sphinx :param: / :type: / :return: / :rtype: fields for parameter documentation. This is the single accepted style across the project.

python
def bind_module(tree: ast.Module, path: str = None) -> MainBindings:
    """Reduce a module to the bindings a worker needs.

    :param tree: The source tree
    :type tree: ast.Module
    :return: A bindings result with code and metadata
    :rtype: MainBindings
    """
python
def __init__(self, num_workers: Optional[int], export_dir: Optional[str]):
    """Creates a new Behaviors scheduler.

    :param num_workers: The number of worker interpreters to start.  If
        None, defaults to the number of available cores minus one.
    :type num_workers: Optional[int]
    :param export_dir: The directory to which the target module will be
        exported for worker import.  If None, a temporary directory will
        be created and removed on shutdown.
    :type export_dir: Optional[str]
    """
.pyi Stub File Docstrings

The stub file __init__.pyi uses Sphinx-style docstrings on every public function, class, and constant. Constants use an attribute docstring on the line after the declaration:

python
TIMEOUT: str
"""Sentinel value returned by :func:`receive` when a timeout occurs."""
python
def send(tag: str, contents: Any):
    """Sends a message.

    :param tag: The tag is an arbitrary label that can be used to receive this message.
    :type tag: str
    :param contents: The contents of the message.
    :type contents: Any
    """
Inline # Comments

An inline comment defaults to a single line of at most 120 characters, or it is deleted. Verbose multi-line inline comments rot as the surrounding code changes and reduce readability. Place the comment on the line above the code, at the current indentation:

python
        orphan_cowns = _core.cowns()
        if len(orphan_cowns) != 0:
            logger.debug("acquiring orphan cowns")
            # acquire orphaned cowns so their XIData is freed before teardown

A multi-line # inline comment is permitted only when it records something the code cannot express and that does not fit on one line: a non-obvious concurrency invariant, a behavior-changing transpiler rule, the rationale above a version gate, or a reference anchor that needs context. When in doubt, collapse to one line. Docstrings are not inline comments and are exempt — they should carry in-depth, useful documentation across as many lines as the reader needs.

Same-line # comments are acceptable for very short annotations:

python
        except RuntimeError:
            pass  # already destroyed
Show full SKILL.md (420 more words)Show less
# noqa: Suppression Comments

Suppress linter warnings with # noqa: CODE at the end of the line. Place the suppression on the line that contains the violation, not a surrounding line:

python
    def visit_FunctionDef(self, node: ast.FunctionDef):  # noqa: N802
python
# CORRECT — noqa on the line that references the loop variable
@when(acc)
def _(a):
    a.value.add(val_to_add)  # noqa: B023

# WRONG — noqa on the def line does not suppress the reference on the next line
@when(acc)
def _(a):  # noqa: B023
    a.value.add(val_to_add)   # ← still triggers B023
# BEGIN / # END Markers

Code-generation insertion points in worker.py:

python
# BEGIN boc_export
# END boc_export

Linting Rules (flake8)

The project enforces style with flake8 (config in .flake8):

RuleSetting
inline-quotesdouble — use " not ' (Q000)
max-line-length120
docstring-conventiongoogle (with Sphinx :param: fields — napoleon handles both)
extend-ignoreE203, N812, N817
per-file-ignorestest/*: D103 (missing public-function docstring), D403
Multi-line Class Docstrings (D205 / D209)

A multi-line docstring must have a summary line, a blank line, then the body. The closing """ must be on its own line:

python
# CORRECT
class Foo:
    """Short summary line.

    Longer description goes here after the blank line.
    """

# WRONG — triggers D205 and D209
class Foo:
    """This wraps onto a second line
    without a blank separator."""
Naming in Test Files (N802)

Test function names must be lowercase. Even when testing a property like .T, spell the test name with a lowercase letter:

python
# CORRECT
def test_t_equals_transpose(self, mat): ...

# WRONG — triggers N802
def test_T_equals_transpose(self, mat): ...

Quick Reference

ElementC conventionPython convention
Function docs/// @brief ... /// @return"""Imperative summary."""
Struct/class docs/// @brief above each field"""Single-line or multi-line.""" after class
Parameter docs/// @param name Description:param name: / :type name: (Sphinx)
Inline comments// on line above code# on line above code
End-of-line// for preprocessor version notes# for very short annotations or # noqa:
Block comments/* Sentinel */ only—
Sentence case@brief starts with uppercaseDocstrings start with uppercase
Trailing periodNo period on @briefDocstrings end with a period
TODOs// TODO on its own line# TODO on its own line
Docstring style—Sphinx :param: / :type: / :return: / :rtype:

Common Pitfalls

PitfallFix
Using /* */ for documentation blocks in CUse /// Doxygen-style instead. /* */ is only for /* Sentinel */.
Using Google-style Args: blocksUse Sphinx :param: / :type: style instead. The project uses Sphinx autodoc for documentation.
Omitting the @brief tag in C doc-commentsAlways start with /// @brief. It is the minimum for every documented function.
Forgetting the trailing period in Python docstringsAll Python docstrings end with a period.
Adding a trailing period to C @brief linesC @brief descriptions do not end with a period.
Duplicating commentsDo not place a // block that repeats the /// doc-comment below it. Write it once.
Placing # noqa: on the wrong linePut it on the line with the actual violation, not a surrounding def or decorator line.
Multi-line class docstring without a blank line after the summaryAdd a blank line between the summary sentence and the body (D205). Close """ on its own line (D209).
Using single quotes in PythonThe project enforces double quotes (inline-quotes = double). Use "nan" not 'nan'.
Assigning Cown(m) to an unused variableIf the return value is not needed (e.g., just releasing the matrix), call Cown(m) without assignment to avoid F841.

© microsoft, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/skills/commenting-c-and-python of microsoft/bocpy.

Open the folder on GitHubat commit c8f3ceb

Compare with similar skills

Commenting C And Python next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Commenting C And Python compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Commenting C And Python this skillmicrosoft/bocpy200—~3.3kAutomated safety check: PassMIT
Adk Stylegoogle/adk-python22k—~748Automated safety check: PassApache-2.0
Python Code Stylewshobson/agents40k—~2kAutomated safety check: PassMIT
Code Comment GeneratorArabelaTso/Skills-4-SE253—~4.6kAutomated safety check: PassApache-2.0
Python Style Guideaiskillstore/marketplace430—~2.8kAutomated safety check: PassCustom licence
Kedro Babysitkedro-org/kedro11k—~4kAutomated safety check: PassCustom licence

Similar skills

  • Adk Style

    google/adk-python

    Official

    Python style and codebase conventions for ADK (Agent Development Kit): private-by-default file visibility, imports, type hints, Pydantic v2 models, formatting, docstrings, logging, async I/O, file…

    22k GitHub stars~748 tokensUpdated today
    DevelopmentAuto-check passed
  • Python Code Style

    wshobson/agents

    Python code style, linting, formatting, naming conventions, and documentation standards.

    40k GitHub stars~2k tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Code Comment Generator

    ArabelaTso/Skills-4-SE

    Generates meaningful comments and documentation for code to improve maintenance and readability.

    253 GitHub stars~4.6k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Python Style Guide

    aiskillstore/marketplace

    Comprehensive Python programming guidelines based on Google's Python Style Guide.

    430 GitHub stars~2.8k tokensUpdated today
    Writing & ContentAuto-check passed
  • Kedro Babysit

    kedro-org/kedro

    Run Kedro's local lint / format / type-check / tests on changed files (uses the project's pre-commit hooks, ruff, mypy, pytest, lint-imports, detect-secrets, Make targets — in the right venv), or…

    11k GitHub stars~4k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • WooCommerce Markdown Guidelines

    woocommerce/woocommerce

    Rules for writing and editing markdown in the WooCommerce repository, with the project's markdownlint settings for headings, lists and code blocks.

    11k GitHub starsUsed in 1 repo~1.7k tokens
    DevelopmentAuto-check passed

More from microsoft/bocpy

All 9 skills in this repo
  • Branch Review

    microsoft/bocpy

    Official

    Multi-perspective code review for a branch before merging. An agent skill from microsoft/bocpy.

    200 GitHub stars~3.2k tokensUpdated 9 days ago
    Auto-check passed
  • Official

    Write a C extension whose custom types can live inside a bocpy Cown and travel between worker sub-interpreters.

    200 GitHub stars~5.1k tokensUpdated 9 days ago
    Auto-check passed
  • Finalize PR

    microsoft/bocpy

    Official

    Finalize a feature branch for merge. An agent skill from microsoft/bocpy.

    200 GitHub stars~3.5k tokensUpdated 9 days ago
    Auto-check passed
  • Multi Perspective Plan

    microsoft/bocpy

    Official

    Multi-perspective planning with rebuttal rounds and adversarial review loop.

    200 GitHub stars~2.8k tokensUpdated 9 days ago
    Auto-check passed
  • Testing Message Queue

    microsoft/bocpy

    Official

    Write tests for the bocpy message queue — the lock-free tag-based MPSC ring buffer.

    200 GitHub stars~2.3k tokensUpdated 9 days ago
    Auto-check passed
  • Thinking In Boc

    microsoft/bocpy

    Official

    Think in Behavior-Oriented Concurrency, not threads-and-locks.

    200 GitHub stars~2.6k tokensUpdated 9 days ago
    Auto-check passed

Works with

Categories

Questions about Commenting C And Python

What does Commenting C And Python do?

Follow bocpy commenting and documentation conventions. An agent skill from microsoft/bocpy. Commenting C And Python is an agent skill from microsoft/bocpy, published by the product's own GitHub organization. Follow bocpy commenting and documentation conventions.

When should I use Commenting C And Python?

Commenting C And Python fits situations like: : adding comments to C; writing docstrings; documenting structs; adding Doxygen doc-comments.

How do I install Commenting C And Python in Claude Code?

Run `npx skills add microsoft/bocpy --skill commenting-c-and-python -a claude-code`. Or copy the skill folder (.github/skills/commenting-c-and-python in microsoft/bocpy) into .claude/skills/commenting-c-and-python in your project. Claude Code loads it when a task matches its description.

How do I install Commenting C And Python in Codex?

Run `npx skills add microsoft/bocpy --skill commenting-c-and-python -a codex`. Or copy the skill folder (.github/skills/commenting-c-and-python in microsoft/bocpy) into .agents/skills/commenting-c-and-python in your project. Codex loads it when a task matches its description.

Can I use Commenting C And Python in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add microsoft/bocpy --skill commenting-c-and-python -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/commenting-c-and-python, .gemini/skills/commenting-c-and-python, .github/skills/commenting-c-and-python and .opencode/skills/commenting-c-and-python in your project.

What does Commenting C And Python need to run?

SKILL.md names no scripts, command-line tools or credentials: Commenting C And Python is instructions for the agent only. Our summary lists: Python 3.

Does Commenting C And Python access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Commenting C And Python safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Commenting C And Python use?

Commenting C And Python is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Commenting C And Python use?

About 3.3k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Commenting C And Python?

Skills that share tags, products or a category with Commenting C And Python: Adk Style (google/adk-python, 22k stars), Python Code Style (wshobson/agents, 40k stars), Code Comment Generator (ArabelaTso/Skills-4-SE, 253 stars) and Python Style Guide (aiskillstore/marketplace, 430 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Commenting C And Python?

microsoft (a GitHub organization, an official publisher) maintains it in microsoft/bocpy, which has 200 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on September 28, 2026.

Source: microsoft/bocpy on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.