[Canonical page](<https://docs.dhtmlx.com/planning-engine/java/api/assign/skill/>)
[Full documentation index](<https://docs.dhtmlx.com/planning-engine/llms.txt>)


# Skill

One skill a [`Worker`](<https://docs.dhtmlx.com/planning-engine/java/api/assign/worker.md>) has, with its value. Use `0`/`1` for a skill a worker either has or doesn't, and an integer grade for a skill with levels. Create one with `new Skill()` and the `withId` / `withValue` setters, then put it in [`Worker.skills`](<https://docs.dhtmlx.com/planning-engine/java/api/assign/worker.md>).

A [`SkillMatch`](<https://docs.dhtmlx.com/planning-engine/java/api/assign/requirement.md#skillmatch>) compares this value when [`SkillLayer.slots`](<https://docs.dhtmlx.com/planning-engine/java/api/skill-layer-slots.md>) picks candidates. A skill the worker doesn't list counts as `0` there.

## Declaration

```java
package org.dhtmlx.plen;

public class Skill extends ValueRecord implements DeepCloneable<Skill>
```

Every field is public and mutable, and has a `withX(value)` setter that assigns it and returns `this`. `equals`, `hashCode` and `toString` come from [`ValueRecord`](<https://docs.dhtmlx.com/planning-engine/java/api/support/value-record.md>) and compare `id` and `value`.

## Constructors

### Skill()

```java
public Skill()
```

Creates a skill with `id = null` and `value = 1.0`. Set `id` before use.

## Fields

| Field | Type | Default | Description |
|---|---|---|---|
| `id` | [`Id`](<https://docs.dhtmlx.com/planning-engine/java/api/data/id.md>) | `null` | Skill id. Must be unique within one worker's `skills`. |
| `value` | `double` | `1.0` | Skill value: `0`/`1` for a yes/no skill, an integer grade otherwise. Must be finite. |

```java
public Id id;
public double value;

public Skill withId(Id value)
public Skill withValue(double value)
```

[`SkillLayer.slots`](<https://docs.dhtmlx.com/planning-engine/java/api/skill-layer-slots.md>) and `SkillLayer.validatePool` reject a duplicate `id` or a non-finite `value` with a [`MatchException.Invalid`](<https://docs.dhtmlx.com/planning-engine/java/api/errors/match-exception.md>) at `pool.workers[i].skills[j].id` or `.value`. See [Errors](<https://docs.dhtmlx.com/planning-engine/java/api/skill-layer-slots.md#errors>).

## Methods

### deepClone

```java
public Skill deepClone()
```

Returns a new skill with the same `id` and `value`.

### copy

```java
public Skill copy()
```

Returns a shallow copy. A skill holds only an immutable `Id` and a `double`, so the result equals `deepClone()`.

## Example

```java
import java.util.List;
import org.dhtmlx.plen.*;

public class SkillExample {
    public static void main(String[] args) throws Exception {
        Worker bob = new Worker()
                .withResource(Id.str("bob"))
                .withSkills(List.of(
                        new Skill().withId(Id.str("backend")),           // has the skill (value = 1.0)
                        new Skill().withId(Id.str("qa")).withValue(2))); // QA grade 2

        System.out.println(bob);
    }
}
```

## Related

- [`Worker`](<https://docs.dhtmlx.com/planning-engine/java/api/assign/worker.md>) - holds the skills of one resource
- [`SkillMatch`](<https://docs.dhtmlx.com/planning-engine/java/api/assign/requirement.md#skillmatch>) - the condition that compares skill values
- [`SkillLayer.slots`](<https://docs.dhtmlx.com/planning-engine/java/api/skill-layer-slots.md>) - the call that matches skills
- [Skills and requirements](<https://docs.dhtmlx.com/planning-engine/java/resources-and-assignment/skills-and-requirements.md#pools-and-skills>) - yes/no and graded skills
