

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
123456## Python App789- `app/lib/` is for code that is not specified to this application and with some effort could extracted into a external package.10- `app/helpers` is for larger reusable modules that if they weren't specific to this application, could be extracted into their own package.11- `app/utils` are small helper functions that are specific to a particular page or area of the application.12- `app/__init__.py` is the entrypoint for the application which is run when _anything_ is executed (fastapi, celery, etc).13 - It primarily runs `configure_*` commands for any `app.configuration.*` modules. These modules primary setup API clients, database connections, python language configuration, etc.14 - Also makes sure anything that mutates global state loads early.15- FastAPI server and routes are specified in `app/routes/`16- SQLModels are specified in `app/models/`17- Files within `app/commands/` should have:18 - Are not designed for CLI execution, but instead are interactor-style internal commands.19 - Should not be used on the queuing system20 - A `perform` function that is the main entry point for the command.21 - Look at existing commands for examples of how to structure the command.22 - Use `TypeID` for any parameters that are IDs of models.23- Files within `app/jobs/` should have:24 - Are designed for use on the queuing system.25 - A `perform` function that is the main entry point for the job.26 - Look at existing jobs for examples of how to structure the job.27 - Use `TypeID | str` for any parameters that are IDs of models.28- When referencing a command, use the full-qualified name, e.g. `app.commands.transcript_deletion.perform`.29- When queuing a job or `perform`ing it in a test, use the full-qualified name, e.g. `app.jobs.transcript_deletion.perform`.30- `app/cli/` is for scripts or CLI tools that are specific to the application.3132### Factories3334globs: app/factories/**/.py3536* Each model should get it's own file under app/factories/model_name.py37* `ActiveModelFactory` (which is a polyfactory subclass) should be used.38* Use `BaseFactory.__faker__` to generate more specific fake data for important fields (used in routes, etc)39* Prefer `slug = BaseFactory.__faker__.unique.slug` to `slug = Use(lambda: BaseFactory.__faker__.unique.slug())`4041#### Factory Example4243```python44class ScreeningFactory(ActiveModelFactory[Screening]):45 funding_goal = lambda: BaseFactory.__faker__.random_int(46 min=0, max=2000_0047 )4849 ticket_price = DEFAULT_TICKET_PRICE50 status = ScreeningStatus.active5152 # always None53 funding_ending_at = None5455 # pick entry from a fixed list56 zip_code = lambda: BaseFactory.__faker__.random_element(elements=REAL_ZIP_CODES)5758 host_name = BaseFactory.__faker__.name59 host_description = lambda: BaseFactory.__faker__.paragraph(nb_sentences=2)6061 # this method runs before the model is persisted to the database62 @classmethod63 def post_build(cls, model):64 # if the user does not pass in a important relationship during creation, you can generate a factory fallback65 if not model.distribution_id:66 model.distribution_id = DistributionFactory.save().id6768 return model.save()6970 # runs after the model is persisted to the database71 @classmethod72 def post_save(cls, model):73 return model.save()74```7576### Database & ORM7778When accessing database records:7980* SQLModel (wrapping SQLAlchemy) is used81* `Model.one(primary_key)` or `Model.get(primary_key)` should be used to retrieve a single record82* Do not manage database sessions, these are managed by a custom tool83 * Use `TheModel(...).save()` to persist a record84 * Use `TheModel.where(...).order_by(...)` to query records. `.where()` returns a SQLAlchemy select object that you can further customize the query.85 * To iterate over the records, you'll need to end your query chain with `.all()` which returns an interator: `TheModel.where(...)...all()`86* Instead of repulling a record `order = HostScreeningOrder.one(order.id)` refresh it using `order.refresh()`8788When writing database models:8990* Don't use `Field(...)` unless required (i.e. when specifying a JSON type for a `dict` or pydantic model using `Field(sa_type=JSONB)`). For instance, use `= None` instead of `= Field(default=None)`.91* Add enum classes close to where they are used, unless they are used across multiple classes (then put them at the top of the file)92* Use `ModelName.foreign_key()` when generating a foreign key field93* Store currency as an integer, e.g. $1 = 100.94* `before_save`, `after_save(self):`, `after_updated(self):` are lifecycle methods (modelled after ActiveRecord) you can use.9596Example:9798```python99class Distribution(100 BaseModel, TimestampsMixin, SoftDeletionMixin, table=True101):102 """Triple-quoted strings for multi-line class docstring"""103104 id: TypeID[Literal["dst"]] = TypeIDPrimaryKey("dst")105106 date_field_with_comment: datetime | None = None107 "use a string under the field to add a comment about the field"108109 # no need to add a comment about an obvious field; no need for line breaks if there are no field-level docstrings110 title: str = Field(unique=True)111 state: str112113 optional_field: str | None = None114115 # here's how relationships are constructed116 doctor_id: TypeID = Doctor.foreign_key()117 doctor: Doctor = Relationship()118119 @computed_field120 @property121 def order_count(self) -> int:122 return self.where(Order.distribution_id == self.id).count()123```124
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| iloveitaly/llm-ide-rules.cursor/rules/python.mdc · 13 | Cursor rules | setupstyletypesdo-not | 88/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/alembic-migrations.mdc · 13 | Cursor rules | no sections | 50/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/fastapi.mdc · 13 | Cursor rules | no sections | 24/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/general.mdc · 13 | Cursor rules | teststyledo-notagent-behaviour+1 | 92/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/justfiles.mdc · 13 | Cursor rules | do-not | 31/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/pytest-integration-tests.mdc · 13 | Cursor rules | teststyletesting-strategy | 73/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/pytest-tests.mdc · 13 | Cursor rules | testarchtesting-strategyapi+1 | 61/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/python-route-tests.mdc · 13 | Cursor rules | api | 24/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/react-router.mdc · 13 | Cursor rules | testing-strategy | 57/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/react.mdc · 13 | Cursor rules | styletesting-strategyuido-not | 60/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/shell.mdc · 13 | Cursor rules | no sections | 4/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/typescript.mdc · 13 | Cursor rules | styletypessecurity | 63/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/copilot-instructions.md · 13 | Copilot instructions | teststyledo-notagent-behaviour+1 | 92/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/alembic-migrations.instructions.md · 13 | Copilot instructions | no sections | 50/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/fastapi.instructions.md · 13 | Copilot instructions | no sections | 16/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/justfiles.instructions.md · 13 | Copilot instructions | do-not | 31/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/pytest-integration-tests.instructions.md · 13 | Copilot instructions | teststyletesting-strategy | 65/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/pytest-tests.instructions.md · 13 | Copilot instructions | testarchtesting-strategyapi+1 | 53/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/python-app.instructions.md · 13 | Copilot instructions | styledatabasedocs | 61/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/python-route-tests.instructions.md · 13 | Copilot instructions | api | 16/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 46 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 46 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 14 days ago | |
| nerds-odd-e/doughnut.cursor/rules/cli.mdc · 49 | Cursor rules | setupbuildteststyle+4 | 96/100 | 14 days ago | |
| enuno/unifi-mcp-server.cursor/rules/common-mistakes.mdc · 226 | Cursor rules | testlint-formatgitdo-not | 93/100 | today | |
| iloveitaly/llm-ide-rules.cursor/rules/general.mdc · 13 | Cursor rules | teststyledo-notagent-behaviour+1 | 92/100 | 14 days ago | |
| dotCMS/core.cursor/rules/e2e-rules.mdc · 949 | Cursor rules | setupteststylearch+5 | 89/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/guard-git.mdc · 139 | Cursor rules | stylearchgitsecurity+2 | 89/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/iloveitaly-llm-ide-rules-cursor-rules-python-app)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.