Hey folks! I was deep in my weekend k8s tinkering session, trying to get my Argo CD app-of-apps pattern just right, when I stumbled on a neat trick that feels like a game-changer for using coding assistants. We all have custom instructions or system prompts we copy-paste, right? But context switching between a `.yaml` manifest and a `.tf` file is a different mental model.
Turns out, in editors like VS Code and Cursor, you can bind specific custom instructions to *file types* or even project directories. No more manually telling your AI "hey, you're in Helm chart mode now"!
Here's a quick example. I set up a `.cursorrules` file in the root of my `gitops-applications` repo:
```json
{
"*.yaml": "You are a Kubernetes and Helm specialist. Focus on best practices for resource definitions, point out if I'm missing common labels or probes. Assume we're targeting EKS.",
"values*.yaml": "You are a Helm chart tuner. Suggest safe defaults, warn about potential resource overprovisioning, and prefer Argo CD-style value structures.",
"**/templates/*.yaml": "You are now a Helm template expert. Talk about Go template functions, `tpl`, and the `include` function. Be strict about indentation.",
"*.tf": "Switch gears: you're a Terraform wizard for AWS EKS modules. Discuss IAM policies, module versions, and state management."
}
```
The immediate win? It **just works**. Open a `deployment.yaml`, and the assistant already knows the domain. It's like having a team of specialists on tap.
Why this is perfect for our cloud-native workflows:
- Reduces those "remember we're using Linkerd, not Istio" preamble messages
- Keeps feedback relevant (no more Terraform tips in your ConfigMap)
- Great for mixed repos (who hasn't got a little Terraform next to their Argo Application manifests?)
I'm curiousβhow would you layer this? I'm thinking of combining it with:
- A global rule for general Kubernetes / GitOps principles
- Overrides for specific subdirectories like `./service-mesh/`
- Maybe even binding to a `helmfile.yaml` or `kustomization.yaml` for those tools specifically.
Anyone else playing with this? What file-type-specific instructions would you add for our usual stack? 🤔
#k8s