About ns-harness-agents-md
ns-harness-agents-md is a skill for creating or refreshing AGENTS.md and CLAUDE.md for coding agents. It uses repository reconnaissance to document installed skills, project paths, and workflows while keeping the entry documents concise and evidence-based.
Key features
- 01Generates or refreshes AGENTS.md
- 02Writes a fixed-template CLAUDE.md
- 03Detects installed skills and project paths
- 04Routes agents to relevant rules and workflows
- 05Preserves stable project-specific notes
Use cases
- 01Creating agent entry documents after harness setup
- 02Updating guidance for a brownfield repository
- 03Refreshing skill and workflow references after project changes
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ nextstage-brasil/ skills --skill ns-harness-agents-mdAfter installing, type/ns-harness-agents-mdin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
evals/evals.jsonreferences/agents-md.template.mdreconnaissance-checklist.mdDetails
From the project READMEAgents.md Generator
Produce the project entry document for coding agents: {product_root}/AGENTS.md tailored to what is actually installed and detected in the repo — not the generic harness scaffold template.
Then write {product_root}/CLAUDE.md with the fixed Rules boot template (see Step 5).
Design principles
- Evidence-based — list only skills, paths, and workflows that exist in the project. Mark
inferredwhen guessing. - Entry pointer, not constitution — stack, layout, and constraints belong in
architecture-rules.md(ns-harness-architecture-rules).AGENTS.mdroutes agents to the right files and skills. - No harness template copy-paste — do not dump
packages/harness/templates/AGENTS.mdinto the project. Usereferences/agents-md.template.mdas a skeleton and fill from reconnaissance. - Lean — target ~95–110 lines (hard max 130). Link to
docs/context/and harness references instead of inlining. - Agent-first — saved file is for agents, not humans. Pre-save compress via
../ns-harness/references/agent-artifact-compress.md. - Refresh-safe — on update, preserve stable hand-edited sections (language exceptions, GitLab server name, team conventions) unless recon proves them wrong.
Harness discovery
See ../ns-harness/references/harness-discovery.md and ../ns-harness/references/rules-sync.md.
| Output | Path |
|---|---|
| Project agents entry | {product_root}/AGENTS.md |
| Claude Code pointer | {product_root}/CLAUDE.md |
Supporting skills (read-only helpers)
| Skill | Use during recon |
|---|---|
ns-harness-architecture-rules | Check if constitution exists or is still stub; link, do not duplicate |
ns-harness-bootstrap-brownfield | Link to brownfield-map.md when present |
ns-harness-codebase-reverse-spec | Link to system-reverse-spec.md + .agent.md when present |
When to use
| Trigger | Action |
|---|---|
After harness init (CLI already ran agents-md) | Refine with project context — do not duplicate CLI baseline |
| Brownfield / monorepo / team conventions in README | Generate or refresh with evidence |
User hand-edited AGENTS.md and wants AI merge | Refresh preserving custom sections |
| User only needs skill list from disk | Use npx @nextstage-brasil/harness agents-md instead — no AI |
Workflow
Step 1 — Anchor
- Resolve
{product_root}(repo root or monorepo product folder). - Resolve
{harness_root}={product_root}/.nextstage-harness/when present. - Determine create vs refresh; read existing
AGENTS.mdif present. - Note whether
agents.local.mdexists at{product_root}(case-insensitive filename) — include the local-overrides rule in output; do not copy its contents intoAGENTS.md.
Step 2 — Reconnaissance
Follow references/reconnaissance-checklist.md. Read-only on application source.
Minimum:
- List
.agents/skills/(installed skill directory names). - Detect harness paths (
.nextstage-harness/,docs/, legacy.cursor/rules/). - Skim
README.mdfor project name and summary. - Note brownfield/context artifacts under
docs/context/.
Checkpoint (recommended): Present detected skills and proposed SDD chain; confirm before writing. Skip only on explicit autonomous run.
Step 3 — Draft AGENTS.md
Use references/agents-md.template.md as skeleton.
Writing rules:
- First action — mandatory section: read
AGENTS.md, thenagents.local.mdwhen present (case-insensitive), then note GitLab MCP server from project notes. - How to start — mandatory table: Planning / Implementation / Ad-hoc with skill entry points.
- Implementation routing — mandatory priority table (1–5) from
code-skill-routing.md; link to installedns-harnessfor full handoffs. - Hard stops / FORBIDDEN — mandatory section: no invented personas, no skip architecture-rules, ISSUE_URL → gitlab-issue skill, no speculative version folders.
- Product anchor —
{product_root}=.(relative to thisAGENTS.md). Never write an absolute local path. - Local overrides — when
agents.local.mdexists (case-insensitive), agents read it afterAGENTS.md. Mark present/not present in Layout; never inline its content. - Installed skills — exact names from
.agents/skills/, grouped by role in a compact table. Build the SDD chain only from installed skills. - No persona section — skills only; no "Agent personas" / subagents.
- Layout — one compact present/absent line or tiny table: rules, skills, local, docs/context|specs|versions. No almost-obvious multi-row essay.
- No Workflows → Implementation section — routing table already covers it. Keep SDD chain + brownfield/context links only.
- Ownership + Language + Project notes — single short block (≤5 bullets): routes vs architecture-rules; language; GitLab MCP / quirks.
- Docker and testing — always keep MUST NOT compose / restart without ask. Add host vs container test evidence from recon only (e.g. Vitest on host). Include full PHPUnit block from
../ns-harness/references/docker-and-testing.mdonly when PHP/PHPUnit is evidenced; otherwise omit PHPUnit subsection. - Preserve
<!-- harness-sync-managed: ... -->if present. - Do not inline architecture rules — one pointer line.
- English only in
AGENTS.md.
Pre-save (mandatory): apply ../ns-harness/references/agent-artifact-compress.md (caveman ultra). Target ~95–110 lines; hard max 130. Write only the compressed file.
Step 4 — Write AGENTS.md
- Write
{product_root}/AGENTS.md(post-compress). - Do not modify application source unless explicitly asked.
- If
architecture-rules.mdis still the harness stub, add a note to runns-harness-architecture-rulesnext.
Step 5 — Write CLAUDE.md
Write {product_root}/CLAUDE.md with exactly:
# Rules
CRITICAL — NO EXCEPTIONS.
Before any work: read `AGENTS.md` full → load every file it requires → follow its flow.
Must load:
- `AGENTS.local.md` (every session / every turn)
- all `alwaysApply: true` rules (`.nextstage-harness/rules/`)
- any NON-NEGOTIABLE / FIRST ACTION file for the task
No skip. No defer. No memory-only. Missing file → stop, ask human.
Then skills / subagents / task as AGENTS.md says.
## Subagents
`@.claude/agents` — use them; model optional per agent.
No other content. If the file had extra content, replace entirely unless the user asked to preserve something specific.
Step 6 — Report
Brief bullets (3–5): product root, skills detected, recommended next skill (ns-harness-architecture-rules if constitution missing), whether create or refresh.
Refresh mode
When updating existing AGENTS.md:
- Preserve Project-specific notes, language policy, and GitLab/MCP names if still accurate.
- Replace installed-skills, layout, and workflow sections from current evidence.
- Re-write
CLAUDE.mdto the Step 5 template if it drifted.
Quality bar (self-check before save)
-
agent-artifact-compress.mdapplied (caveman ultra) - First action section present (AGENTS.md → agents.local.md → GitLab MCP server)
- How to start table present (Planning / Implementation / Ad-hoc)
- Implementation routing table present (priority 1–5)
- Hard stops / FORBIDDEN section present
- Ownership/language/notes collapsed into one short block
- No separate "Workflows → Implementation" echo of the routing table
- Local overrides rule present (
agents.local.md, case-insensitive) - Not a verbatim copy of harness
templates/AGENTS.md - Every listed skill exists under
.agents/skills/ - Skills are grouped by role (not a flat dump of all names)
- No "Agent personas" / subagents section
-
{product_root}is relative (.or a monorepo-relative path — never an absolute machine path) - Docker MUST NOT present; PHPUnit only if PHP evidenced
- SDD chain uses only installed skills
-
CLAUDE.mdmatches Step 5 (Rules boot + AGENTS.md +.claude/agents) — no compress - No stack/module deep-dive (belongs in
architecture-rules.md) - Line count ≤ 130 (ideally 95–110)
Related skills
ns-harness-architecture-rules— technical constitution (run after or in parallel)ns-harness-bootstrap-brownfield— brownfield map for SDD planningns-harness-codebase-reverse-spec— business behavior specns-harness— artifact paths and gates