Skip to content
Skills Library
Programming · Building & coding

python-metaclasses-decorators

/python-metaclasses-decorators

Use this skill when implementing Python metaprogramming, class registries, validation decorators, and property factories.

Licence
MIT
Last repository change
28.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 28.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use this skill when implementing Python metaprogramming, class registries, validation decorators, and property factories.

Original author description

Use this skill when implementing Python metaprogramming, class registries, validation decorators, and property factories.

How it works

  1. When to use
  2. Prerequisites
  3. Step-by-step workflow
  4. Commands / code examples
  5. Common mistakes & pitfalls
  6. Verification checklist
  7. Related skills
Original SKILL.md headings · 58 lines, 284 words
SKILL.md preview
---
name: python-metaclasses-decorators
description: Use this skill when implementing Python metaprogramming, class registries, validation decorators, and property factories.
---
# Python Metaclasses & Decorators

## When to use
Use this skill when you need to implementing Python metaprogramming, class registries, validation decorators, and property factories.

## Prerequisites
- Working knowledge of relevant programming language or database fundamentals.
- Access to testing environment or local runtime instance.

## Step-by-step workflow
1. **Analyze operational requirements**: Review performance boundaries, data integrity constraints, and query patterns.
2. **Design schema / interface**: Define explicit data contracts, types, or indexes supporting planned operations.
3. **Implement core routines**: Construct declarative, type-safe, or parameterized queries and functions.
4. **Validate performance**: Verify execution metrics using profilers, EXPLAIN plans, or benchmark test suites.
5. **Implement defensive controls**: Enforce timeout boundaries, connection pooling limits, and transaction safety.

## Commands / code examples
```python
import functools
import time
from typing import Callable, Any

def audit_runtime(threshold_sec: float = 0.5) -> Callable:
    def decorator(func: Callable) -> Callable:
        @functools.wraps(func)
        def wrapper(*args: Any, **kwargs: Any) -> Any:
            start = time.perf_counter()
            result = func(*args, **kwargs)
            duration = time.perf_counter() - start
            if duration > threshold_sec:
                print(f"[WARN] {func.__name__} took {duration:.3f}s (threshold: {threshold_sec}s)")
            return result
        return wrapper
    return decorator

@audit_runtime(0.1)
def compute_hashes():
    time.sleep(0.12)
    return True
```

## Common mistakes & pitfalls
- Overlooking indexing strategies on foreign keys and frequently queried filter columns.
- Running unparameterized dynamic queries, creating severe SQL injection vulnerabilities.
- Holding open long-running database transactions during slow external network calls.

## Verification checklist
- [ ] Schema contracts and type signatures are strictly enforced.
- [ ] Queries are fully parameterized against injection vulnerabilities.
- [ ] Profiling or execution plans show optimal resource consumption.
- [ ] Error handling safely releases locks and rolls back aborted transactions.

## Related skills
- postgresql-query-optimization-explain
- sql-anti-patterns-remediation
- acid-transactions-isolation-levels
- secure-code-review-static-analysis-sast

Versions

The database has no other skills named python-metaclasses-decorators.

Database snapshot: 13.11.2026 · package version e5e71da2a312 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90python-decorators
    Write decorators that preserve signatures and compose cleanly, including parameterized and class-applied forms. Use when adding cross-cutting behavior to Python functions or fixing decorator-related introspection breakage.
  • 95ruby-metaprogramming
    Use when working with Ruby metaprogramming features including dynamic method definition, method_missing, class_eval, define_method, and reflection.
  • 100python
    Expert Python programming skill. Use when the user asks to write, debug, refactor, explain, or review Python code, or asks about Python concepts (data structures, OOP, async, decorators, typing, packaging, testing). Provides coding standards, step-by-step workflows, and worked examples.
  • 100decorator-patterns
    NestJS decorator usage: built-in route/param/class decorators, custom decorators via `createParamDecorator` and `SetMetadata`, metadata reflection via `Reflector`. Apply when designing controllers, guards, interceptors, or custom decorators. Use this skill to: - Pick the right…
  • 100python-dev
    Use when implementing a Python feature or fix, or when the user requests Python architecture, implementation, review, or tests.
  • 100draper-decorators
    This skill should be used when the user asks to "create a decorator", "write a decorator", "move logic into decorator", "clean logic out of the view", "isn't it decorator logic", "test a decorator", or mentions Draper, keeping views clean, or representation logic in decorators.…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.