@harness-engineering/cli 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/harness.js +1 -1
- package/dist/{chunk-IXT3KLVN.js → chunk-APYEWOCR.js} +355 -19
- package/dist/index.js +1 -1
- package/package.json +6 -4
- package/dist/agents/commands/claude-code/harness/add-component.md +0 -34
- package/dist/agents/commands/claude-code/harness/align-documentation.md +0 -33
- package/dist/agents/commands/claude-code/harness/architecture-advisor.md +0 -41
- package/dist/agents/commands/claude-code/harness/brainstorming.md +0 -42
- package/dist/agents/commands/claude-code/harness/check-mechanical-constraints.md +0 -32
- package/dist/agents/commands/claude-code/harness/cleanup-dead-code.md +0 -33
- package/dist/agents/commands/claude-code/harness/code-review.md +0 -33
- package/dist/agents/commands/claude-code/harness/debugging.md +0 -43
- package/dist/agents/commands/claude-code/harness/detect-doc-drift.md +0 -32
- package/dist/agents/commands/claude-code/harness/diagnostics.md +0 -43
- package/dist/agents/commands/claude-code/harness/enforce-architecture.md +0 -32
- package/dist/agents/commands/claude-code/harness/execution.md +0 -43
- package/dist/agents/commands/claude-code/harness/git-workflow.md +0 -32
- package/dist/agents/commands/claude-code/harness/initialize-project.md +0 -33
- package/dist/agents/commands/claude-code/harness/onboarding.md +0 -32
- package/dist/agents/commands/claude-code/harness/parallel-agents.md +0 -35
- package/dist/agents/commands/claude-code/harness/planning.md +0 -41
- package/dist/agents/commands/claude-code/harness/pre-commit-review.md +0 -38
- package/dist/agents/commands/claude-code/harness/refactoring.md +0 -35
- package/dist/agents/commands/claude-code/harness/skill-authoring.md +0 -35
- package/dist/agents/commands/claude-code/harness/state-management.md +0 -35
- package/dist/agents/commands/claude-code/harness/tdd.md +0 -42
- package/dist/agents/commands/claude-code/harness/validate-context-engineering.md +0 -32
- package/dist/agents/commands/claude-code/harness/verification.md +0 -38
- package/dist/agents/commands/gemini-cli/harness/add-component.toml +0 -240
- package/dist/agents/commands/gemini-cli/harness/align-documentation.toml +0 -238
- package/dist/agents/commands/gemini-cli/harness/architecture-advisor.toml +0 -469
- package/dist/agents/commands/gemini-cli/harness/brainstorming.toml +0 -326
- package/dist/agents/commands/gemini-cli/harness/check-mechanical-constraints.toml +0 -249
- package/dist/agents/commands/gemini-cli/harness/cleanup-dead-code.toml +0 -258
- package/dist/agents/commands/gemini-cli/harness/code-review.toml +0 -461
- package/dist/agents/commands/gemini-cli/harness/debugging.toml +0 -436
- package/dist/agents/commands/gemini-cli/harness/detect-doc-drift.toml +0 -215
- package/dist/agents/commands/gemini-cli/harness/diagnostics.toml +0 -401
- package/dist/agents/commands/gemini-cli/harness/enforce-architecture.toml +0 -222
- package/dist/agents/commands/gemini-cli/harness/execution.toml +0 -381
- package/dist/agents/commands/gemini-cli/harness/git-workflow.toml +0 -325
- package/dist/agents/commands/gemini-cli/harness/initialize-project.toml +0 -257
- package/dist/agents/commands/gemini-cli/harness/onboarding.toml +0 -316
- package/dist/agents/commands/gemini-cli/harness/parallel-agents.toml +0 -221
- package/dist/agents/commands/gemini-cli/harness/planning.toml +0 -405
- package/dist/agents/commands/gemini-cli/harness/pre-commit-review.toml +0 -294
- package/dist/agents/commands/gemini-cli/harness/refactoring.toml +0 -209
- package/dist/agents/commands/gemini-cli/harness/skill-authoring.toml +0 -350
- package/dist/agents/commands/gemini-cli/harness/state-management.toml +0 -354
- package/dist/agents/commands/gemini-cli/harness/tdd.toml +0 -247
- package/dist/agents/commands/gemini-cli/harness/validate-context-engineering.toml +0 -186
- package/dist/agents/commands/gemini-cli/harness/verification.toml +0 -334
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
# Generated by harness generate-slash-commands. Do not edit.
|
|
2
|
-
description = "Safe refactoring with validation before and after changes"
|
|
3
|
-
prompt = """
|
|
4
|
-
<context>
|
|
5
|
-
Cognitive mode: meticulous-implementer
|
|
6
|
-
Type: flexible
|
|
7
|
-
</context>
|
|
8
|
-
|
|
9
|
-
<objective>
|
|
10
|
-
Safe refactoring with validation before and after changes
|
|
11
|
-
</objective>
|
|
12
|
-
|
|
13
|
-
<execution_context>
|
|
14
|
-
--- SKILL.md (agents/skills/claude-code/harness-refactoring/SKILL.md) ---
|
|
15
|
-
# Harness Refactoring
|
|
16
|
-
|
|
17
|
-
> Safe refactoring with constraint verification at every step. Change structure without changing behavior, with harness checks as your safety net.
|
|
18
|
-
|
|
19
|
-
## When to Use
|
|
20
|
-
|
|
21
|
-
- When improving code structure, readability, or maintainability without changing behavior
|
|
22
|
-
- When reducing duplication (DRY refactoring)
|
|
23
|
-
- When moving code to the correct architectural layer
|
|
24
|
-
- When splitting large files or functions into smaller, focused ones
|
|
25
|
-
- When renaming for clarity across the codebase
|
|
26
|
-
- After completing a feature (post-TDD cleanup beyond single-cycle refactoring)
|
|
27
|
-
- NOT when adding new behavior (use harness-tdd instead)
|
|
28
|
-
- NOT when fixing bugs (use harness-tdd — write a failing test first)
|
|
29
|
-
- NOT when the test suite is already failing — fix the tests before refactoring
|
|
30
|
-
|
|
31
|
-
## Process
|
|
32
|
-
|
|
33
|
-
### Iron Rule
|
|
34
|
-
|
|
35
|
-
**All tests must pass BEFORE you start refactoring and AFTER every single change.**
|
|
36
|
-
|
|
37
|
-
If tests are not green before you start, you are not refactoring — you are debugging. Fix the tests first. If tests break during refactoring, undo the last change immediately. Do not try to fix forward.
|
|
38
|
-
|
|
39
|
-
### Phase 1: Prepare — Verify Starting State
|
|
40
|
-
|
|
41
|
-
1. **Run the full test suite.** Every test must pass. Record the count of passing tests — this number must not decrease at any point.
|
|
42
|
-
|
|
43
|
-
2. **Run `harness validate`** and **`harness check-deps`**. Both must pass. You are establishing a clean baseline. If either reports issues, fix those first (that is a separate task, not part of this refactoring).
|
|
44
|
-
|
|
45
|
-
3. **Identify the refactoring target.** Be specific: which file, function, class, or module? What is wrong with the current structure? What will be better after refactoring?
|
|
46
|
-
|
|
47
|
-
4. **Plan the steps.** Break the refactoring into the smallest possible individual changes. Each step should be independently committable and verifiable. If you cannot describe a step in one sentence, it is too large.
|
|
48
|
-
|
|
49
|
-
### Phase 2: Execute — One Small Change at a Time
|
|
50
|
-
|
|
51
|
-
For EACH step in the plan:
|
|
52
|
-
|
|
53
|
-
1. **Make ONE small change.** Examples of "one small change":
|
|
54
|
-
- Rename one variable or function
|
|
55
|
-
- Extract one function from a larger function
|
|
56
|
-
- Move one function to a different file
|
|
57
|
-
- Inline one unnecessary abstraction
|
|
58
|
-
- Replace one conditional with polymorphism
|
|
59
|
-
- Remove one instance of duplication
|
|
60
|
-
|
|
61
|
-
2. **Run the full test suite.** All tests must pass. If any test fails:
|
|
62
|
-
- **STOP immediately.**
|
|
63
|
-
- **Undo the change** (git checkout the file or revert manually).
|
|
64
|
-
- **Analyze why it broke.** Either the change was not purely structural (it changed behavior) or the tests are coupled to implementation details.
|
|
65
|
-
- **Try a smaller step** or a different approach.
|
|
66
|
-
|
|
67
|
-
3. **Run `harness validate` and `harness check-deps`.** Both must pass. A refactoring that fixes code structure but violates architectural constraints is not safe.
|
|
68
|
-
|
|
69
|
-
4. **Commit the step.** Each step gets its own commit. The commit message describes the structural change: "extract validateInput from processOrder" or "move UserRepository to data-access layer."
|
|
70
|
-
|
|
71
|
-
5. **Repeat** for the next step in the plan.
|
|
72
|
-
|
|
73
|
-
### Phase 3: Verify — Confirm the Refactoring is Complete
|
|
74
|
-
|
|
75
|
-
1. **Run the full test suite one final time.** Same number of passing tests as Phase 1.
|
|
76
|
-
|
|
77
|
-
2. **Run `harness validate` and `harness check-deps` one final time.** Clean output.
|
|
78
|
-
|
|
79
|
-
3. **Review the cumulative diff.** Does the final state match the intended improvement? Is the code genuinely better, or just different?
|
|
80
|
-
|
|
81
|
-
4. **If the refactoring introduced no improvement,** revert the entire sequence. Refactoring for its own sake is churn.
|
|
82
|
-
|
|
83
|
-
## Common Refactoring Patterns
|
|
84
|
-
|
|
85
|
-
### Extract Function
|
|
86
|
-
|
|
87
|
-
**When:** A function is doing too many things, or a block of code is reused in multiple places.
|
|
88
|
-
**How:** Identify the block. Ensure all variables it uses are either parameters or local. Cut the block into a new function with a descriptive name. Replace the original block with a call to the new function.
|
|
89
|
-
**Harness guidance:** If the extracted function belongs in a different layer, move it there AND update the import. Run `harness check-deps` to verify the new import respects layer boundaries.
|
|
90
|
-
|
|
91
|
-
### Move to Layer
|
|
92
|
-
|
|
93
|
-
**When:** Code is in the wrong architectural layer (e.g., business logic in a UI component, database queries in a service).
|
|
94
|
-
**How:** Create the function in the correct layer. Update all callers to import from the new location. Delete the old function. Run `harness check-deps` after each step.
|
|
95
|
-
**Harness guidance:** This is where `harness check-deps` is most valuable. Moving code between layers changes the dependency graph. The tool will tell you immediately if the move created a violation.
|
|
96
|
-
|
|
97
|
-
### Split File
|
|
98
|
-
|
|
99
|
-
**When:** A file has grown too large or contains unrelated responsibilities.
|
|
100
|
-
**How:** Identify the cohesive groups within the file. Create new files, one per group. Move functions/classes to their new files. Update the original file to re-export from the new files (for backward compatibility) or update all callers.
|
|
101
|
-
**Harness guidance:** Run `harness validate` after splitting to ensure the new files follow naming conventions and are properly structured. Run `harness check-deps` to verify no new boundary violations.
|
|
102
|
-
|
|
103
|
-
### Inline Abstraction
|
|
104
|
-
|
|
105
|
-
**When:** An abstraction (class, interface, wrapper function) adds complexity without value. It has only one implementation, is never extended, and obscures what the code actually does.
|
|
106
|
-
**How:** Replace uses of the abstraction with the concrete implementation. Delete the abstraction. Run tests.
|
|
107
|
-
**Harness guidance:** Removing an abstraction may expose a layer violation that the abstraction was hiding. Run `harness check-deps` to check.
|
|
108
|
-
|
|
109
|
-
### Rename for Clarity
|
|
110
|
-
|
|
111
|
-
**When:** A name is misleading, ambiguous, or no longer reflects what the code does.
|
|
112
|
-
**How:** Use your editor's rename/refactor tool to change the name everywhere it appears. If the name is part of a public API, check for external consumers first.
|
|
113
|
-
**Harness guidance:** Run `harness check-docs` after renaming to detect documentation that still uses the old name. AGENTS.md, inline comments, and doc pages may all need updating.
|
|
114
|
-
|
|
115
|
-
## Harness Integration
|
|
116
|
-
|
|
117
|
-
- **`harness validate`** — Run before starting, after each step, and at the end. Catches structural issues, naming violations, and configuration drift.
|
|
118
|
-
- **`harness check-deps`** — Run after each step, especially when moving code between files or layers. Catches dependency violations introduced by structural changes.
|
|
119
|
-
- **`harness check-docs`** — Run after renaming or moving public APIs. Catches documentation that references old names or locations.
|
|
120
|
-
- **`harness cleanup`** — Run after completing a refactoring sequence. Detects dead code that the refactoring may have created (unused exports, orphaned files).
|
|
121
|
-
|
|
122
|
-
## Success Criteria
|
|
123
|
-
|
|
124
|
-
- All tests pass before, during, and after refactoring (same count, same results)
|
|
125
|
-
- `harness validate` passes at every step
|
|
126
|
-
- `harness check-deps` passes at every step
|
|
127
|
-
- Each step is an atomic commit with a clear structural description
|
|
128
|
-
- The code is measurably better after refactoring (clearer names, less duplication, correct layering, smaller functions)
|
|
129
|
-
- No behavioral changes were introduced (the test suite is the proof)
|
|
130
|
-
- No dead code was left behind (run `harness cleanup` to verify)
|
|
131
|
-
|
|
132
|
-
## Examples
|
|
133
|
-
|
|
134
|
-
### Example: Moving business logic out of a UI component
|
|
135
|
-
|
|
136
|
-
**Target:** `src/components/OrderSummary.tsx` contains a `calculateDiscount()` function with complex business rules. This logic belongs in the service layer.
|
|
137
|
-
|
|
138
|
-
**Step 1:** Create `src/services/discount-service.ts` with the `calculateDiscount` function copied from the component.
|
|
139
|
-
|
|
140
|
-
- Run tests: pass
|
|
141
|
-
- Run `harness check-deps`: pass (new file, no violations)
|
|
142
|
-
- Commit: "extract calculateDiscount to discount-service"
|
|
143
|
-
|
|
144
|
-
**Step 2:** Update `OrderSummary.tsx` to import `calculateDiscount` from `discount-service` instead of using the local function.
|
|
145
|
-
|
|
146
|
-
- Run tests: pass
|
|
147
|
-
- Run `harness check-deps`: pass (UI importing from service is allowed)
|
|
148
|
-
- Commit: "update OrderSummary to use discount-service"
|
|
149
|
-
|
|
150
|
-
**Step 3:** Delete the original `calculateDiscount` function from `OrderSummary.tsx`.
|
|
151
|
-
|
|
152
|
-
- Run tests: pass
|
|
153
|
-
- Run `harness check-deps`: pass
|
|
154
|
-
- Run `harness cleanup`: no dead code detected
|
|
155
|
-
- Commit: "remove duplicate calculateDiscount from OrderSummary"
|
|
156
|
-
|
|
157
|
-
**Final verification:** 3 steps, 3 commits, all tests green throughout, all harness checks passing. The business logic is now in the correct layer.
|
|
158
|
-
|
|
159
|
-
## Escalation
|
|
160
|
-
|
|
161
|
-
- **When tests fail during refactoring and you cannot figure out why:** Revert to the last green commit. The test failure means the change was not purely structural. Analyze the test to understand what behavioral assumption it depends on, then plan a different approach.
|
|
162
|
-
- **When `harness check-deps` fails after a move:** The code you moved may have dependencies that are not allowed in its new layer. You may need to refactor the moved code itself (remove forbidden imports) before it can live in the new layer.
|
|
163
|
-
- **When a refactoring requires changing tests:** This is a warning sign. If the tests need to change, the refactoring may be changing behavior. The only valid reason to change tests during refactoring is if the tests were testing implementation details (not behavior) — and in that case, fix the tests first as a separate step before refactoring.
|
|
164
|
-
- **When the refactoring scope keeps growing:** Stop. Commit what you have (if it is clean). Re-plan with a smaller scope. Large refactorings should be broken into multiple sessions, each leaving the code in a better state.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
--- skill.yaml (agents/skills/claude-code/harness-refactoring/skill.yaml) ---
|
|
168
|
-
name: harness-refactoring
|
|
169
|
-
version: "1.0.0"
|
|
170
|
-
description: Safe refactoring with validation before and after changes
|
|
171
|
-
cognitive_mode: meticulous-implementer
|
|
172
|
-
triggers:
|
|
173
|
-
- manual
|
|
174
|
-
- on_refactor
|
|
175
|
-
platforms:
|
|
176
|
-
- claude-code
|
|
177
|
-
- gemini-cli
|
|
178
|
-
tools:
|
|
179
|
-
- Bash
|
|
180
|
-
- Read
|
|
181
|
-
- Write
|
|
182
|
-
- Edit
|
|
183
|
-
- Glob
|
|
184
|
-
- Grep
|
|
185
|
-
cli:
|
|
186
|
-
command: harness skill run harness-refactoring
|
|
187
|
-
args:
|
|
188
|
-
- name: path
|
|
189
|
-
description: Project root path
|
|
190
|
-
required: false
|
|
191
|
-
mcp:
|
|
192
|
-
tool: run_skill
|
|
193
|
-
input:
|
|
194
|
-
skill: harness-refactoring
|
|
195
|
-
path: string
|
|
196
|
-
type: flexible
|
|
197
|
-
state:
|
|
198
|
-
persistent: false
|
|
199
|
-
files: []
|
|
200
|
-
depends_on: []
|
|
201
|
-
|
|
202
|
-
</execution_context>
|
|
203
|
-
|
|
204
|
-
<process>
|
|
205
|
-
1. Try: invoke mcp__harness__run_skill with skill: "harness-refactoring"
|
|
206
|
-
2. If MCP unavailable: follow the SKILL.md workflow provided above directly
|
|
207
|
-
3. Pass through any arguments provided by the user
|
|
208
|
-
</process>
|
|
209
|
-
"""
|
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
# Generated by harness generate-slash-commands. Do not edit.
|
|
2
|
-
description = "Create and maintain harness skills following the rich skill format"
|
|
3
|
-
prompt = """
|
|
4
|
-
<context>
|
|
5
|
-
Cognitive mode: constructive-architect
|
|
6
|
-
Type: flexible
|
|
7
|
-
</context>
|
|
8
|
-
|
|
9
|
-
<objective>
|
|
10
|
-
Create and maintain harness skills following the rich skill format
|
|
11
|
-
</objective>
|
|
12
|
-
|
|
13
|
-
<execution_context>
|
|
14
|
-
--- SKILL.md (agents/skills/claude-code/harness-skill-authoring/SKILL.md) ---
|
|
15
|
-
# Harness Skill Authoring
|
|
16
|
-
|
|
17
|
-
> Create and extend harness skills following the rich skill format. Define purpose, choose type, write skill.yaml and SKILL.md with all required sections, validate, and test.
|
|
18
|
-
|
|
19
|
-
## When to Use
|
|
20
|
-
|
|
21
|
-
- Creating a new skill for a team's recurring workflow
|
|
22
|
-
- Extending an existing skill with new phases, gates, or examples
|
|
23
|
-
- Converting an informal process ("how we do code reviews") into a formal harness skill
|
|
24
|
-
- When a team notices they repeat the same multi-step process and wants to codify it
|
|
25
|
-
- NOT when running an existing skill (use the skill directly)
|
|
26
|
-
- NOT when listing or discovering skills (use `harness skill list`)
|
|
27
|
-
- NOT when the process is a one-off task that will not recur
|
|
28
|
-
|
|
29
|
-
## Process
|
|
30
|
-
|
|
31
|
-
### Phase 1: DEFINE — Establish the Skill's Purpose
|
|
32
|
-
|
|
33
|
-
1. **Identify the recurring process.** What does the team do repeatedly? Name it. Describe it in one sentence. This becomes the skill's `description` in `skill.yaml` and the blockquote summary in `SKILL.md`.
|
|
34
|
-
|
|
35
|
-
2. **Define the scope boundary.** A good skill does one thing well. If the process has distinct phases that could be done independently, consider whether it should be multiple skills. Signs of a skill that is too broad: more than 6 phases, multiple unrelated triggers, trying to serve two different audiences.
|
|
36
|
-
|
|
37
|
-
3. **Identify the trigger conditions.** When should this skill activate?
|
|
38
|
-
- `manual` — Only when explicitly invoked
|
|
39
|
-
- `on_new_feature` — When starting a new feature
|
|
40
|
-
- `on_bug_fix` — When fixing a bug
|
|
41
|
-
- `on_pr_review` — When reviewing a pull request
|
|
42
|
-
- `on_project_init` — When initializing or entering a project
|
|
43
|
-
- Multiple triggers are fine if the skill genuinely applies to all of them
|
|
44
|
-
|
|
45
|
-
4. **Determine required tools.** What tools does the skill need? Common sets:
|
|
46
|
-
- Read-only analysis: `Read`, `Glob`, `Grep`
|
|
47
|
-
- Code modification: `Read`, `Write`, `Edit`, `Glob`, `Grep`, `Bash`
|
|
48
|
-
- Full workflow: all of the above plus specialized tools
|
|
49
|
-
|
|
50
|
-
### Phase 2: CHOOSE TYPE — Rigid or Flexible
|
|
51
|
-
|
|
52
|
-
1. **Choose rigid when:**
|
|
53
|
-
- The process has strict ordering that must not be violated
|
|
54
|
-
- Skipping steps causes real damage (data loss, security holes, broken deployments)
|
|
55
|
-
- Compliance or policy requires auditability of each step
|
|
56
|
-
- The process includes mandatory checkpoints where human approval is needed
|
|
57
|
-
- Examples: TDD cycle, deployment pipeline, security audit, database migration
|
|
58
|
-
|
|
59
|
-
2. **Choose flexible when:**
|
|
60
|
-
- The process has recommended steps but the order can adapt to context
|
|
61
|
-
- The agent should use judgment about which steps to emphasize
|
|
62
|
-
- Different situations call for different subsets of the process
|
|
63
|
-
- The process is more about guidelines than rigid procedure
|
|
64
|
-
- Examples: code review, onboarding, brainstorming, project initialization
|
|
65
|
-
|
|
66
|
-
3. **Key difference in SKILL.md:** Rigid skills require `## Gates` and `## Escalation` sections. Flexible skills may omit them (though they can include them if useful).
|
|
67
|
-
|
|
68
|
-
### Phase 3: WRITE SKILL.YAML — Define Metadata
|
|
69
|
-
|
|
70
|
-
1. **Create the skill directory** under `agents/skills/<platform>/<skill-name>/`.
|
|
71
|
-
|
|
72
|
-
2. **Write `skill.yaml`** with all required fields:
|
|
73
|
-
|
|
74
|
-
```yaml
|
|
75
|
-
name: <skill-name> # Kebab-case, matches directory name
|
|
76
|
-
version: '1.0.0' # Semver
|
|
77
|
-
description: <one-line summary> # What this skill does
|
|
78
|
-
triggers:
|
|
79
|
-
- <trigger-1>
|
|
80
|
-
- <trigger-2>
|
|
81
|
-
platforms:
|
|
82
|
-
- claude-code # Which agent platforms support this skill
|
|
83
|
-
tools:
|
|
84
|
-
- <tool-1> # Tools the skill requires
|
|
85
|
-
- <tool-2>
|
|
86
|
-
cli:
|
|
87
|
-
command: harness skill run <skill-name>
|
|
88
|
-
args:
|
|
89
|
-
- name: <arg-name>
|
|
90
|
-
description: <arg-description>
|
|
91
|
-
required: <true|false>
|
|
92
|
-
mcp:
|
|
93
|
-
tool: run_skill
|
|
94
|
-
input:
|
|
95
|
-
skill: <skill-name>
|
|
96
|
-
type: <rigid|flexible>
|
|
97
|
-
state:
|
|
98
|
-
persistent: <true|false> # Does this skill maintain state across sessions?
|
|
99
|
-
files:
|
|
100
|
-
- <state-file-path> # List state files if persistent
|
|
101
|
-
depends_on:
|
|
102
|
-
- <prerequisite-skill> # Skills that must be available (not necessarily run first)
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
3. **Validate the YAML.** Ensure proper indentation, correct field names, and valid values. The `name` field must match the directory name exactly.
|
|
106
|
-
|
|
107
|
-
### Phase 4: WRITE SKILL.MD — Author the Skill Content
|
|
108
|
-
|
|
109
|
-
1. **Start with the heading and summary:**
|
|
110
|
-
|
|
111
|
-
```markdown
|
|
112
|
-
# <Skill Name>
|
|
113
|
-
|
|
114
|
-
> <One-sentence description of what the skill does and why.>
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
2. **Write `## When to Use`.** Include both positive (when TO use) and negative (when NOT to use) conditions. Be specific. Negative conditions prevent misapplication and point to the correct alternative skill.
|
|
118
|
-
|
|
119
|
-
3. **Write `## Process`.** This is the core of the skill. Guidelines for writing good process sections:
|
|
120
|
-
- **Use phases to organize.** Group related steps into named phases (e.g., ASSESS, IMPLEMENT, VERIFY). Each phase should have a clear purpose and completion criteria.
|
|
121
|
-
- **Number every step.** Steps within a phase are numbered. This makes them referenceable ("go back to Phase 2, step 3").
|
|
122
|
-
- **Be prescriptive about actions.** Say "Run `harness validate`" not "consider validating." Say "Read the file" not "you might want to read the file."
|
|
123
|
-
- **Include decision points.** When the process branches, state the conditions clearly: "If X, do A. If Y, do B."
|
|
124
|
-
- **State what NOT to do.** Prohibitions prevent common mistakes: "Do not proceed to Phase 3 if validation fails."
|
|
125
|
-
- **For rigid skills:** Add an Iron Law at the top — the one inviolable principle. Then define phases with mandatory ordering and explicit gates between them.
|
|
126
|
-
- **For flexible skills:** Describe the recommended flow but acknowledge that adaptation is expected. Focus on outcomes rather than exact commands.
|
|
127
|
-
|
|
128
|
-
4. **Write `## Harness Integration`.** List every harness CLI command the skill uses, with a brief description of when to use it. This section connects the skill to the harness toolchain.
|
|
129
|
-
|
|
130
|
-
5. **Write `## Success Criteria`.** Define how to know the skill was executed well. Each criterion should be observable and verifiable — not subjective.
|
|
131
|
-
|
|
132
|
-
6. **Write `## Examples`.** At least one concrete example showing the full process from start to finish. Use realistic project names, file paths, and commands. Show both the commands and their expected outputs.
|
|
133
|
-
|
|
134
|
-
7. **For rigid skills, write `## Gates`.** Gates are hard stops — conditions that must be true to proceed. Each gate should state what happens if violated. Format: "**<condition> = <consequence>.**"
|
|
135
|
-
|
|
136
|
-
8. **For rigid skills, write `## Escalation`.** Define when to stop and ask for help. Each escalation condition should describe the symptom, the likely cause, and what to report.
|
|
137
|
-
|
|
138
|
-
### Phase 5: VALIDATE — Verify the Skill
|
|
139
|
-
|
|
140
|
-
1. **Run `harness skill validate`** to check:
|
|
141
|
-
- `skill.yaml` has all required fields and valid values
|
|
142
|
-
- `SKILL.md` has all required sections (`## When to Use`, `## Process`, `## Harness Integration`, `## Success Criteria`, `## Examples`)
|
|
143
|
-
- Rigid skills have `## Gates` and `## Escalation` sections
|
|
144
|
-
- The `name` in `skill.yaml` matches the directory name
|
|
145
|
-
- Referenced tools exist
|
|
146
|
-
- Referenced dependencies exist
|
|
147
|
-
|
|
148
|
-
2. **Fix any validation errors.** Common issues:
|
|
149
|
-
- Missing required section in `SKILL.md`
|
|
150
|
-
- `name` field does not match directory name
|
|
151
|
-
- Invalid trigger name
|
|
152
|
-
- Missing `type` field in `skill.yaml`
|
|
153
|
-
|
|
154
|
-
3. **Test by running the skill:** `harness skill run <name>`. Verify it loads correctly and the process instructions make sense in context.
|
|
155
|
-
|
|
156
|
-
### Skill Quality Checklist
|
|
157
|
-
|
|
158
|
-
Evaluate every skill along two dimensions:
|
|
159
|
-
|
|
160
|
-
| | **Clear activation** | **Ambiguous activation** | **Missing activation** |
|
|
161
|
-
| --------------------------- | ----------------------------------- | --------------------------------------- | ---------------------- |
|
|
162
|
-
| **Specific implementation** | Good skill | Wasted — good instructions nobody finds | Broken |
|
|
163
|
-
| **Vague implementation** | Trap — agents activate but flounder | Bad skill | Empty shell |
|
|
164
|
-
| **Missing implementation** | Stub | Stub | Does not exist |
|
|
165
|
-
|
|
166
|
-
- **Good skill** = clear activation + specific implementation. The agent knows when to use it and exactly what to do.
|
|
167
|
-
- **Clear activation + vague implementation** = trap. The skill fires correctly but the agent has no concrete instructions, leading to inconsistent results.
|
|
168
|
-
- **Ambiguous activation + specific implementation** = wasted. Great instructions that never get used because the agent does not know when to activate the skill.
|
|
169
|
-
|
|
170
|
-
Use this checklist as a final quality gate before declaring a skill complete.
|
|
171
|
-
|
|
172
|
-
## Harness Integration
|
|
173
|
-
|
|
174
|
-
- **`harness skill validate`** — Validate a skill's `skill.yaml` and `SKILL.md` against the schema and structure requirements.
|
|
175
|
-
- **`harness skill run <name>`** — Execute a skill to test it in context.
|
|
176
|
-
- **`harness skill list`** — List all available skills, useful for checking that a new skill appears after creation.
|
|
177
|
-
- **`harness add skill <name> --type <type>`** — Scaffold a new skill directory with template files (alternative to manual creation).
|
|
178
|
-
|
|
179
|
-
## Success Criteria
|
|
180
|
-
|
|
181
|
-
- `skill.yaml` exists with all required fields and passes schema validation
|
|
182
|
-
- `SKILL.md` exists with all required sections filled with substantive content (not placeholders)
|
|
183
|
-
- The skill name in `skill.yaml` matches the directory name
|
|
184
|
-
- `harness skill validate` passes with zero errors
|
|
185
|
-
- The process section has clear, numbered, actionable steps organized into phases
|
|
186
|
-
- When to Use includes both positive and negative conditions
|
|
187
|
-
- At least one concrete example demonstrates the full process
|
|
188
|
-
- Rigid skills include Gates and Escalation sections with specific conditions and consequences
|
|
189
|
-
- The skill can be loaded and run with `harness skill run <name>`
|
|
190
|
-
|
|
191
|
-
## Examples
|
|
192
|
-
|
|
193
|
-
### Example: Creating a Flexible Skill for Database Migration Review
|
|
194
|
-
|
|
195
|
-
**DEFINE:**
|
|
196
|
-
|
|
197
|
-
```
|
|
198
|
-
Process: The team reviews database migrations before applying them.
|
|
199
|
-
Scope: Review only — not creating or applying migrations.
|
|
200
|
-
Triggers: manual (invoked when a migration PR is opened).
|
|
201
|
-
Tools: Read, Glob, Grep, Bash.
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
**CHOOSE TYPE:** Flexible — the review steps can vary based on migration complexity. Some migrations need data impact analysis, others do not.
|
|
205
|
-
|
|
206
|
-
**WRITE skill.yaml:**
|
|
207
|
-
|
|
208
|
-
```yaml
|
|
209
|
-
name: review-db-migration
|
|
210
|
-
version: '1.0.0'
|
|
211
|
-
description: Review database migration files for safety and correctness
|
|
212
|
-
triggers:
|
|
213
|
-
- manual
|
|
214
|
-
platforms:
|
|
215
|
-
- claude-code
|
|
216
|
-
tools:
|
|
217
|
-
- Read
|
|
218
|
-
- Glob
|
|
219
|
-
- Grep
|
|
220
|
-
- Bash
|
|
221
|
-
cli:
|
|
222
|
-
command: harness skill run review-db-migration
|
|
223
|
-
args:
|
|
224
|
-
- name: migration-file
|
|
225
|
-
description: Path to the migration file to review
|
|
226
|
-
required: true
|
|
227
|
-
mcp:
|
|
228
|
-
tool: run_skill
|
|
229
|
-
input:
|
|
230
|
-
skill: review-db-migration
|
|
231
|
-
type: flexible
|
|
232
|
-
state:
|
|
233
|
-
persistent: false
|
|
234
|
-
files: []
|
|
235
|
-
depends_on: []
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
**WRITE SKILL.md:**
|
|
239
|
-
|
|
240
|
-
```markdown
|
|
241
|
-
# Review Database Migration
|
|
242
|
-
|
|
243
|
-
> Review database migration files for safety, correctness, and
|
|
244
|
-
> reversibility before they are applied to any environment.
|
|
245
|
-
|
|
246
|
-
## When to Use
|
|
247
|
-
|
|
248
|
-
- When a new migration file has been created and needs review
|
|
249
|
-
- When a migration PR is opened
|
|
250
|
-
- NOT when writing migrations (write first, then review)
|
|
251
|
-
- NOT when applying migrations to environments (that is a deployment concern)
|
|
252
|
-
|
|
253
|
-
## Process
|
|
254
|
-
|
|
255
|
-
### Phase 1: ANALYZE — Understand the Migration
|
|
256
|
-
|
|
257
|
-
1. Read the migration file completely...
|
|
258
|
-
[... full process content ...]
|
|
259
|
-
|
|
260
|
-
## Harness Integration
|
|
261
|
-
|
|
262
|
-
- `harness validate` — Verify project health after migration review
|
|
263
|
-
[... etc ...]
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
**VALIDATE:**
|
|
267
|
-
|
|
268
|
-
```bash
|
|
269
|
-
harness skill validate review-db-migration # Pass
|
|
270
|
-
harness skill run review-db-migration # Loads correctly
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
### Example: Creating a Rigid Skill for Release Deployment
|
|
274
|
-
|
|
275
|
-
**DEFINE:**
|
|
276
|
-
|
|
277
|
-
```
|
|
278
|
-
Process: Deploy a release to production. Strict ordering — cannot skip steps.
|
|
279
|
-
Triggers: manual.
|
|
280
|
-
Tools: Bash, Read, Glob.
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
**CHOOSE TYPE:** Rigid — skipping the smoke test or rollback verification step could cause production outages. Mandatory checkpoints for human approval before each environment promotion.
|
|
284
|
-
|
|
285
|
-
**WRITE SKILL.md (key rigid sections):**
|
|
286
|
-
|
|
287
|
-
```markdown
|
|
288
|
-
## Gates
|
|
289
|
-
|
|
290
|
-
- **Tests must pass before build.** If the test suite fails, do not
|
|
291
|
-
proceed to build. Fix the tests first.
|
|
292
|
-
- **Staging must be verified before production.** If staging smoke tests
|
|
293
|
-
fail, do not promote to production. Roll back staging and investigate.
|
|
294
|
-
- **Human approval required at each promotion.** Use [checkpoint:human-verify]
|
|
295
|
-
before promoting from staging to production. No auto-promotion.
|
|
296
|
-
|
|
297
|
-
## Escalation
|
|
298
|
-
|
|
299
|
-
- **When staging smoke tests fail on a test that passed locally:**
|
|
300
|
-
Report: "Smoke test [name] fails in staging but passes locally.
|
|
301
|
-
Likely cause: environment-specific configuration or data difference.
|
|
302
|
-
Need to investigate before proceeding."
|
|
303
|
-
- **When rollback verification fails:** This is critical. Report immediately:
|
|
304
|
-
"Rollback to version [X] failed. Current state: [description].
|
|
305
|
-
Manual intervention required."
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
--- skill.yaml (agents/skills/claude-code/harness-skill-authoring/skill.yaml) ---
|
|
310
|
-
name: harness-skill-authoring
|
|
311
|
-
version: "1.0.0"
|
|
312
|
-
description: Create and maintain harness skills following the rich skill format
|
|
313
|
-
cognitive_mode: constructive-architect
|
|
314
|
-
triggers:
|
|
315
|
-
- manual
|
|
316
|
-
platforms:
|
|
317
|
-
- claude-code
|
|
318
|
-
- gemini-cli
|
|
319
|
-
tools:
|
|
320
|
-
- Bash
|
|
321
|
-
- Read
|
|
322
|
-
- Write
|
|
323
|
-
- Edit
|
|
324
|
-
- Glob
|
|
325
|
-
- Grep
|
|
326
|
-
cli:
|
|
327
|
-
command: harness skill run harness-skill-authoring
|
|
328
|
-
args:
|
|
329
|
-
- name: path
|
|
330
|
-
description: Project root path
|
|
331
|
-
required: false
|
|
332
|
-
mcp:
|
|
333
|
-
tool: run_skill
|
|
334
|
-
input:
|
|
335
|
-
skill: harness-skill-authoring
|
|
336
|
-
path: string
|
|
337
|
-
type: flexible
|
|
338
|
-
state:
|
|
339
|
-
persistent: false
|
|
340
|
-
files: []
|
|
341
|
-
depends_on: []
|
|
342
|
-
|
|
343
|
-
</execution_context>
|
|
344
|
-
|
|
345
|
-
<process>
|
|
346
|
-
1. Try: invoke mcp__harness__run_skill with skill: "harness-skill-authoring"
|
|
347
|
-
2. If MCP unavailable: follow the SKILL.md workflow provided above directly
|
|
348
|
-
3. Pass through any arguments provided by the user
|
|
349
|
-
</process>
|
|
350
|
-
"""
|