

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
123456789You are an expert in Python and writing scalable API applications using FastAPI, SQLAlchemy, and Pydantic.1011## Key Principles1213 - Write clear, technical responses with precise FastAPI examples.14 - Use descriptive variable and function names; adhere to naming conventions (e.g., lowercase with underscores for functions and variables).1516# Python1718 - Async-first development19 - Use Pydantic for Type safety along with its BaseModel with support for Python's dataclasses for simple, shared models between python projects20 - Dependency injection21 - Follow SOLID principles22 - Use middleware judiciously to handle cross-cutting concerns like authentication, logging, and caching.2324## Error Handling and Validation2526 - Prefer try-except blocks for handling exceptions in business logic.27 - Create custom error responses (e.g., 404, 500) where those errors are in the domain of the application.28 - Apply Open Telemetry style logging to errors.2930## Dependencies3132 - Python v3.13+33 - Pydantic34 - Redis (for caching and task queues)35 - Celery (for background tasks)36 - PostgreSQL (preferred databases for production)3738## Performance Optimization3940 - Optimize query performance using related object fetching.41 - Use Redis or Memcached to reduce database load.42 - Implement database indexing and query optimization techniques for better performance.43 - Use asynchronous views and background tasks (via Celery) for I/O-bound or long-running operations.4445## Logging4647 - As a general rule, we should have logs for every expected and unexpected actions of the application, using the appropriate log level.48 - Python exceptions should almost always be captured automatically without extra instrumentation, but custom ones (such as failed requests to external services, query errors, or Celery task failures) can be tracked using capture_exception().4950## Log Levels5152 - A log level or log severity is a piece of information telling how important a given log message is:53 - DEBUG: should be used for information that may be needed for diagnosing issues and troubleshooting or when running application in the test environment for the purpose of making sure everything is running correctly54 - INFO: should be used as standard log level, indicating that something happened55 - WARN: should be used when something unexpected happened but the code can continue the work56 - ERROR: should be used when the application hits an issue preventing one or more functionalities from properly functioning5758## Logging Format5960 - Use Structlog as the default logging library. It's a structured logging framework that adds cohesive metadata on each logs that makes it easier to track events or incidents.61 - Structured logging means that you don’t write hard-to-parse and hard-to-keep-consistent prose in your logs but that you log events that happen in a context instead.6263 (example)6465```python66 import structlog67 logger = structlog.get_logger(__name__)68 logger.debug("event_sent_to_kafka", event_uuid=str(event_uuid), kafka_topic=topic)69```7071 will produce:7273```sh74 2021-10-28T13:46:40.099007Z [debug] event_sent_to_kafka [posthog.api.capture] event_uuid=017cc727-1662-0000-630c-d35f6a29bae3 kafka_topic=default75 As you can see above, the log contains all the information needed to understand the app behaviour.76```7778## Security7980 - Don’t log sensitive information. Make sure you never log:81 - authorization tokens82 - passwords83 - PII (Personal Identifiable Information)8485## Testing8687 - After adding or updating tests, make sure they pass, by running them with pytest.88 - When rerunning previously failed tests, specify the specific tests to re-run.89 - All new packages and most new significant functionality should come with unit tests90 - Significant features should come with integration and/or end-to-end tests91 - Analytics-related queries should be covered by snapshot tests for ease of reviewing92 - Always consider if you can simplify a test by using the `parameterized.expand` decorator9394## Unit Tests95 - A good unit test should:96 - focus on a single use-case at a time97 - have a minimal set of assertions per test98 - demonstrate every use case. The rule of thumb is: if it can happen, it should be covered99100## Integration Tests101102 - Integration tests should ensure that the feature works end-to-end. They must cover all the important use cases of the feature.103104## Running Commands105106- Use `uv sync` instead of `pip install -r ...`, and `uv add PACKAGE` instead of `pip install PACKAGE`. If there is an import error, first activate the venv at `.venv/`.107
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 |
|---|---|---|---|---|---|
| sebellows/color-agent.clinerules/react-typescript.md · 0 | Cline rules | teststylearchdependencies+1 | 64/100 | 14 days ago | |
| sebellows/color-agentCLAUDE.md · 0 | CLAUDE.md | testlint-formatstyle | 74/100 | 14 days ago | |
| sebellows/color-agent.clinerules/01-project-rules.md · 0 | Cline rules | teststylearchsecurity+2 | 56/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bashdeban/fastmind.clinerules/.project-consistency-keeper2.md · 5 | Cline rules | setupbuildtestlint-format+11 | 100/100 | 14 days ago | |
| JCodesMore/ai-website-cloner-template.clinerules · 32k | Cline rules | buildlint-formatstylearch+3 | 97/100 | 7 days ago | |
| enuno/unifi-mcp-server.clinerules · 226 | Cline rules | setuptestlint-formatstyle+10 | 96/100 | today | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 14 days ago | |
| u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 14 days ago | |
| u9401066/pubmed-search-mcp.clinerules/50-pubmed-project.md · 25 | Cline rules | testlint-formatstylearch+1 | 94/100 | 14 days ago | |
| VaillerTeeter/HoshimiNest.clinerules/project-identity.md · 1 | Cline rules | setuparchtypesdo-not | 93/100 | 12 days ago | |
| blendsdk/codeops-mcp.clinerules/project.md · 0 | Cline rules | buildteststylearch+7 | 91/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/sebellows-color-agent-clinerules-python)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.