agentleFS
sagar-shirwalkarsagar-shirwalkar/servicenow-atlas/.agents/skills/python-code-style/SKILL.md

python-code-style

Skill2 starsChanged 5 months agoApache-2.0View on GitHub

Enforce consistent Python code style across the project. Covers import ordering, string quoting, naming conventions, docstring format, and recommended linter setup. Use when writing new code, reviewing PRs for style, or configuring a linter.

8 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use python-error-handling, python-anti-patterns and 1 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • justanestaSkill

    python-error-handling

    Python error handling and debugging. Use this skill when implementing error handling, designing exception hierarchies, debugging issues, or adding logging. Covers exception patterns, custom exceptions, logging with structlog, debugging tools, and error recovery.

    Also in 4 projects that use this

  • CodeWithBehnamSkill

    python-anti-patterns

    Common Python anti-patterns to avoid. Use as a checklist when reviewing code, before finalizing implementations, or when debugging issues that might stem from known bad practices.

    Also in 3 projects that use this

  • nilecuiSkill

    async-python-patterns

    Master Python asyncio, concurrent programming, and async/await patterns for high-performance applications. Use when building async APIs, concurrent systems, or I/O-bound applications requiring non-blocking operations.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When documenting parameters inline (not via Google-style section headers), place the description after --:

    line 77
  2. Very specific:

    Always use f-strings. Do not use .format() or % formatting.

    line 88
  3. Distinctive:

    No strict line length is enforced.

    line 100
  4. Distinctive:

    Keep lines under ~100 characters when readable.

    line 101
  5. Distinctive:

    Import groups separated by one blank line.

    line 110
  6. Very specific:

    Add this as the first import in every .py file (after the module docstring):

    line 114
  7. Very specific:

    If you set up pre-commit, add .pre-commit-config.yaml with ruff and ruff-format.

    line 150

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

When to use

  • Writing new Python files for the project
  • Reviewing code for style consistency
  • Configuring ruff or another linter/formatter
  • Onboarding a new contributor

Project conventions

These are the conventions established by the existing codebase at atlas/.

Import ordering

Three groups separated by a blank line:

import re
from pathlib import Path

import numpy as np
import yaml

from .base import Embedder
GroupContents
1 — Standard libraryos, re, pathlib, argparse, json, etc.
2 — Third-partynumpy, yaml, mcp, onnxruntime, transformers, etc.
3 — Local (relative)from .base import ..., from .chunk import ...

Within each group, sort alphabetically. Use import module over from module import symbol unless you need fewer than 3 symbols from a module.

String quoting

Double quotes for all strings and docstrings:

name = "servicenow-atlas"
description = f"Bundle version {version}"

Single quotes are allowed only to avoid escaping inside f-strings:

f"    - {h['publication']}/{h['file']}"

Naming conventions

CategoryStyleExample
Modules/packagessnake_casechunk.py, make_bundle.py
ClassesPascalCaseOnnxEmbedder, MlxEmbedder
Functions/methodssnake_caseparse_frontmatter, embed_with_progress
ConstantsUPPER_CASEDEFAULT_MODEL_ID, _MAX_CHUNK_CHARS
Private (_ prefix)_single_leading_resolve_model_dir, _FRONTMATTER_RE
Type variables_T or descriptive—

Docstrings

Triple double quotes ("""..."""). Module-level docstrings provide design context. Function docstrings describe parameters, return values, and edge cases.

For RST cross-references to other code, use :meth:, :class:, :mod::

"""...as described in :meth:`Embedder.embed`..."""

When documenting parameters inline (not via Google-style section headers), place the description after --:

def chunk_file(path: Path, repo_root: Path) -> list[dict]:
    """Chunk a single markdown file, splitting on H2 boundaries.

    Malformed YAML frontmatter is logged and treated as no frontmatter.
    """

f-strings

Always use f-strings. Do not use .format() or % formatting.

# Correct
logger.info("Chunked %s files in %.2fs", count, elapsed)

# Also correct (f-strings for display strings)
path = f"{publication}/{filename}"

Line length

No strict line length is enforced. Use judgment:

  • Keep lines under ~100 characters when readable.
  • Break long strings at logical boundaries (e.g., between sentences).
  • Long argument lists can span multiple lines.

Blank lines

  • Two blank lines before top-level class/function definitions.
  • One blank line between methods inside a class.
  • One blank line after module docstring.
  • Import groups separated by one blank line.

from __future__ import annotations

Add this as the first import in every .py file (after the module docstring):

"""Module docstring."""

from __future__ import annotations

This defers annotation evaluation and is required by the requires-python = ">=3.11" constraint.

Recommended setup

Configure ruff (not currently set up — recommended)

Create .ruff.toml:

target-version = "py311"
line-length = 100

[lint]
select = ["E", "F", "I", "N", "W", "UP", "D"]
ignore = ["D203", "D213", "D415"]  # Allow flexible docstring convention

[format]
quote-style = "double"

Then run:

ruff check .
ruff format .

Pre-commit hook (optional)

If you set up pre-commit, add .pre-commit-config.yaml with ruff and ruff-format.

References

  • pyproject.toml — project configuration
  • README.md — not a style guide, but documents project conventions
  • ruff documentation for rule selection

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.