packages/opencode-hive/skills/agents-md-mastery/SKILL.md
Use when bootstrapping, updating, or reviewing AGENTS.md — teaches what makes effective agent memory, how to structure sections, signal vs noise filtering, and when to prune stale entries
npx skillsauth add tctinh/agent-hive agents-md-masteryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
AGENTS.md is pseudo-memory loaded at session start. Every line shapes agent behavior for the entire session. Quality beats quantity. Write for agents, not humans.
Unlike code comments or READMEs, AGENTS.md entries persist across all agent sessions. A bad entry misleads agents hundreds of times. A missing entry causes the same mistake repeatedly.
Core principle: Optimize for agent comprehension and behavioral change, not human readability.
EVERY ENTRY MUST CHANGE AGENT BEHAVIOR
If an entry doesn't:
...then it doesn't belong in AGENTS.md.
Test: Would a fresh agent session make a mistake without this entry? If no → noise.
| Trigger | Action |
|---------|--------|
| New project bootstrap | Write initial AGENTS.md with build/test/style basics |
| Feature completion | Sync new learnings via hive_agents_md tool |
| Periodic review | Audit for stale/redundant entries (quarterly) |
| Quality issues | Agent repeating mistakes? Check if AGENTS.md has the fix |
✅ Project-specific conventions:
/lib/auth — never create auth elsewhere"bun test not npm test (we don't use npm)"✅ Non-obvious patterns:
.js extension for local imports (ESM requirement)"node_modules — run bun install in each"dockerSandboxService.ts, NOT types.ts"✅ Gotchas that break builds:
ensureDirSync — doesn't exist. Use ensureDir (sync despite name)"../utils/paths.js not ./paths (ESM strict)"❌ Agent already knows:
❌ Irrelevant metadata:
❌ Describes what code does:
Signal: Changes how agent acts
Noise: Documents what agent observes
Agents read AGENTS.md top-to-bottom once at session start. Put high-value info first:
# Project Name
## Build & Test Commands
# ← Agents need this IMMEDIATELY
bun run build
bun run test
bun run release:check
## Code Style
# ← Prevents syntax/import errors
- Semicolons: Yes
- Quotes: Single
- Imports: Use `.js` extension
## Architecture
# ← Key directories, where things live
packages/
├── hive-core/ # Shared logic
├── opencode-hive/ # Plugin
└── vscode-hive/ # Extension
## Important Patterns
# ← How to do common tasks correctly
Use `readText` from paths.ts, not fs.readFileSync
## Gotchas & Anti-Patterns
# ← Things that break or mislead
NEVER use `ensureDirSync` — doesn't exist
Keep total under 500 lines. Beyond that, agents lose focus and miss critical entries.
After completing a feature, sync learnings to AGENTS.md:
Trigger sync:
hive_agents_md({ action: 'sync', feature: 'feature-name' })
Review each proposal:
Accept signal, reject noise:
.js extension for imports" → Prevents build failuresApply approved changes:
hive_agents_md({ action: 'apply' })
Warning: Don't auto-approve all proposals. One bad entry pollutes all future sessions.
Remove entries when they become:
Outdated:
Redundant:
Too generic:
Describing code:
TaskService class.hive/.worktrees/" → Observable from filesystemProven unnecessary:
| Warning Sign | Why It's Bad | Fix | |-------------|-------------|-----| | AGENTS.md > 800 lines | Agents lose focus, miss critical info | Prune aggressively | | Describes what code does | Agent can read code | Remove descriptions | | Missing build/test commands | First thing agents need | Add at top | | No gotchas section | Agents repeat past mistakes | Document failure modes | | Generic best practices | Doesn't change behavior | Remove or make specific | | Outdated patterns | Misleads agents | Prune during sync |
| Anti-Pattern | Better Approach | |-------------|----------------| | "Document everything" | Document only what changes behavior | | "Keep for historical record" | Version control is history | | "Might be useful someday" | Add when proven necessary | | "Explains the system" | Agents read code for that | | "Comprehensive reference" | AGENTS.md is a filter, not docs |
Build Commands (High value, agents need immediately):
## Build & Test Commands
bun run build # Build all packages
bun run test # Run all tests
bun run release:check # Full CI check
Project-Specific Convention (Prevents mistakes):
## Code Style
- Imports: Use `.js` extension for local imports (ESM requirement)
- Paths: Import from `../utils/paths.js` never `./paths`
Non-Obvious Gotcha (Prevents build failure):
## Important Patterns
Use `ensureDir` from paths.ts — sync despite name
NEVER use `ensureDirSync` (doesn't exist)
Generic advice (agent already knows):
## Best Practices
- Use meaningful variable names
- Write unit tests
- Follow DRY principle
Describes code (agent can read it):
## Architecture
The FeatureService class manages features. It has methods
for create, read, update, and delete operations.
Irrelevant metadata:
## Project History
Created in January 2024 by the platform team.
Originally built for internal use.
Before finalizing AGENTS.md updates:
AGENTS.md is behavioral memory, not documentation:
Quality > quantity. Every line counts.
development
Use when you have a spec or requirements for a multi-step task, before touching code
testing
Use when independently verifying implementation claims, post-merge review, or when a reviewer needs to falsify success assertions with command-and-output evidence
data-ai
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
development
Use when implementing any feature or bugfix, before writing implementation code