harness-engineering
БесплатноБез исполняемых скриптовНе проверенRepository structure methodology for maximum AI agent effectiveness. Three pillars — context engineering (repo as knowledge product), architectural…
от majesticlabs-dev★ 50 звёзд на GitHubОб этом скилле
Harness Engineering
Core Principle
The repo is the harness. Agent failures are harness failures. When an agent breaks a rule, fix the harness — not the agent.
| Pillar | What It Solves |
|---|---|
| Context Engineering | Agent hallucinations, wrong tool usage, stale docs |
| Architectural Constraints | Boundary violations, silent regressions, ambiguous failures |
| Garbage Collection | Entropy accumulation, dead code, doc drift |
When to Apply
| Situation | Action |
|---|---|
| New repo setup for AI development | Apply all three pillars from day one |
| Agent repeatedly hallucinating tools/APIs | Pillar 1: add tool declarations to AGENTS.md |
| Agent crossing module boundaries | Pillar 2: add structural test enforcing boundary |
| Agent producing code that passes CI but breaks conventions | Pillar 2: convert convention to linter rule or structural test |
| Docs drifting from implementation | Pillar 1: add CI cross-link validation |
| Codebase growing, agent quality degrading | Pillar 3: schedule GC agent for dead code and unused exports |
| Agent ignoring AGENTS.md guidance | Check: is guidance generic advice or a specific failure lesson? Rewrite as failure ledger entry |
| Post-incident on agent-generated code | Add failure to AGENTS.md, add constraint to prevent recurrence |
Pillar 1: Context Engineering
Goal: Make the repository a knowledge product that agents can consume without hallucination.
1.1 AGENTS.md as Failure Ledger
Every line in AGENTS.md should trace to a real failure, not generic best practice.
# Pattern
BAD: "Follow clean code principles"
BAD: "Use meaningful variable names"
GOOD: "Never import from packages/internal — agent imported shared/db directly on 2025-12-03, broke build"
GOOD: "Always use OrderService.create(), not Order.new — direct instantiation skips validation (incident #247)"
Failure ledger entry format:
rule: Never call PaymentGateway directly from controllers
context: Agent bypassed service layer, sent duplicate charges (2025-11-15)
fix: Use PaymentService.charge() which handles idempotency
When writing or updating AGENTS.md:
- If the rule doesn't reference a specific failure or concrete constraint → cut it
- If the rule says "should" → rewrite as "must" with consequence
- If the rule has no enforcement mechanism → pair it with a Pillar 2 constraint
1.2 Tool Declaration Mandate
Undeclared tools don't exist for agents. Explicitly list available tools, commands, and scripts.
## Available Tools
- `bin/test` — Run test suite (prefer over raw pytest/rspec)
- `bin/lint` — Run linters with auto-fix
- `bin/db-reset` — Reset dev database
- `make deploy-staging` — Deploy to staging (requires approval)
## DO NOT USE
- `rm -rf` on any directory
- Direct database queries in production
- `curl` to external APIs without going through ApiClient
If an agent uses a tool not in this list → add it (if valid) or add it to DO NOT USE (if dangerous).
1.3 Docs as System of Record
RULE: docs/ is canonical truth
ENFORCEMENT: CI validates cross-links between docs/ and source code
MECHANISM:
- Every public API must have a corresponding docs/ entry
- CI script checks: for each @api-doc tag in source → matching file in docs/
- Broken link = CI failure, not warning
Stale docs are worse than no docs — agents trust what they read.
1.4 Isolated Observability Per Task
Each agent task gets its own log context, not a shared monitoring stream.
PATTERN:
- Assign task_id to each agent invocation
- Route logs to task-specific output (file, log group, trace)
- Post-task: review task log for failures, add to AGENTS.md if new pattern
Shared monitoring hides individual agent failures in noise.
Pillar 2: Architectural Constraints
Goal: Make violations impossible or immediately visible through deterministic enforcement.
2.1 Teaching Linter Errors
Failure messages must include remediation, not just violation.
# BAD linter output
ERROR: Import violation in src/api/handler.ts
# GOOD linter output
ERROR: Import violation in src/api/handler.ts
↳ Cannot import from 'packages/db' in 'src/api/'
↳ Use 'packages/db-client' instead (facade pattern)
↳ See: docs/architecture/data-access.md
Agents read error messages literally. A teaching error message prevents the same mistake on next attempt.
2.2 Structural Tests
Enforce architectural boundaries in CI, not in documentation.
# Pseudocode structural tests
test "no cross-boundary imports":
For each FILE in src/api/**:
IMPORTS = parse_imports(FILE)
FORBIDDEN = ["packages/internal", "src/admin", "src/worker"]
assert IMPORTS intersection FORBIDDEN == empty
test "dependency direction":
LAYERS = [presentation, application, domain, infrastructure]
For each LAYER in LAYERS:
For each IMPORT in LAYER.imports:
assert IMPORT.layer_index >= LAYER.index # only import sam
Установить harness-engineering в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл harness-engineering?
Repository structure methodology for maximum AI agent effectiveness. Three pillars — context engineering (repo as knowledge product), architectural constraints (deterministic enforcement), garbage collection (active entropy fighting). Use when setting up repos for AI development, diagnosing repeated agent failures, writing AGENTS.md, or designing CI gates and structural tests.
Как установить скилл harness-engineering?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл harness-engineering запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic