Agent File Engine
Skill Resources
- Activation and cross-agent notes: references/activation.md
- Use
ultrathink or the deepest available reasoning mode before deciding AGENTS.md boundaries for large or safety-critical repos.
- Reference: references/discovery-checklist.md
- Reference: references/nested-coverage-heuristics.md
- Template: templates/root-agents.md
- Template: templates/nested-agents.md
- Example: examples/coverage-plan.md
- Helper:
scripts/inventory_agent_scope.py
Task Focus for $ARGUMENTS
When this skill is invoked explicitly, treat $ARGUMENTS as the repo root or subtree that needs AGENTS.md coverage.
Purpose
Use this skill to create or update AGENTS.md files that help AI coding agents navigate a repository safely, quickly, and consistently.
The output should be specific to the target codebase. Avoid generic “best practices” prose unless it is tied directly to the repo’s structure, build system, workflows, or risk areas.
Scope Model
- A root
AGENTS.md applies to the entire repository subtree beneath it.
- A nested
AGENTS.md applies only to the subtree rooted at its directory.
- More deeply nested
AGENTS.md files override parent instructions when they conflict.
- Nested files should add local delta rules, not restate the entire parent document.
This precedence model matters. Only add nested files when a subtree genuinely needs instructions that differ from or go beyond the parent.
Workflow
Resolve the target repository.
- Use the current working directory unless
$ARGUMENTS points to another repo root or subtree.
- If the request targets a nested path, still inspect the repo root before writing a local file.
Inventory the repository before writing anything.
- Run
scripts/inventory_agent_scope.py <repo-path> first.
- Read existing
AGENTS.md files, top-level manifests, README/docs, CI config, and a representative sample of core code paths.
Build a mental model of the codebase.
- Identify the primary languages, frameworks, package managers, and test/lint/build commands.
- Identify the risk areas: auth, data access, AI integrations, performance-sensitive code, design systems, deployment paths, migrations, and background jobs.
- Identify whether the repo is a library, an app, a monorepo, or a mixed workspace.
Decide the AGENTS.md coverage plan.
- Always evaluate root coverage first.
- Add nested files only when a subtree has distinct invariants, workflows, or verification steps that would otherwise clutter the root file.
- Prefer a small number of high-signal nested files over broad recursive coverage.
Create or update the root AGENTS.md.
- The root file should explain the overall architecture, golden rules, key directories, common workflows, and minimum verification commands.
- It should also point agents to nested
AGENTS.md files when they exist.
Create or update nested AGENTS.md files only where warranted.
- Scope them tightly to the subtree.
- Make them more specific than the parent.
- Focus on local conventions, contracts, performance constraints, serialization rules, integration rules, and test commands.
Validate the result.
- Ensure every referenced path or doc exists.
- Ensure parent and child files do not contradict each other.
- Keep the files concrete: real paths, real commands, real workflows.
Root AGENTS.md Requirements
The root file should usually contain:
- A one-paragraph mental model of the repo
- Golden rules that are non-obvious and high-signal
- Key directories and why they matter
- Common agent workflows
- Verification commands
- Notes about nested
AGENTS.md files, if present
Keep it specific. “Run tests” is weak. “Run pnpm test and pnpm type-check” is useful.
Nested AGENTS.md Requirements
A nested file is justified when the subtree has at least one of these:
- Distinct serialization or API contracts
- Different build or verification commands
- Specialized architecture or domain constraints
- High-risk performance, security, or AI workflows
- Strong local patterns that agents repeatedly get wrong
Examples from your codebases:
components/blocks/* in @opensite/ui needs block-specific serialization, registry, and design-system rules.
src/services/orchestration/* in octane needs workflow-step, memory, and side-effect boundaries.
app/services/ai/* in Rails repos needs webhook, vector, and processor-specific rules.
Do not create nested files for shallow folders that add no new information.
Writing Rules
- Prefer imperative, testable guidance.
- Use real file paths and command names.
- Call out forbidden changes explicitly when they matter.
- Keep parent files broad and nested files local.
- Avoid organizational lore that cannot be verified from the repo.
- If the repo already has strong AGENTS.md files, preserve the tone and structure unless they are clearly inconsistent or stale.
Quality Bar
Before finishing, confirm:
- The root file reflects the actual repo, not a template
- Nested files exist only where they improve agent outcomes
- Commands and referenced docs exist
- The file set gives agents enough context to work without reading the whole repo every time
1---
2name: agent-file-engine
3description: >
4 Repository-specific AGENTS.md authoring and maintenance workflow. Use when
5 creating, refreshing, or expanding AGENTS.md coverage for a codebase,
6 including deciding whether nested AGENTS.md files are needed for subsystems
7 with distinct rules, workflows, or AI-sensitive constraints.
8compatibility: >
9 Requires filesystem access to the target repository; shell access is strongly
10 preferred for inventorying manifests, docs, tests, and existing AGENTS.md
11 coverage.
12metadata:
13 source: https://skillmd.com/skills/aibot88/agent-file-engine
14 opensite-category: ops
15 opensite-scope: shared
16 opensite-visibility: public
17allowed-tools: "Read Grep Glob Bash"
18---
19
20# Agent File Engine
21
22## Skill Resources
23- Activation and cross-agent notes: [references/activation.md](references/activation.md)
24- Use `ultrathink` or the deepest available reasoning mode before deciding AGENTS.md boundaries for large or safety-critical repos.
25- Reference: [references/discovery-checklist.md](references/discovery-checklist.md)
26- Reference: [references/nested-coverage-heuristics.md](references/nested-coverage-heuristics.md)
27- Template: [templates/root-agents.md](templates/root-agents.md)
28- Template: [templates/nested-agents.md](templates/nested-agents.md)
29- Example: [examples/coverage-plan.md](examples/coverage-plan.md)
30- Helper: `scripts/inventory_agent_scope.py`
31
32## Task Focus for $ARGUMENTS
33When this skill is invoked explicitly, treat `$ARGUMENTS` as the repo root or subtree that needs AGENTS.md coverage.
34
35## Purpose
36
37Use this skill to create or update AGENTS.md files that help AI coding agents navigate a repository safely, quickly, and consistently.
38
39The output should be specific to the target codebase. Avoid generic “best practices” prose unless it is tied directly to the repo’s structure, build system, workflows, or risk areas.
40
41## Scope Model
42
43- A root `AGENTS.md` applies to the entire repository subtree beneath it.
44- A nested `AGENTS.md` applies only to the subtree rooted at its directory.
45- More deeply nested `AGENTS.md` files override parent instructions when they conflict.
46- Nested files should add **local delta rules**, not restate the entire parent document.
47
48This precedence model matters. Only add nested files when a subtree genuinely needs instructions that differ from or go beyond the parent.
49
50## Workflow
51
521. Resolve the target repository.
53 - Use the current working directory unless `$ARGUMENTS` points to another repo root or subtree.
54 - If the request targets a nested path, still inspect the repo root before writing a local file.
55
562. Inventory the repository before writing anything.
57 - Run `scripts/inventory_agent_scope.py <repo-path>` first.
58 - Read existing `AGENTS.md` files, top-level manifests, README/docs, CI config, and a representative sample of core code paths.
59
603. Build a mental model of the codebase.
61 - Identify the primary languages, frameworks, package managers, and test/lint/build commands.
62 - Identify the risk areas: auth, data access, AI integrations, performance-sensitive code, design systems, deployment paths, migrations, and background jobs.
63 - Identify whether the repo is a library, an app, a monorepo, or a mixed workspace.
64
654. Decide the AGENTS.md coverage plan.
66 - Always evaluate root coverage first.
67 - Add nested files only when a subtree has distinct invariants, workflows, or verification steps that would otherwise clutter the root file.
68 - Prefer a small number of high-signal nested files over broad recursive coverage.
69
705. Create or update the root `AGENTS.md`.
71 - The root file should explain the overall architecture, golden rules, key directories, common workflows, and minimum verification commands.
72 - It should also point agents to nested `AGENTS.md` files when they exist.
73
746. Create or update nested `AGENTS.md` files only where warranted.
75 - Scope them tightly to the subtree.
76 - Make them more specific than the parent.
77 - Focus on local conventions, contracts, performance constraints, serialization rules, integration rules, and test commands.
78
797. Validate the result.
80 - Ensure every referenced path or doc exists.
81 - Ensure parent and child files do not contradict each other.
82 - Keep the files concrete: real paths, real commands, real workflows.
83
84## Root AGENTS.md Requirements
85
86The root file should usually contain:
87
88- A one-paragraph mental model of the repo
89- Golden rules that are non-obvious and high-signal
90- Key directories and why they matter
91- Common agent workflows
92- Verification commands
93- Notes about nested `AGENTS.md` files, if present
94
95Keep it specific. “Run tests” is weak. “Run `pnpm test` and `pnpm type-check`” is useful.
96
97## Nested AGENTS.md Requirements
98
99A nested file is justified when the subtree has at least one of these:
100
101- Distinct serialization or API contracts
102- Different build or verification commands
103- Specialized architecture or domain constraints
104- High-risk performance, security, or AI workflows
105- Strong local patterns that agents repeatedly get wrong
106
107Examples from your codebases:
108
109- `components/blocks/*` in `@opensite/ui` needs block-specific serialization, registry, and design-system rules.
110- `src/services/orchestration/*` in `octane` needs workflow-step, memory, and side-effect boundaries.
111- `app/services/ai/*` in Rails repos needs webhook, vector, and processor-specific rules.
112
113Do **not** create nested files for shallow folders that add no new information.
114
115## Writing Rules
116
117- Prefer imperative, testable guidance.
118- Use real file paths and command names.
119- Call out forbidden changes explicitly when they matter.
120- Keep parent files broad and nested files local.
121- Avoid organizational lore that cannot be verified from the repo.
122- If the repo already has strong AGENTS.md files, preserve the tone and structure unless they are clearly inconsistent or stale.
123
124## Quality Bar
125
126Before finishing, confirm:
127
128- The root file reflects the actual repo, not a template
129- Nested files exist only where they improve agent outcomes
130- Commands and referenced docs exist
131- The file set gives agents enough context to work without reading the whole repo every time