| name | harness-engineering |
| description | Apply Harness Engineering methodology to design agent-first development environments โ build CLAUDE.md maps, progressive documentation, mechanical enforcement, golden principles, and agent legibility into any project. |
Harness Engineering
Harness Engineering is the discipline of designing environments, feedback loops, and control systems that enable AI coding agents (Codex, Claude Code, Cursor, etc.) to reliably build and maintain complex software.
Core philosophy: Humans steer. Agents execute.
The human engineer's primary job is no longer to write code, but to design environments, specify intent, and build feedback loops that allow agents to do reliable work.
What this skill helps with
This skill helps you transform any project into an agent-first codebase by applying the principles from OpenAI's Harness Engineering methodology:
- Audit your current project for agent-readiness
- Generate an
CLAUDE.md that acts as a map, not a manual
- Structure progressive documentation (
docs/ knowledge base)
- Design architectural constraints and mechanical enforcement (linters, structural tests)
- Define golden principles for your codebase
- Build agent-to-agent review loops
- Plan garbage collection workflows for continuous code quality
- Create execution plan templates for complex work
- Optimize your project for agent legibility
Core Principles (Verified)
These are the verified principles derived from the OpenAI Harness Engineering article:
P1: Context is a Scarce Resource
A giant instruction file crowds out the task, the code, and the relevant docs. Agents either miss key constraints or optimize for the wrong ones.
Application: Keep CLAUDE.md under ~100 lines. Use it as a table of contents pointing to deeper sources of truth.
P2: Too Much Guidance Becomes Non-Guidance
When everything is "important," nothing is. Agents end up pattern-matching locally instead of navigating intentionally.
Application: Prioritize constraints. Mark only the top 3-5 rules as critical. Everything else goes in supporting docs.
P3: Documentation Rots Instantly
A monolithic manual turns into a graveyard of stale rules. Agents can't tell what's still true, humans stop maintaining it.
Application: Split knowledge into versioned, owned, cross-linked documents. Validate freshness mechanically with CI jobs or recurring agent tasks.
P4: Progressive Disclosure
Agents start with a small, stable entry point and are taught where to look next, rather than being overwhelmed up front.
Application: CLAUDE.md โ docs/architecture.md โ domain-specific docs โ inline code comments.
P5: Enforce Invariants, Not Implementations
Specify what must be true, not how to write the code. Let agents ship fast without undermining the foundation.
Application: Custom linters that check layering rules, naming conventions, file size limits, logging format โ not code style preferences.
P6: Repository-Local Knowledge
Anything an agent can't access in-context effectively doesn't exist. Knowledge in Google Docs, Slack threads, or people's heads is invisible to the system.
Application: If a decision was made in a discussion, it must be captured in the repo as a document or code comment.
P7: Boring Technology Wins
Technologies described as "boring" tend to be easier for agents to model due to composability, API stability, and representation in the training set.
Application: Prefer stable, well-documented libraries. In some cases, reimplement subsets of functionality rather than working around opaque upstream behavior.
P8: Garbage Collection for Code
Technical debt is like a high-interest loan: pay it down continuously in small increments rather than letting it compound.
Application: Schedule recurring agent tasks that scan for deviations, update quality grades, and open targeted refactoring PRs.
P9: Agent Legibility First
Optimize the codebase for the agent's ability to reason about it, not just for human readability.
Application: Make the app bootable per worktree. Wire observability (logs, metrics, traces) into the agent runtime. Expose DOM snapshots for UI validation.
P10: Non-Blocking Workflows
In a system where agent throughput far exceeds human attention, corrections are cheap and waiting is expensive.
Application: Minimal blocking merge gates. Short-lived PRs. Flakes addressed with follow-up runs rather than blocking progress.
Operating Rules
- Never generate a monolithic CLAUDE.md. Always keep it under ~100 lines and use it as a map.
- Always reference the source. When applying a principle, cite which principle (P1-P10) it derives from.
- Always validate existing state first. Before generating any artifact, audit what already exists in the project.
- Prefer mechanical enforcement over documentation. If a rule can be a linter, make it a linter. Documentation is for rules that cannot be encoded mechanically.
- Respect the depth-first approach. Break larger goals into smaller building blocks. Enable the agent to construct those blocks before tackling more complex tasks.
- Never prescribe specific implementations. Define constraints and boundaries. Let the agent choose how to satisfy them.
- Always include verification status. Every document should track whether it's been verified against the actual codebase.
Workflow
Phase 1: Audit
When the user invokes this skill, first audit the current project:
- Check for existing
CLAUDE.md, CLAUDE.md, or similar agent instruction files
- Scan the
docs/ directory structure (if it exists)
- Identify the project type (language, framework, architecture)
- Look for existing linters, CI jobs, and structural tests
- Check for
README.md and existing documentation quality
- Identify the architectural pattern (monolith, microservices, etc.)
Phase 2: Assess
Based on the audit, assess:
- Agent-readiness score (0-10) across dimensions:
- Context management (P1, P2, P3)
- Documentation structure (P4, P6)
- Mechanical enforcement (P5)
- Agent legibility (P9)
- Workflow design (P8, P10)
- Top 3 gaps โ the most impactful improvements
- Quick wins โ changes that can be made immediately
Phase 3: Generate
Based on the assessment, generate the requested artifacts:
CLAUDE.md โ map-style entry point
docs/ structure โ progressive documentation layout
- Linter configurations โ mechanical enforcement rules
- Golden principles โ opinionated rules for the codebase
- Execution plan templates โ for complex work
- CI job configurations โ for documentation validation and quality checks
Phase 4: Validate
After generating artifacts:
- Cross-reference generated docs with actual codebase structure
- Verify all links and references are valid
- Ensure principles are internally consistent
- Generate a verification checklist
Intent Mapping
Audit my project for agent-readiness
โ Execute Phase 1 (Audit) + Phase 2 (Assess)
โ Output: Agent-readiness score with top 3 gaps and quick wins
Generate CLAUDE.md
โ Execute Phase 1 (Audit)
โ Analyze existing codebase structure
โ Generate concise CLAUDE.md (~100 lines) as table of contents
โ Include pointers to docs/, architecture, and core principles
โ Apply P1, P2, P4 (context scarcity, non-guidance, progressive disclosure)
Design documentation structure
โ Execute Phase 1 (Audit)
โ Design progressive docs/ layout
โ Create index documents with verification status
โ Apply P3, P4, P6 (freshness, progressive disclosure, repo-local knowledge)
Create golden principles
โ Analyze codebase patterns and team preferences
โ Generate opinionated, mechanical rules
โ Encode them as linters where possible
โ Apply P5, P8 (enforce invariants, garbage collection)
Set up mechanical enforcement
โ Identify architectural constraints
โ Generate custom linter rules
โ Create structural tests
โ Apply P5 (enforce invariants, not implementations)
Design agent review loops
โ Configure agent-to-agent review workflow
โ Set up PR automation
โ Apply P10 (non-blocking workflows)
Full harness setup
โ Execute all phases (Audit โ Assess โ Generate โ Validate)
โ Generate complete agent-first environment
โ Include: CLAUDE.md, docs/ structure, linters, golden principles, CI jobs
Safety Boundaries
- Never overwrite existing CLAUDE.md or CLAUDE.md without explicit user confirmation
- Never modify production code โ this skill generates scaffolding, documentation, and tooling only
- Never prescribe a specific language or framework โ adapt to what the project already uses
- Never assume the project is a greenfield โ always respect existing conventions
- Never generate more than 100 lines for CLAUDE.md โ if it's getting long, restructure into docs/
Verified Artifacts
This skill can generate the following verified artifacts:
| Artifact | Description | Key Principle |
|---|
CLAUDE.md | Agent entry point map (~100 lines) | P1, P2, P4 |
docs/architecture.md | Top-level architecture map | P4, P6 |
docs/principles.md | Golden principles and beliefs | P5, P8 |
docs/quality.md | Quality grades per domain/layer | P5, P8 |
.linters/ | Custom linter configurations | P5 |
docs/plans/ | Execution plan templates | P4, P6 |
docs/decisions/ | Architecture decision records | P6 |
| CI job configs | Documentation freshness validation | P3 |
Example Triggers
- "Audit my project for agent-readiness"
- "Generate an CLAUDE.md for my codebase"
- "Set up harness engineering for my project"
- "Create golden principles for my codebase"
- "Design progressive documentation structure"
- "Set up mechanical enforcement for architecture constraints"
- "ๅธฎๆๅฎกๆฅ้กน็ฎ็ Agent ๅฐฑ็ปชๅบฆ"
- "็ๆ CLAUDE.md ๆไปถ"
- "่ฎพ่ฎกๅๅฑๆถๆ็บฆๆ"
- "ๅปบ็ซไปฃ็ ๅๅพๅๆถๆบๅถ"
Cross-Reference
For detailed worked examples, see examples.md.