using-archipy-decorators

using-archipy-decorators is a cursor rule for Cursor from SyntaxArc/archipy-plugin. It costs 484 tokens per session, scanned A, original, MIT.

A guide to ArchiPy decorators for caching, database transactions, tracing, timing, retries, timeouts, and gRPC rate limits. It also explains how to write custom decorators without hiding service construction inside them.

In plain words
What is it for?
Use it to add caching, transaction boundaries, observability, retries, time limits, or rate limiting to functions, especially logic methods.
Why use it?
It helps apply common behavior consistently while keeping database transaction handling in application logic rather than repositories. This reduces repeated code and makes failures and monitoring easier to handle.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it to add caching, transaction boundaries, observability, retries, time limits, or rate limiting to functions, especially logic methods.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/syntaxarc/archipy-plugin/using-archipy-decorators
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/SyntaxArc/archipy-plugin

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for using-archipy-decorators

README.md
[![agentmods](https://agentmods.dev/badge/rules/syntaxarc/archipy-plugin/using-archipy-decorators/github.svg)](https://agentmods.dev/rules/syntaxarc/archipy-plugin/using-archipy-decorators)
Your own site
<a href="https://agentmods.dev/rules/syntaxarc/archipy-plugin/using-archipy-decorators"><img src="https://agentmods.dev/badge/rules/syntaxarc/archipy-plugin/using-archipy-decorators/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for using-archipy-decorators

Your own site · 80×15
<a href="https://agentmods.dev/rules/syntaxarc/archipy-plugin/using-archipy-decorators"><img src="https://agentmods.dev/badge/rules/syntaxarc/archipy-plugin/using-archipy-decorators.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 484 This file is loaded in full into every session.
When invoked 484 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00484 $0.00484
Opus 5.5 $0.00194 $0.00194
Sonnet 5.5 $0.00097 $0.00097
Haiku 4.5 $0.00048 $0.00048

Measured 1mo ago against content hash b37fca01a3f8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

using-archipy-decorators scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/using-archipy-decorators.mdc · 40 lines

What it actually says

Using ArchiPy Decorators

Helpers stay pure: no database calls, no network I/O, no constructing adapters, no domain business rules.

Prefer ArchiPy Decorators

Before writing a custom decorator, prefer ArchiPy under archipy.helpers.decorators:

  • ttl_cache — caching (archipy.helpers.decorators)
  • Unit of work (apply on logics, not repositories):
    • postgres_sqlalchemy_atomic (detects async def), imported from archipy.adapters.base.sqlalchemy.atomic
    • also mysql_ / sqlite_ / starrocks_ / generic sqlalchemy_atomic variants
  • Tracing: trace_span, trace_root, async_trace_span, async_trace_root, trace_class
  • Metrics: measure_duration, async_measure_duration, count_calls, async_count_calls
  • Local timing only: timing
  • Resilience: retry, timeout
  • Other: singleton, grpc_rate_limit (gRPC only)

Custom Decorators

  • Live under helpers/decorators/.
  • Preserve wrapped function signatures and type hints (functools.wraps).
  • Document usage with a short example in the Google-style docstring.
  • Raise archipy.models.errors types such as ConfigurationError or InvalidArgumentError for helper-level configuration/validation failures; do not invent ad-hoc exception classes.
  • Do not import concrete adapter implementations at module level. If a decorator needs a port, accept it as an argument or resolve via injected callback/config.

Do Not

  • Hide adapter construction inside decorator modules.
  • Catch broad Exception without re-raising as a domain error with raise ... from e.
  • Write separate sync and async copies of a decorator when one wrapper can detect inspect.iscoroutinefunction; ArchiPy's retry, timeout, timing, ttl_cache and *_sqlalchemy_atomic do.
  • Put @postgres_sqlalchemy_atomic on repositories or services — UoW belongs on logics.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · -1 lines · +26 tokens per session b37fca01a3f8
  2. 2mo ago Changed · +4 lines · +76 tokens per session a6106bfdfa15
  3. 3mo ago First seen · 37 lines · 382 tokens per session scan A 1201dbf34530

Subscribe to this mod's changes

using-archipy-decorators is a cursor rule published in the GitHub repository SyntaxArc/archipy-plugin (3 stars, last pushed 23d ago), licensed MIT. It adds 484 tokens to every session, about $0.0019 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

using-archipy-decorators compared with cursor rules from other repositories

using-archipy-decorators next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
using-archipy-decoratorsSyntaxArc/archipy-pluginCursor rule323d agoMITA484Cursor
python-flask-json-guide-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A185Cursor
java-springboot-jpa-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A1,006Cursor
py-fast-apiPatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A720Cursor
python-django-best-practices-cursorrules-prompt-fiPatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A698Cursor
pythonPatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A734Cursor
python-fastapi-best-practices-cursorrules-prompt-fPatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A486Cursor