platform-skills / rules
Cursor rule71 starsChanged 8 days agoApache-2.0View on GitHub
KEDA ScaledObject and ScaledJob generation rules — auth patterns, scaling safety, best practices
We split this keda.mdc into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Always generate ScaledObject and ScaledJob resources with all of the following.
- Distinctive: line 109
Before generating a ScaledObject, note if an HPA already targets the same Deployment.
≈ “Common” is an estimate: at least 1 in 5 of the 6,350 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
description: KEDA ScaledObject and ScaledJob generation rules — auth patterns, scaling safety, best practices
globs: ["**/scaledobject*.yaml", "**/scaledjob*.yaml", "**/keda*.yaml", "**/triggerauth*.yaml", "**/scaled-object*.yaml", "**/scaled-job*.yaml"]
alwaysApply: false
---
# KEDA Rules
Always generate ScaledObject and ScaledJob resources with all of the following. Missing any item is a Critical finding.
## Required fields on every ScaledObject
```yaml
spec:
scaleTargetRef:
apiVersion: apps/v1 # Always explicit — don't rely on the default
kind: Deployment # Or StatefulSet — be explicit
name: <exact-deployment-name>
minReplicaCount: 1 # Use 0 only when cold-start latency is acceptable and documented
maxReplicaCount: <N> # Always set — never omit the ceiling
pollingInterval: 30 # 30s is a safe default; lower only for latency-sensitive queues
cooldownPeriod: 300 # 5-minute cooldown prevents thrashing
advanced:
restoreToOriginalReplicaCount: true # Always set — restores replicas on ScaledObject deletion
```
## Required on every trigger
```yaml
triggers:
- type: <scaler>
metadata:
activationThreshold: "<N>" # or activationQueueLength / activationLagThreshold
# Prevents activation on noise/sparse events
authenticationRef:
name: <trigger-auth-name> # Always use TriggerAuthentication — never inline credentials
```
## TriggerAuthentication: prefer Pod Identity
```yaml
# ✅ Best practice — no static credentials
spec:
podIdentity:
provider: aws # aws | azure | gcp | aws-eks
# ⚠️ Only when Pod Identity is unavailable — rotate keys; scope the Secret tightly
spec:
secretTargetRef:
- parameter: <param>
name: <secret-name>
key: <key>
```
## Scaler-specific minimum IAM permissions (least privilege)
| Scaler | Minimum permission |
|---|---|
| `aws-sqs-queue` | `sqs:GetQueueAttributes`, `sqs:GetQueueUrl` — NOT `sqs:ReceiveMessage` |
| `kafka` | consumer group describe + offset fetch — NOT produce |
| `azure-servicebus` | `Listen` on the specific queue or subscription only |
| `prometheus` | No auth for cluster-internal Prometheus |
## Cron scaler rules
```yaml
# Cron windows must not overlap.
# Always pair with a Prometheus/queue trigger as a safety net for unexpected spikes.
# Use idleReplicaCount or minReplicaCount >= 1 to keep a warm pod during off-hours.
# Always set timezone explicitly — never rely on UTC as an unstated assumption.
- type: cron
metadata:
timezone: Europe/Berlin # IANA timezone — always explicit
start: "0 8 * * 1-5"
end: "0 20 * * 1-5"
desiredReplicas: "10"
```
## ScaledJob required fields
```yaml
spec:
jobTargetRef:
template:
spec:
restartPolicy: Never # Required — Jobs must not use OnFailure with KEDA
activeDeadlineSeconds: 3600 # Required — prevents zombie jobs
containers:
- resources:
requests: { cpu: "500m", memory: "512Mi" }
limits: { memory: "2Gi" } # memory limit required; omit cpu limit
```
## Never generate
- Static credentials inlined directly in `ScaledObject` metadata — always use `TriggerAuthentication`
- `SQS` scaler with `sqs:ReceiveMessage` — KEDA only reads depth, it does not consume
- A separate `HorizontalPodAutoscaler` targeting the same Deployment — KEDA manages its own HPA
- `minReplicaCount: 0` without a comment explaining cold-start acceptance
- Overlapping cron windows — they produce undefined behavior
- `pollingInterval < 10` on SQS — each poll is a billable AWS API call
- Kafka scaler without `lagThreshold` set — defaults are rarely appropriate
## HPA conflict check
Before generating a ScaledObject, note if an HPA already targets the same Deployment. If it does, include:
```bash
# Delete existing HPA before applying ScaledObject
kubectl delete hpa <existing-hpa> -n <namespace>
```
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 3,978 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository59 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/kubernetes.mdcCursor rule
- .cursor/rules/platform-skills.mdcCursor rule
- .cursor/rules/terraform.mdcCursor rule
- code-reviewSkill
- platform-skillsSkill
- ai-governanceSkill
- awesome-docsSkill
- aws-profileSkill
- awsSkill
- azureSkill
- backup-drSkill
- chaosSkill
- checkovSkill
- cluster-upgradeSkill
- commitSkill
- complianceSkill
- composite-actionsSkill
- datadogSkill
- debugSkill
- documentSkill
- doraSkill
- dynatraceSkill
- finopsSkill
- fluxcdSkill
- gateway-apiSkill
- github-actionsSkill
- gitopsSkill
- helmchartSkill
- karpenterSkill
- kedaSkill
- kingfisherSkill
- kubernetesSkill
- kubescape-operatorSkill
- kubescapeSkill
- kyvernoSkill
- linkerdSkill
- linuxSkill
- mcpSkill
- observabilitySkill
- opaSkill
- openshiftSkill
- platform-skillsSkill
- preflightSkill
- productSkill
- progressive-deliverySkill
- pr-reviewSkill
- renovateSkill
- runtime-securitySkill
- secretsSkill
- self-improveSkill
- setup-agentsSkill
- supply-chainSkill
- terraformSkill
- token-optimizerSkill
- triageSkill
- trivySkill
- zizmorSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

