create-policy
Skill2 starsChanged 7 months agoApache-2.0Archived repositoryView on GitHub
Create OPA governance policies for Harness via MCP. Define policies that enforce compliance rules on pipelines, services, environments, feature flags, artifacts, code repositories, templates, SBOM, security tests, Terraform, GitOps, connectors, secrets, and more. Use when asked to create, write, fix, or explain an OPA policy, Rego rule, deny rule, governance policy, compliance rule, or policy-as-code for any Harness entity. Trigger phrases: create policy, OPA policy, governance policy, compliance rule, rego policy, deny rule, enforce policy, security policy, supply chain governance.
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Create OPA governance policies for Harness Software Supply Chain Assurance (SCS) via MCP.
- Distinctive: line 47
After a policy is created, check compliance status on artifacts or repositories:
- Very specific: line 162
Ensure the policy package name follows package harness.<domain> convention.
- Distinctive: line 163
Test policy logic mentally against expected inputs before creating.
- Distinctive: line 169
Check that the policy scope matches the target artifacts/repositories
- Very specific: line 170
Use scs_compliance_result to verify the policy is being evaluated
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill 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
Create Policy
Create OPA governance policies for Harness Software Supply Chain Assurance (SCS) via MCP.
Instructions
Step 1: Identify Policy Requirements
Determine what the policy should enforce:
- What entity type is the policy targeting? (pipeline, service, environment, feature flag, etc.)
- What is the enforcement action (warn, deny)?
- What scope should the policy apply to?
- What action triggers the policy? (onrun, onsave, onstep, etc.)
For writing Rego policies, consult references/rego-writing-guide.md for the complete Rego writing rules, entity types, package names, and common patterns. For entity-specific schemas and examples, see the entity reference files listed in that guide.
Step 2: Create the Policy
Call MCP tool: harness_create
Parameters:
resource_type: "scs_opa_policy"
org_id: "<organization>"
project_id: "<project>"
body: <policy definition>Step 3: Verify Compliance Results
After a policy is created, check compliance status on artifacts or repositories:
Call MCP tool: harness_list
Parameters:
resource_type: "scs_compliance_result"
org_id: "<organization>"
project_id: "<project>"Common Policy Patterns
Require SBOM Generation
Enforce that all artifacts have an SBOM before deployment:
package harness.artifact
deny[msg] {
not input.artifact.sbom
msg := "Artifact must have an SBOM before deployment"
}Block Critical Vulnerabilities
Deny deployment of artifacts with critical CVEs:
package harness.artifact
deny[msg] {
vuln := input.artifact.vulnerabilities[_]
vuln.severity == "CRITICAL"
msg := sprintf("Critical vulnerability %s found in artifact", [vuln.cve_id])
}Enforce Approved Base Images
Restrict container images to approved base images:
package harness.artifact
approved_bases := {"alpine", "distroless", "ubuntu"}
deny[msg] {
not approved_bases[input.artifact.base_image]
msg := sprintf("Base image '%s' is not in the approved list", [input.artifact.base_image])
}Require Signed Artifacts
Enforce artifact signing before deployment:
package harness.artifact
deny[msg] {
not input.artifact.signed
msg := "Artifact must be signed before deployment"
}Related Resource Types
| Resource Type | Operations | Description |
scs_opa_policy | create | Create governance policies |
scs_compliance_result | list | Check policy compliance status |
artifact_security | list, get | View artifact security posture |
code_repo_security | list, get | View repository security posture |
scs_chain_of_custody | get | Verify artifact provenance |
Rego Policy Reference Files
For writing Rego policies for any Harness entity, consult these reference files:
- Rego writing guide and rules — Entity types, package names, Rego patterns, quality checklist
- Pipeline policies and schema — Pipeline input schema, step/stage nesting, walk patterns
- Feature Flag / FME policies — Feature flag, definition, FME environment, segment schemas
- Service, Environment, Infrastructure — Service, env, infra schemas and examples
- Security Tests policies — Security test output schema, severity/coverage checks
- SBOM policies — SBOM deny/allow list patterns with semver comparison
- Terraform and Workspace — Terraform plan, cost, state, workspace schemas
- GitOps Application — GitOps app schema, namespace/label/revision policies
- Code Repository — Code repo naming, visibility, branch policies
- Variable policies — Variable schema, role-based restrictions
- Override policies — Override schema, config file and variable protection
- Connector policies — Connector schema, type/auth/naming restrictions
- Secret policies — Secret schema, naming/type/provider restrictions
- Template policies — Template schema, approval/versioning/environment checks
- Database DevOps policies — SQL statement governance, DDL restrictions, transaction limits
- Upstream Firewall — Firewall package schema, CVE/license policies
- Advanced patterns — Exception handling, walk, scoped references, exemptions
Examples
- "Create a policy to block critical CVEs" -- Create OPA deny rule for critical severity
- "Enforce SBOM generation for all artifacts" -- Create policy requiring SBOM presence
- "Only allow approved base images" -- Create policy with allowed base image list
- "Require artifact signing before production" -- Create policy checking signature status
- "Require approval before production deployments" -- Pipeline policy with Approval stage check
- "Enforce disallowPipelineExecutor on approval steps" -- Pipeline walk-based step check
- "Block Terraform plans exceeding $100/month" -- Terraform plan cost policy
- "Require feature flag descriptions" -- FME feature flag onsave policy
- "Prevent GitOps deployments to kube-system" -- GitOps namespace restriction
- "Check which artifacts violate our policies" -- List scs_compliance_result
Performance Notes
- Validate Rego syntax before submitting. Common issues: missing package declaration, deny rules without msg return.
- Ensure the policy package name follows
package harness.<domain>convention. - Test policy logic mentally against expected inputs before creating.
Troubleshooting
Policy Not Enforcing
- Policies are create-only via MCP -- verify the policy was created successfully
- Check that the policy scope matches the target artifacts/repositories
- Use
scs_compliance_resultto verify the policy is being evaluated
Policy Syntax Errors
- OPA policies use Rego language -- validate syntax before submitting
- Package names should follow
package harness.<domain>convention - Deny rules must return a
msgstring explaining the violation
Limitations
- MCP supports create-only for OPA policies (no list, update, or delete via MCP)
- For managing existing policies, use the Harness UI under Supply Chain Assurance settings
- Policies apply within the project scope where they are created
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- harness/harness-skills★ 12787% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository30 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/harness.mdcCursor rule
- analyze-costsSkill
- audit-reportSkill
- chaos-experimentSkill
- create-agentSkill
- create-agent-templateSkill
- create-connectorSkill
- create-environmentSkill
- create-infrastructureSkill
- create-pipelineSkill
- create-pipeline-v1Skill
- create-secretSkill
- create-serviceSkill
- create-templateSkill
- create-triggerSkill
- debug-pipelineSkill
- dora-metricsSkill
- gitops-statusSkill
- manage-delegatesSkill
- manage-feature-flagsSkill
- manage-rolesSkill
- manage-usersSkill
- migrate-pipelineSkill
- run-pipelineSkill
- scorecard-reviewSkill
- security-reportSkill
- template-usageSkill
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.

