python-class
Skill1 starsChanged 3 days agoMITView on GitHub
Scaffold Python files and class architectures in Tsukini's style - the Python equivalent of cpp-class - class (one per file, attributes with their defaults in __init__), abstract class (abc, abstract methods), tool (one function per file, MAGIC tool/), module of free functions, exception (subclass of the project error with its code), const category (frozen dataclass + instance), pytest test file, with the Xartania header, the ##### sections #####, the checked imports and the guards, typed signatures and empty bodies only (never the logic: the behavior goes in the docstring / comment), and the public API of a package updated (__all__). Use whenever the user asks to create, add or scaffold a Python class, module, tool function, exception, constants or test file.
In this repository70 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ask-at-endSkill
- clarifySkill
- continue-workSkill
- exportSkill
- full-permissionSkill
- ideationSkill
- interactive-questionsSkill
- onboardSkill
- pauseSkill
- presentationSkill
- rtkSkill
- setup-contextSkill
- write-like-meSkill
- audit-bugsSkill
- audit-depsSkill
- audit-qualitySkill
- audit-securitySkill
- benchmarkSkill
- cmake-styleSkill
- cpp-classSkill
- cpp-commentsSkill
- cpp-projectSkill
- cpp-styleSkill
- better-explain-docSkill
- better-html-docSkill
- better-html-styleSkill
- better-protocol-docSkill
- docs-updateSkill
- explain-docSkill
- html-docSkill
- html-styleSkill
- protocol-docSkill
- readme-styleSkill
- reportSkill
- wiki-styleSkill
- ci-cdSkill
- git-commitSkill
- git-conventionsSkill
- pre-commitSkill
- legal-checkSkill
- legal-setupSkill
- licenseSkill
- libutils-exceptionSkill
- libutils-installSkill
- libutils-setupSkill
- libutilsSkill
- python-commentsSkill
- python-projectSkill
- python-styleSkill
- auditSkill
- cppSkill
- devSkill
- docSkill
- gitSkill
- legalSkill
- pythonSkill
- setup-projectSkill
- styleSkill
- setup-studioSkill
- The first 60 shown.
The file
Files
Python files in Tsukini's style
SKILL_DIR = the directory of this file. Load python-style (code) and python-comments (comments) first; a project
layout comes from python-project. Generator (--help for every option):
python3 SKILL_DIR/scripts/new_file.py <kind> <Name> --dir <folder> [--desc "..."] [--base Parent] \
[--attributes "name: type = default # comment; ..."] [--methods "name(params) -> type # what it does; ..."] \
[--relative] [--export] [--banner xartania|none|<text>]Architecture only: never write the logic of a function. Every body is
pass(no return value), the smallest return of its type (return 0,"",False,[],{},NoneforX | None),...(abstract method) orraise NotImplementedError(any other type), even if the user describes the behavior: the description goes in the docstring of a public method or the trailing comment of thedef. The user writes the logic. Allowed: attributes with their defaults in__init__,super().__init__(), the constants of aconst.pycategory.
1. Understand the request
| Kind | File | Content |
class | <folder>/<snake_name>.py (Class/ of an application, src/<pkg>/ of a package) | class PascalCase, docstring, __init__ with the typed attributes (self._x: int = 0 # meaning), the methods |
abstract | same | class X(ABC) + @abstractmethod methods with ... (the I / A of cpp-class: the interface of a family) |
tool | tool/<function>.py (MAGIC) | one function named like the file under ##### Program ##### |
module | <folder>/<name>.py | free functions under ##### Tools ##### |
exception | appended to exception.py | class XError(ProjectError) with its ERROR.* code |
const | appended to const.py | a frozen dataclass category + its instance in ##### Declaration ##### (aligned) |
test | tests/test_<name>.py | one test_<function> per listed name (bodies written with tests / pytest) |
--relative: file of a package (from .const import ..., no__main__guard); without it: application / script (from const import ..., checked imports,if __name__ == "__main__"guard: the module can only be imported).--base: parent class; imported automatically when it is in the same folder, else add the import by hand.--export: adds the class to__all__and the imports of the package__init__.py(public API).- Types used in a signature that are not builtins (another class of the project) are imported by hand in the
# Import that can be checkedblock with their# Used forcomment.
2. Decide before generating
- Names:
snake_casefile / function / method / attribute,PascalCaseclass,_namefor the private ones (methods only used by the class, attributes not part of its API),UPPER_SNAKEconstants. One class per file. - Where: application (MAGIC)
src/Class/,src/tool/, feature folders (src/window_build/); packagesrc/<pkg>/with sub-packages per concern. Show the tree in the AskUserQuestion when a place is ambiguous. - Signatures fully typed (
-> Noneincluded), defaults on the parameters of a mode (failsafe: bool = False).
3. After
xstyle --rtk <files> (python-style rules), python3 -c "import <module>" (or PYTHONPATH=src for a package) to check that
the skeleton imports; tests created with --kind test are filled with the tests skill.
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
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.

