Skip to content
65 changes: 65 additions & 0 deletions .agents/skills/documentation-writer/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: documentation writer
description: Use when writing documentation.
---

# CIME documentation writer

## Overview

Use this skill to write documentation.

The goal is to write clear and complete documentation.
- Explain when and how to use tools.
- Provide working examples.
- Note any preconditions that must be met.
- Note any side effects.
- Group related topics in common directories.

## When to use

Use this skill when:
- Writing documentation under `doc/`.
- Writing docstrings under `CIME/`.

## Formats

- Documentation format: `Sphinx ReStructuredText`.
- Docstring format: `Google Style Python Docstrings`.

## Documentation placement rules

- Place Control Case System documentation under `doc/source/ccs/`.
- Place System Testing documentation under `doc/source/system_testing.rst`.
- Place tool documentation under `doc/source/tools/`.
- Place developer documentation under `doc/source/contributing-guide.rst`.

## Naming rules

- File use kebab-case where filename is short description or tool name e.g. `query-configuration.rst`.
- Group similar docuemntations under parent directories e.g. everything under `doc/source/ccs` related to the Case Control System.

## Docuemntation Workflow

1. Identify the topic being documented.
2. Locate where to place file under `doc/source`.
3. Add documentation and examples.
4. Find areas that should link to new documentation.
5. Ask user to review.
6. Apply feedback and loop until user is satisfied with documentation.

## Docstring Workflow

1. Identify the method/function being documented.
2. Review the code.
3. Create the docstring, provide examples and explainations, note side effects.
4. Ask user to review.
5. Apply feedback and loop until user is satisfied with documentation.

## Commands

Build the documentation:

```bash
make -C doc/ html
```
78 changes: 78 additions & 0 deletions .agents/skills/system-test/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
name: unit-test
description: Use when writing or modifying CIME end-to-end tests.
---

# CIME System Tests

## Overview

Use this skill to write system tests that match CIME conventions exactly.

The goal is consistency and reliability:
- Each test should be self contained.
- Keep tests deterministic.
- Match project structure and naming.
- Reuse common helpers instead of ad-hoc setup.
- Verify behavior and side effects.

## When to use

Use this skill when:
- You are writing or modifying python system tests under `CIME/tests`. Test files will be prefixed with `test_sys`.

Do not use this skill to write unit tests.

## Required frameworks and style

- Test framework: `pytest`
- Mocks: Use only when neccesary, prefer dependency injection.
- Deterministic: no random behavior in tests.

## Test structure

Follow this exact order within every test method:

```
# Context
values = ["a", "b", "c"]
env_mach = EnvMach()

# Mocks
env = MagicMock()

# Act
output = env_mach.get_values(values, env=env)

# Assert
assert output != None
env.assert_called_with()
```

## Placement rules

- Place tests under `CIME/tests`.

## Naming rules

- Test file: `test_sys_<target>.py`
- Test method: `test_<target>_<condition>`

## Unit test workflow

1. Identify the target and condition under `CIME/`.
2. Place test in matching `CIME/tests/test_sys_<target>.py`.
3. Name class/methods with project naming convention.
4. Execute method once in Act section.
5. Assert result + mock interactions.
6. Run the specific test, then broader suite if needed.
7. Check `${PWD}/storage` for the output from the tests.
7. Check coverage.

## Commands

```bash
docker run -it --rm -e CIME_MODEL=<model> -e CIME_MACHINE=docker -v ${PWD}/..:/root/model -v ${PWD}/storage:/root/storage -w /root/model/cime ghcr.io/esmci/cime:latest pytest --no-teardown CIME/tests/test_sys_<target>.py
```

## Common Mistakes
76 changes: 76 additions & 0 deletions .agents/skills/unit-test/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: unit-test
description: Use when writing or modifying CIME unit tests.
---

# CIME Unit Tests

## Overview

Use this skill to write unit tests that match CIME conventions exactly.

The goal is consistency and reliability:
- Keep tests deterministic.
- Match project structure and naming.
- Reuse common helpers instead of ad-hoc setup.
- Verify behavior and side effects.

## When to use

Use this skill when:
- You are writing or modifying python unit tests unit under `CIME/tests`. Test files will be prefixed with `test_unit`.

Do not use this skill to write end-to-end tests.

## Required frameworks and style

- Test framework: `pytest`
- Mocks: Use only when neccesary, prefer dependency injection.
- Deterministic: no random behavior in tests.

## Test structure

Follow this exact order within every test method:

```
# Context
values = ["a", "b", "c"]
env_mach = EnvMach()

# Mocks
env = MagicMock()

# Act
output = env_mach.get_values(values, env=env)

# Assert
assert output != None
env.assert_called_with()
```

## Placement rules

- Place tests under `CIME/tests`.

## Naming rules

- Test file: `test_unit_<unit>.py`
- Test method: `test_<unit>_<condition>`

## Unit test workflow

1. Identify class and unit under `CIME/`.
2. Place test in matching `CIME/tests/test_unit_<class>.py`.
3. Name class/methods with project naming convention.
4. Execute method once in Act section.
5. Assert result + mock interactions.
6. Run the specific test, then broader suite if needed.
7. Check coverage.

## Commands

```bash
pytest --machine docker CIME/tests/test_unit_<class>.py
```

## Common Mistakes
Loading