[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EFPQ94K391MEXB1YZQPJMV":3,"skill-same:01M6EFPQ94K391MEXB1YZQPJMV":45},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":25,"repositoryHtmlUrl":26,"repositoryHomepageUrl":27,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M6EFPQ94K391MEXB1YZQPJMV","opa",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fopa\u002FSKILL.md",[],[5],"2026-11-10 10:12:30",false,"# OPA — Open Policy Agent\n\n\n## Overview\n\n\nOPA (Open Policy Agent), the CNCF policy engine for unified authorization across the stack. Helps developers write Rego policies for Kubernetes admission control, API authorization, infrastructure-as-code validation, and data filtering — enforcing security policies as code.\n\n\n## Instructions\n\n### Rego Policy Language\n\n```rego\n# policy\u002Fauthz.rego — API authorization policy\npackage authz\n\nimport rego.v1\n\ndefault allow := false\n\n# Admin users can do anything\nallow if {\n    input.user.role == \"admin\"\n}\n\n# Users can read their own data\nallow if {\n    input.method == \"GET\"\n    input.path[0] == \"users\"\n    input.path[1] == input.user.id\n}\n\n# Users can update their own profile\nallow if {\n    input.method in {\"PUT\", \"PATCH\"}\n    input.path[0] == \"users\"\n    input.path[1] == input.user.id\n    not input.body.role                   # Can't change own role\n}\n\n# Team members can read team resources\nallow if {\n    input.method == \"GET\"\n    input.path[0] == \"teams\"\n    team_id := input.path[1]\n    team_id in input.user.teams\n}\n\n# Managers can approve expenses under $10,000\nallow if {\n    input.method == \"POST\"\n    input.path == [\"expenses\", \"approve\"]\n    input.user.role == \"manager\"\n    input.body.amount \u003C 10000\n}\n\n# Deny reasons for audit trail\nreasons contains msg if {\n    not allow\n    input.user.role != \"admin\"\n    msg := sprintf(\"User %s with role %s denied access to %s %s\",\n        [input.user.id, input.user.role, input.method, concat(\"\u002F\", input.path)])\n}\n```\n\n### Kubernetes Admission Control (Gatekeeper)\n\n```yaml\n# Gatekeeper ConstraintTemplate — define reusable policy templates\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8srequiredlabels\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sRequiredLabels\n      validation:\n        openAPIV3Schema:\n          type: object\n          properties:\n            labels:\n              type: array\n              items:\n                type: string\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8srequiredlabels\n\n        import rego.v1\n\n        violation contains {\"msg\": msg} if {\n          provided := {label | input.review.object.metadata.labels[label]}\n          required := {label | label := input.parameters.labels[_]}\n          missing := required - provided\n          count(missing) > 0\n          msg := sprintf(\"Missing required labels: %v\", [missing])\n        }\n\n---\n# Apply the constraint — all deployments must have these labels\napiVersion: constraints.gatekeeper.sh\u002Fv1beta1\nkind: K8sRequiredLabels\nmetadata:\n  name: require-team-labels\nspec:\n  match:\n    kinds:\n      - apiGroups: [\"apps\"]\n        kinds: [\"Deployment\"]\n  parameters:\n    labels:\n      - \"app.kubernetes.io\u002Fname\"\n      - \"app.kubernetes.io\u002Fmanaged-by\"\n      - \"team\"\n```\n\n```yaml\n# Block containers running as root\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8snoroot\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sNoRoot\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8snoroot\n\n        import rego.v1\n\n        violation contains {\"msg\": msg} if {\n          container := input.review.object.spec.containers[_]\n          not container.securityContext.runAsNonRoot\n          msg := sprintf(\"Container %s must set runAsNonRoot: true\", [container.name])\n        }\n\n        violation contains {\"msg\": msg} if {\n          container := input.review.object.spec.containers[_]\n          container.securityContext.runAsUser == 0\n          msg := sprintf(\"Container %s must not run as root (UID 0)\", [container.name])\n        }\n\n---\napiVersion: constraints.gatekeeper.sh\u002Fv1beta1\nkind: K8sNoRoot\nmetadata:\n  name: no-root-containers\nspec:\n  match:\n    kinds:\n      - apiGroups: [\"\"]\n        kinds: [\"Pod\"]\n      - apiGroups: [\"apps\"]\n        kinds: [\"Deployment\", \"StatefulSet\"]\n```\n\n### API Integration\n\n```typescript\n\u002F\u002F src\u002Fmiddleware\u002Fopa-authz.ts — OPA-backed API authorization\nimport type { Request, Response, NextFunction } from \"express\";\n\nconst OPA_URL = process.env.OPA_URL ?? \"http:\u002F\u002Fopa:8181\";\n\nexport async function authorize(req: Request, res: Response, next: NextFunction) {\n  const input = {\n    method: req.method,\n    path: req.path.split(\"\u002F\").filter(Boolean),\n    user: {\n      id: req.user?.id,\n      role: req.user?.role,\n      teams: req.user?.teams ?? [],\n    },\n    body: req.body,\n  };\n\n  const response = await fetch(`${OPA_URL}\u002Fv1\u002Fdata\u002Fauthz\u002Fallow`, {\n    method: \"POST\",\n    headers: { \"Content-Type\": \"application\u002Fjson\" },\n    body: JSON.stringify({ input }),\n  });\n\n  const { result } = await response.json();\n\n  if (result) {\n    next();\n  } else {\n    res.status(403).json({ error: \"Forbidden\" });\n  }\n}\n\n\u002F\u002F Usage: app.use(authorize);\n```\n\n### Terraform Validation\n\n```rego\n# policy\u002Fterraform.rego — Validate Terraform plans before apply\npackage terraform\n\nimport rego.v1\n\n# Deny public S3 buckets\ndeny contains msg if {\n  resource := input.resource_changes[_]\n  resource.type == \"aws_s3_bucket\"\n  resource.change.after.acl == \"public-read\"\n  msg := sprintf(\"S3 bucket %s must not be public\", [resource.address])\n}\n\n# Require encryption on RDS instances\ndeny contains msg if {\n  resource := input.resource_changes[_]\n  resource.type == \"aws_db_instance\"\n  not resource.change.after.storage_encrypted\n  msg := sprintf(\"RDS instance %s must have encryption enabled\", [resource.address])\n}\n\n# Limit instance sizes\ndeny contains msg if {\n  resource := input.resource_changes[_]\n  resource.type == \"aws_instance\"\n  not resource.change.after.instance_type in allowed_instance_types\n  msg := sprintf(\"Instance %s uses %s, allowed: %v\",\n    [resource.address, resource.change.after.instance_type, allowed_instance_types])\n}\n\nallowed_instance_types := {\"t3.micro\", \"t3.small\", \"t3.medium\", \"m5.large\"}\n```\n\n```bash\n# Validate Terraform plan with OPA\nterraform plan -out=plan.tfplan\nterraform show -json plan.tfplan > plan.json\nopa eval -d policy\u002F -i plan.json \"data.terraform.deny\"\n```\n\n## Installation\n\n```bash\n# CLI\nbrew install opa\n\n# Docker\ndocker run -p 8181:8181 openpolicyagent\u002Fopa run --server\n\n# Kubernetes (Gatekeeper)\nkubectl apply -f https:\u002F\u002Fraw.githubusercontent.com\u002Fopen-policy-agent\u002Fgatekeeper\u002Fv3.15.0\u002Fdeploy\u002Fgatekeeper.yaml\n```\n\n\n## Examples\n\n\n### Example 1: Setting up Opa for a microservices project\n\n**User request:**\n\n```\nI have a Node.js API and a React frontend running in Docker. Set up Opa for monitoring\u002Fdeployment.\n```\n\nThe agent creates the necessary configuration files based on patterns like `# Gatekeeper ConstraintTemplate — define reusable policy tem`, sets up the integration with the existing Docker setup, configures appropriate defaults for a Node.js + React stack, and provides verification commands to confirm everything is working.\n\n### Example 2: Troubleshooting kubernetes admission control issues\n\n**User request:**\n\n```\nOpa is showing errors in our kubernetes admission control. Here are the logs: [error output]\n```\n\nThe agent analyzes the error output, identifies the root cause by cross-referencing with common Opa issues, applies the fix (updating configuration, adjusting resource limits, or correcting syntax), and verifies the resolution with appropriate health checks.\n\n\n## Guidelines\n\n1. **Policy as code** — Store policies in Git alongside application code; review policy changes in PRs\n2. **Rego testing** — Write unit tests for policies: `opa test policy\u002F -v`; catch policy bugs before deployment\n3. **Gatekeeper for K8s** — Use OPA Gatekeeper for admission control; enforce policies at deploy time, not just at runtime\n4. **Centralize authorization** — Move authorization logic from application code to OPA; one policy engine across all services\n5. **Deny by default** — Start with `default allow := false`; explicitly grant access rather than revoking\n6. **Bundle for distribution** — Package policies as OPA bundles; deploy to OPA instances via bundle server\n7. **Terraform validation** — Validate `terraform plan` output with OPA before `terraform apply`; prevent misconfigurations\n8. **Audit logging** — Log OPA decisions for compliance; track who accessed what and which policy allowed\u002Fdenied it\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FTerminalSkills\u002Fskills\u002Fopa",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill opa",{"tool":37,"command":38},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill opa",{"tool":40,"command":41},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill opa","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fopa\u002FSKILL.md",true,[],[46,55,64,73,79,85],{"skillNo":47,"name":48,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[52,53,54],"model","model hierarchy","model hierarchy skill",{"skillNo":56,"name":57,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[61,62,63],"MCP","zoom","zoom mcp",{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":18},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[70,71,72,62],"sdk","zoom apps sdk","apps",{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[75],{"skillNo":80,"name":81,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[81],{"skillNo":86,"name":87,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":18},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[87]]