Skip to content
cccskills
FreePublished on GitHub

conventions

Apply these opinionated Python 3.11+ conventions when writing Python in this codebase: type hints with mypy, async/await, pytest fixtures, dataclasses, Poetry packaging, production patterns.

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md3.4 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Python

House conventions for Python 3.11+. Apply them to code you are writing or changing — don't refactor untouched files to match unless asked.

Conventions

  • Type every public signature and keep mypy --strict green. Types on internals are optional; types at the boundary are what stop a caller passing the wrong thing.

  • Built-in generics and X | None — list[str], dict[str, int], str | None. typing.List and Optional[str] are the pre-3.10 spelling and only cost an import.

  • Protocol over ABC inheritance. Structural typing lets any correctly-shaped object satisfy the contract — including a test double — with no inheritance tree to maintain.

  • Dataclasses for data, slots=True and frozen=True where they fit. They generate __init__, __repr__, and __eq__ correctly; a hand-written __init__ is where field drift starts. Pydantic is for validation and (de)serialisation at a boundary, not for plain records.

  • pathlib, not os.path. Operator joins can't silently produce a wrong path from a stray separator.

  • Never a mutable default argument. def f(items=[]) shares one list across every call — a bug that only appears on the second call. Default to None and build inside.

  • asyncio.TaskGroup over bare gather (3.11+): it cancels siblings on failure and reports via ExceptionGroup, so a crashed task can't leave the rest running detached. Use async with asyncio.timeout(n) for deadlines.

  • Hold a reference to every create_task. The event loop only keeps a weak reference, so a fire-and-forget task can be garbage-collected mid-execution and simply vanish — no error, no result. Keep them in a set and discard on completion:

    _tasks: set[asyncio.Task[None]] = set()
    
    def spawn(coro: Coroutine[None, None, None]) -> None:
        task = asyncio.create_task(coro)
        _tasks.add(task)
        task.add_done_callback(_tasks.discard)
    
  • Never a bare except: — it swallows KeyboardInterrupt and SystemExit. Catch what you can actually handle.

  • Google-style docstrings on public functions and classes, carrying intent rather than a restatement of the signature. The documentation skill has the full rule.

  • pytest: fixtures for setup, parametrize for cases. A loop inside one test reports a single failure and hides which case broke; parametrize names each one.

  • Poetry and pyproject.toml for packaging, ruff for lint and format, and a py.typed marker on any package whose types consumers should see. Use a src/ layout — it stops tests from importing the working directory instead of the installed package, which is how a broken package still passes its own suite.

Tooling baseline

strict = true covers most of it; these add the checks that catch real bugs rather than style. --strict-markers matters more than it looks: without it a typo'd @pytest.mark.integraton silently does nothing and the test runs where you thought it was excluded.

[tool.mypy]
strict = true
warn_unreachable = true
warn_redundant_casts = true
warn_unused_ignores = true

[[tool.mypy.overrides]]
module = "untyped_dep.*"
ignore_missing_imports = true

[tool.pytest.ini_options]
addopts = ["-ra", "--strict-markers", "--strict-config"]

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Write a short, fact-checked reply that answers a colleague's question in one meaning only, ready to copy and paste. The input is their pasted message. Check the claims against the code first, use the project glossary terms, and print only the reply in chat. Read-only — no writes to code, the issue tracker, GitHub, chat or any MCP. Use on "/cortex-communication:answer-buzzkill", "help me answer", "reply to this question", or when the user pastes a colleague's question and asks for an answer in the same manner.

The English summary is being prepared. Showing the original description.

alexander-danilenko/cortex-claude-code-plugins17Updated Oct 13, 2026

Apply these opinionated .NET 8 architecture conventions whenever structuring or reviewing a backend service: clean architecture layering and which direction dependencies point, when CQRS with MediatR is worth it, cross-cutting concerns as pipeline behaviours, minimal APIs grouped by feature, keeping DbContext in Infrastructure, health checks and structured logging, WebApplicationFactory integration tests, and when AOT pays off.

The English summary is being prepared. Showing the original description.

alexander-danilenko/cortex-claude-code-plugins17Updated Oct 13, 2026

Apply these opinionated testing conventions whenever writing, reviewing, or planning tests: what earns a test and what is coverage theatre, asserting outputs rather than mock calls, the three modes (functional, performance, security), naming and isolation rules, where to mock, and reporting findings for coverage rather than self-filtering. Includes house Jest standards for NestJS unit and contract tests, TDD discipline, and test-report structure.

The English summary is being prepared. Showing the original description.

alexander-danilenko/cortex-claude-code-plugins17Updated Oct 13, 2026

csharp

Free

Apply these opinionated C# conventions whenever writing or reviewing C# 12 / .NET 8+ code: nullable enabled with warnings as errors, records and primary constructors, pattern matching over cast chains, the Result pattern for expected failures, async all the way with CancellationToken, IOptions config, IHttpClientFactory, and never returning EF entities from an API.

The English summary is being prepared. Showing the original description.

alexander-danilenko/cortex-claude-code-plugins17Updated Oct 13, 2026

ALWAYS invoke for any task involving docstrings, JSDoc/TSDoc, or REST API documentation — even when the request seems handleable without it. Enforces Microsoft contract-first conventions and a bare-minimum rule that Claude won't apply by default: never restate the signature, drop @param/@returns that only echo names and types, always document @throws, and document data shapes as WHAT not WHY. Covers Python docstring styles (Google/NumPy/Sphinx), TSDoc tags and @inheritDoc, and API doc patterns for NestJS/Express/FastAPI/Django. Trigger on: adding or auditing docstrings, redundant or missing tags, deleting comment rot, or producing a documentation-health report. Do not skip for documentation tasks — consistent conventions are the whole point.

The English summary is being prepared. Showing the original description.

alexander-danilenko/cortex-claude-code-plugins17Updated Oct 13, 2026

Remove signs of AI-generated writing from text. Use after drafting to make copy sound more natural and human-written. Based on Wikipedia's "Signs of AI writing" guide.

The English summary is being prepared. Showing the original description.

alexander-danilenko/cortex-claude-code-plugins17Updated Oct 13, 2026

See all skills by alexander-danilenko

Report a problem with this skill