# Create Service

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-harness-harness-skills-create-service`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [harness](https://agentstack.voostack.com/s/harness)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [harness](https://github.com/harness)
- **Source:** https://github.com/harness/harness-skills/tree/main/skills/create-service
- **Website:** https://developer.harness.io/docs/platform/harness-ai/harness-skills/

## Install

```sh
agentstack add skill-harness-harness-skills-create-service
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Create Service

Generate Harness Service YAML and push to Harness via MCP.

## Instructions

1. **Detect service type from codebase** (if source code is available) - Scan the project for deployment manifests to auto-select the correct `serviceDefinition.type` and manifest configuration:
   - `k8s/`, `kubernetes/`, `manifests/` with YAML files → `Kubernetes` with `K8sManifest`
   - `kustomization.yaml` → `Kubernetes` with `Kustomize`
   - `Chart.yaml`, `charts/`, `helm/` → `NativeHelm` with `HelmChart`
   - `task-definition.json` → `ECS` with `EcsTaskDefinition`
   - `serverless.yml` / `template.yaml` (SAM) → `ServerlessAwsLambda`
   - `function.json` (Azure) → `AzureWebApp`
   - `.NET` + Windows → `WinRm`
   - Traditional app (JAR/WAR) without containers → `Ssh`
   - See `create-pipeline/references/codebase-analysis.md` Step 4 for the full decision tree
2. **Detect artifact source** - Match Dockerfile registry references to artifact source type:
   - Docker Hub → `DockerRegistry`
   - `*.dkr.ecr.*.amazonaws.com` → `Ecr`
   - `gcr.io` / `*-docker.pkg.dev` → `Gcr`
   - `*.azurecr.io` → `Acr`
3. **Confirm with user** - Present detected service type, manifest type, and artifact source for confirmation
4. **Generate YAML** following the structure below
5. **Create via MCP** using `harness_create` with resource_type `service`

## Service Structure

```yaml
service:
  name: My Service
  identifier: my_service
  orgIdentifier: default
  projectIdentifier: my_project
  serviceDefinition:
    type: Kubernetes        # Kubernetes, NativeHelm, ECS, ServerlessAwsLambda, Ssh, WinRm, AzureWebApp, AzureFunction, CustomDeployment
    spec:
      artifacts:
        primary:
          primaryArtifactRef: docker_image
          sources:
            - identifier: docker_image
              type: DockerRegistry
              spec:
                connectorRef: dockerhub
                imagePath: myorg/myimage
                tag: 
      manifests:
        - manifest:
            identifier: k8s_manifest
            type: K8sManifest
            spec:
              store:
                type: Github
                spec:
                  connectorRef: github_connector
                  repoName: my-manifests
                  branch: main
                  paths: [manifests/]
      variables:
        - name: replicas
          type: String
          value: "3"
```

## Deployment Types

### Kubernetes Service
```yaml
serviceDefinition:
  type: Kubernetes
  spec:
    artifacts:
      primary:
        primaryArtifactRef: main_image
        sources:
          - identifier: main_image
            type: DockerRegistry
            spec:
              connectorRef: dockerhub
              imagePath: myorg/api
              tag: 
    manifests:
      - manifest:
          identifier: manifests
          type: K8sManifest
          spec:
            store:
              type: Github
              spec:
                connectorRef: github
                repoName: k8s-manifests
                branch: main
                paths: [deploy/]
```

### Helm Service
```yaml
serviceDefinition:
  type: NativeHelm
  spec:
    artifacts:
      primary:
        primaryArtifactRef: chart
        sources:
          - identifier: chart
            type: DockerRegistry
            spec:
              connectorRef: dockerhub
              imagePath: myorg/api
              tag: 
    manifests:
      - manifest:
          identifier: helm_chart
          type: HelmChart
          spec:
            store:
              type: Http
              spec:
                connectorRef: helm_repo
            chartName: my-chart
            chartVersion: 
            helmVersion: V3
```

### Kustomize Service
```yaml
serviceDefinition:
  type: Kubernetes
  spec:
    artifacts:
      primary:
        primaryArtifactRef: main_image
        sources:
          - identifier: main_image
            type: DockerRegistry
            spec:
              connectorRef: dockerhub
              imagePath: myorg/api
              tag: 
    manifests:
      - manifest:
          identifier: kustomize
          type: Kustomize
          spec:
            store:
              type: Github
              spec:
                connectorRef: github
                repoName: k8s-config
                branch: main
                folderPath: overlays/production
            pluginPath: ""
```

### ECS Service
```yaml
serviceDefinition:
  type: ECS
  spec:
    artifacts:
      primary:
        primaryArtifactRef: ecr_image
        sources:
          - identifier: ecr_image
            type: Ecr
            spec:
              connectorRef: aws_connector
              region: us-east-1
              imagePath: my-image
              tag: 
    manifests:
      - manifest:
          identifier: task_def
          type: EcsTaskDefinition
          spec:
            store:
              type: Github
              spec:
                connectorRef: github
                repoName: ecs-config
                branch: main
                paths: [task-definition.json]
```

### Serverless Lambda Service
```yaml
serviceDefinition:
  type: ServerlessAwsLambda
  spec:
    artifacts:
      primary:
        primaryArtifactRef: s3_artifact
        sources:
          - identifier: s3_artifact
            type: AmazonS3
            spec:
              connectorRef: aws_connector
              region: us-east-1
              bucketName: my-deployments
              filePath: serverless-app.zip
    manifests:
      - manifest:
          identifier: serverless_manifest
          type: ServerlessAwsLambda
          spec:
            store:
              type: Github
              spec:
                connectorRef: github
                repoName: serverless-config
                branch: main
                paths: [serverless.yml]
```

## Artifact Source Types

- `DockerRegistry` - Docker Hub (connectorRef, imagePath, tag)
- `Ecr` - AWS ECR (connectorRef, region, imagePath, tag)
- `Gcr` - Google GCR (connectorRef, registryHostname, imagePath, tag)
- `GoogleArtifactRegistry` - Google Artifact Registry (connectorRef, region, repositoryName, package, version)
- `Acr` - Azure ACR (connectorRef, subscriptionId, registry, repository, tag)
- `ArtifactoryRegistry` - JFrog Artifactory (connectorRef, repository, artifactPath, repositoryFormat, tag)
- `Nexus3Registry` - Nexus (connectorRef, repository, artifactPath, repositoryFormat, tag)
- `GithubPackageRegistry` - GitHub Packages (connectorRef, packageType, org, packageName, version)
- `AmazonS3` - S3 (connectorRef, region, bucketName, filePath)
- `GoogleCloudStorage` - GCS (connectorRef, project, bucket, artifactPath)
- `CustomArtifact` - Custom source (scripts, delegateSelectors, version)

## Creating via MCP

```
Call MCP tool: harness_create
Parameters:
  resource_type: "service"
  org_id: ""
  project_id: ""
  body: 
```

List existing services:
```
Call MCP tool: harness_list
Parameters:
  resource_type: "service"
  org_id: ""
  project_id: ""
```

## Examples

- "Create a K8s service with Docker Hub artifact" - Kubernetes type with DockerRegistry source
- "Create a Helm service" - NativeHelm type with HelmChart manifest
- "Create an ECS service with ECR" - ECS type with Ecr artifact source

## Performance Notes

- Verify that referenced connectors exist before creating the service definition.
- Ensure the deployment type matches the infrastructure type that will be used in the pipeline.
- For artifact sources, confirm the image path and registry are accessible.
- Quality of service configuration is more important than speed.

## Troubleshooting

- `CONNECTOR_NOT_FOUND` - Create connector first or fix connectorRef
- `DUPLICATE_IDENTIFIER` - Service exists; use `harness_update`
- Artifact tag `` means the tag is provided at runtime

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [harness](https://github.com/harness)
- **Source:** [harness/harness-skills](https://github.com/harness/harness-skills)
- **License:** Apache-2.0
- **Homepage:** https://developer.harness.io/docs/platform/harness-ai/harness-skills/

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-harness-harness-skills-create-service
- Seller: https://agentstack.voostack.com/s/harness
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
