AGENT SKILL

lean-naming-style

Use when naming Lean declarations, organizing files, adding docstrings, or cleaning code so it matches Mathlib conventions and review expectations.

License 许可
CC-BY-4.0
最近更新
2026-11-14
Stars
★ 12
Forks
5

01 前言 Front Matter

name
lean-naming-style
description
Use when naming Lean declarations, organizing files, adding docstrings, or cleaning code so it matches Mathlib conventions and review expectations.

02 资源文件 8

03 SKILL.md 正文

Lean Naming Style

Use this skill when creating or renaming declarations, organizing modules, or cleaning Lean code for review. The goal is not just “pretty code”; it is a library-shaped API that feels native to Mathlib.

Naming Rules

  • Use snake_case for theorem names and terms of type Prop.
  • Use UpperCamelCase for structures, classes, inductive types, and other declarations returning Type or Sort.
  • Use lowerCamelCase for ordinary terms returning data.
  • Prefer descriptive theorem names whose conclusion drives the name.
    • add hypotheses with _of_...
    • use systematic fragments like nonneg, inj, ext, iff
  • Put the declaration in the most specific namespace that supports natural dot notation.

File and API Rules

  • Use UpperCamelCase.lean file names.

  • In projects using the module system, follow this header order:

    • copyright comment;
    • module;
    • imports: public import only for what statements need, plain import otherwise;
    • /-! module docstring -/;
    • public section.

    See the lean-project-architecture skill's references/module-system.md.

  • Keep one focused topic per file and follow the repository's file-size limit.

  • Import as little as possible.

  • After adding a public definition, add the obvious API immediately.

    • constructor or evaluation lemmas
    • @[simp] lemmas only when they genuinely improve simplification
    • extensionality lemmas where equality is structural
  • Add module docstrings and public-definition docstrings where they help later readers.

Style Rules

  • Prefer readable proofs over clever ones.
  • Keep checked-in proofs explicit and lint-clean.
  • Do not commit unmanifested sorry, exact?, apply?, or exploratory simp. The sole sorry exception is the exact by sorry body of an author-approved, manifest-bound frozen keystone theorem in state DRAFT_SORRY; it is statement ABI, not finished code.
  • In projects with a zero-warning policy, do not commit while linter warnings remain.

Review Checklist

  • Does the name match Mathlib conventions?
  • Is the namespace the right one?
  • Is the file the canonical home?
  • Are imports minimal?
  • Are there missing simp, ext, or accessor lemmas?
  • Is the code docstring- and linter-clean?

References

  • Read references/naming-and-style.md for naming patterns, symbol-to-name translations, structural lemma conventions, file organization, and lint/style expectations.

04 同仓库更多 Skills

stanfish06
stanfish06/skillquarium

zarr-python

Stores and queries chunked N-D scientific arrays with Zarr-Python 3, including codecs, sharding, S3/GCS storage, and NumPy/Dask/Xarray integration. Use for array layout, bounded I/O, format migration, or scientific metadata preservation.

★ 12
stanfish06
stanfish06/skillquarium

yeet

Publish local changes to GitHub by confirming scope, committing intentionally, pushing the branch, and opening a draft PR through the GitHub app from this plugin, with `gh` used only as a fallback where connector coverage is insufficient.

★ 12
stanfish06
stanfish06/skillquarium

xarray

N-dimensional labeled arrays and datasets in Python. Built on top of NumPy and Dask. It introduces labels in the form of dimensions, coordinates, and attributes on top of raw NumPy-like arrays, making data analysis in physical sciences more intuitive and less error-prone. Use for working with multi-dimensional scientific data, NetCDF/GRIB/Zarr files, climate/weather/oceanographic datasets, remote sensing, geospatial imaging, large out-of-memory datasets with Dask, and labeled array operations.

★ 12
stanfish06
stanfish06/skillquarium

writing-mstest-tests

Use when asked to fix, rewrite, update, improve, modernize, show corrected code for, or explain existing MSTest tests or MSTest-specific configuration. Use for "review" when corrected code or edits are wanted, even for one pasted assertion or passing tests with bad failure output. Covers expected/actual labels; generic Boolean, collection, string, numeric, null, identity, exception, hard-cast, and object[] checks; TestContext/lifecycle; timeout/cancellation; OS/CI conditions, retry, cleanup, parallelization, MSTest.Sdk project setup, and MSTESTxxxx. Honor the installed MSTest version. DO NOT USE to design new test cases (code-testing), perform report-only audits, create project files rather than explain MSTest setup, run tests, migrate frameworks, or handle non-MSTest/non-.NET code.

★ 12
stanfish06
stanfish06/skillquarium

wgs-prs

End-to-end WGS to polygenic risk score pipeline. Takes paired-end FASTQ files (or a pre-existing VCF) through nf-core/sarek for variant calling, applies VCF QC (normalisation, hard filtering, Ti/Tv and Het/Hom checks), then computes polygenic risk scores via the PGS Catalog. Fills the FASTQ to VCF gap upstream of the gwas-prs skill.

★ 12
stanfish06
stanfish06/skillquarium

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

★ 12