Skip to content
Back to skills

Smart Init

ASecurity

Generate, audit, or prune a minimal, high-signal root AGENTS.md (and optional scoped package AGENTS.md files) grounded in verified repository evidence. Trigger on: init, AGENTS.md, setup repo, onboard, agent instructions, project documentation for agents, audit AGENTS.md, prune AGENTS.md, bootstrap repo.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 24, 2026
ai-agentsrustgorailsgitsecuritydocumentation

Works with

  • cursor
  • cli

Security analysis

A100/100

Scanned December 5, 2026

npx -y skills add tkolleh/skills --skill smart-init --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Smart Init?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Smart Init
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tkolleh-smart-init/badge)](https://www.skillsdirectory.com/skills/tkolleh-smart-init)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: smart-init
description: "Generate, audit, or prune a minimal, high-signal root AGENTS.md (and optional scoped package AGENTS.md files) grounded in verified repository evidence. Trigger on: init, AGENTS.md, setup repo, onboard, agent instructions, project documentation for agents, audit AGENTS.md, prune AGENTS.md, bootstrap repo."
disable-model-invocation: true
license: MIT
metadata:
  audience: developers
---

Create, update, or prune this repository's canonical `AGENTS.md` file using verified repository evidence. Optimize for the **smallest set of high-signal, non-discoverable facts** that prevent costly mistakes and wasted cycles.

For the underlying 2025–2026 academic studies and institutional engineering guidance, see [references/research.md](references/research.md).

## Core Principles

1. **Single canonical file (`AGENTS.md` only):** `AGENTS.md` is the open standard stewarded by the Linux Foundation's Agentic AI Foundation and read natively by modern coding agents. Do not generate parallel tool-specific rule files—parallel formats drift and produce conflicting guidance.
2. **Less is more:** Every line in `AGENTS.md` is loaded into the model's finite attention budget on every turn. Verbose or auto-generated context files increase inference cost by 20%+ without improving task success, and instruction compliance drops as rule density rises.
3. **Non-discoverable facts only:** Do not repeat what an agent can learn in one `ls`, `rg`, or manifest read. Omit directory trees, file inventories, framework defaults, and generic engineering platitudes.
4. **Direct, affirmative wording:** Write short prescriptive rules ("Run `pnpm test --filter web` after editing `packages/web`"). Avoid vague conditional phrasing. When forbidding an action, state the safe alternative alongside it.
5. **Enforce mechanically, document judgment:** Formatting, import order, and lint rules belong in formatters, linters, hooks, and CI—not prose. Put the verification command in `AGENTS.md`, not a restatement of `.eslintrc` or `rustfmt.toml`.
6. **Progressive disclosure over preloading:** Link to existing deeper docs **contextually** ("See `docs/migrations.md` when altering DB schemas"). Never instruct agents to read a stack of docs before every edit.
7. **Evidence over speculation:** Only document commands, paths, and constraints verified directly in the repository. Never invent commands or leave `TODO` / placeholder sections in `AGENTS.md`.

## Size & Scope Budget

- **Root `AGENTS.md`:** Aim for **30–80 lines** (~10–30 distinct actionable rules). Treat **120 lines** as a hard ceiling unless the repository has genuine multi-system complexity that cannot be scoped into subdirectories. Shorter is better when a project follows standard ecosystem conventions.
- **Scoped nested `AGENTS.md`:** In monorepos or multi-stack repositories, add a nested `<subdir>/AGENTS.md` (under ~40 lines) **only** when that subtree has genuinely distinct commands, tooling, or invariants—or when the user explicitly asks to split instructions. Modern harnesses discover nested `AGENTS.md` files lazily when working in those directories, keeping root context lean.

## Modes

Determine which mode applies from the repository state and user request:

- **Generate:** No `AGENTS.md` exists at the repository root.
- **Consolidate & Migrate:** No `AGENTS.md` exists, but legacy tool-specific rule files (e.g., `.cursorrules`, `.cursor/rules`, `.github/copilot-instructions.md`, `.windsurfrules`, `.clinerules`, `.devin/guidelines.md`) exist. Extract only verified, still-accurate, non-discoverable rules into a new root `AGENTS.md` and note the legacy files in your summary so the user can decide whether to remove them.
- **Audit & Prune:** A root `AGENTS.md` already exists. Inspect every existing line against the Inclusion Test below, verify all commands and paths still exist, remove bloat/stale claims/redundant overviews, tighten wording, and preserve accurate project-specific invariants.

## The Inclusion Test

Test every candidate fact (and every existing line in Audit & Prune mode) with one question:

> *If I delete this line, will a capable coding agent waste significant time or break a non-obvious project invariant?*

If the answer is **no**, cut it.

| Keep (High-Signal, Non-Discoverable) | Cut (Discoverable, Generic, or Drift-Prone) |
|---|---|
| Exact verified commands for build, fast/focused tests, full tests, lint, typecheck, and codegen | Directory trees, file inventories, or "Repo Map" bullets for obvious folders (`src/`, `tests/`, `docs/`) |
| Non-standard flags, required env vars, working-directory requirements, or tool-version quirks | Marketing blurbs, long project histories, or prose duplicated from `README.md` |
| Runtime/cost traps (e.g., "Full integration suite takes >15 min; run targeted unit tests first") | Generic advice ("write clean code", "keep diffs small", "add tests", "ask when stuck") |
| Non-obvious architectural boundaries, external wire contracts, or generated-file rules ("Do not edit `gen/`; run `make proto`") | Style/formatting details already enforced by a formatter or linter |
| Repo-specific security, data-safety, migration, or deployment guardrails with an explicit safe path | Generic safety boilerplate ("do not commit secrets") unless tied to a repo-specific trap or path |
| Contextual pointers to existing deeper docs ("For release steps, see `docs/release.md`") | "Before every edit, read X, Y, and Z" mandates, unverified commands, or placeholder `TODO` tables |

## Workflow

### Step 1: Bounded Repository Inspection

Locate the repo root (`git rev-parse --show-toplevel`, or current working directory if not a Git repo) and read only high-signal sources of truth. Do **not** dump lockfiles or recursively crawl the entire tree.

Inspect what exists among:
- **Existing instructions & docs:** Root and nested `AGENTS.md`, `README.md`, `CONTRIBUTING.md`, `docs/` index, and legacy rule files (`.cursorrules`, `.github/copilot-instructions.md`, etc.).
- **Build & task manifests:** `package.json`, `pnpm-workspace.yaml`, `nx.json`, `turbo.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `build.sbt`, `pom.xml`, `build.gradle*`, `Makefile`, `Justfile`, `Taskfile.yml`, `mise.toml`, `.tool-versions`.
- **CI & verification truth:** `.github/workflows/*.yml`, `.gitlab-ci.yml`, `.circleci/config.yml`, pre-commit configs, linter/typechecker configs. CI workflows are often the single most accurate source of required checks, flags, and environment setup.
- **Git & PR conventions (quick check):** Recent commits (`git log -n 15 --oneline`) and `.github/pull_request_template.md` only if commit/PR conventions look non-standard.

### Step 2: Extract & Verify Commands and Constraints

- Collect only commands directly backed by package scripts, Makefile/Justfile/Taskfile targets, build tool configs, or CI workflows.
- Prefer showing **both** a fast targeted check (single test file/filter) and the full verification command when the repository supports both.
- Note any real runtime traps, required env vars, or working-directory constraints found in scripts or CI.
- If a monorepo is detected (`pnpm-workspace.yaml`, `turbo.json`, `nx.json`, `lerna.json`, `rush.json`, Cargo workspace, or `package.json` `workspaces`), capture the workspace-scoped command pattern (e.g., `pnpm --filter <pkg> test`, `cargo test -p <crate>`) and note any existing nested `AGENTS.md` files.

### Step 3: Filter Ruthlessly

Apply the Inclusion Test to every candidate bullet:
- Remove anything trivially discoverable from directory names or standard ecosystem conventions.
- Collapse multi-sentence explanations into single crisp bullets.
- Convert conditional/vague phrasing into direct prescriptive rules.
- For every prohibition ("Never edit X", "Do not rename Y"), add the safe alternative ("Regenerate X via `make codegen`", "Add a backward-compatible alias instead").
- In **Audit & Prune** mode, preserve genuinely project-specific human knowledge (domain invariants, external consumers, incident-derived gotchas) even if it cannot be inferred from config files—flag anything that looks stale against current repo paths/scripts rather than silently fabricating replacements.

### Step 4: Draft or Prune `AGENTS.md`

Order sections by priority so the highest-stakes invariants and commands appear near the top (leveraging model primacy bias). **Omit any section that has no genuine, non-obvious content.**

Reference structure (adapt headings to the repo; `AGENTS.md` has no mandatory schema):

```markdown
# AGENTS.md

<!-- Optional: 1-2 sentences ONLY if the repo's purpose or core boundary is non-obvious. -->

## Commands
<!-- Verified commands only. Include fast/targeted test invocation and slow-suite warnings. -->
- Build: `<verified command>`
- Test (single): `<verified fast/targeted command>`
- Test (full): `<verified full command>` <!-- note if slow or requires services -->
- Lint / Typecheck: `<verified command>`

## Architecture & Boundaries
<!-- Only non-obvious ownership, external contracts, or generated-code boundaries. NO directory trees. -->
- `<path/surface>`: <invariant and safe path>

## Conventions & Gotchas
<!-- Only repo-specific rules not enforced by linters/CI, plus real environment/tooling traps. -->
- <direct prescriptive rule>

## Reference Docs (Read Only When Relevant)
<!-- Contextual pointers to existing docs; omit if none exist. -->
- `<docs/path.md>` — when <specific trigger condition>
```

### Step 5: Verify Before Finishing

Before reporting completion, verify every item:

1. **Command verification:** Every command in `AGENTS.md` matches an actual script, target, tool config, or CI step in the repository. Remove any command that cannot be verified.
2. **Path & link verification:** Every file or doc path mentioned in `AGENTS.md` exists in the repository.
3. **Bloat & anti-pattern check:**
   - No directory tree / "Repo Map" dump.
   - No generic boilerplate ("write clean code", "keep diffs small", "don't commit secrets" without repo-specific detail).
   - No "read X, Y, Z before every edit" instructions.
   - No empty or `TODO` / placeholder sections.
   - No duplicated linter/formatter rules.
4. **Budget check:** Confirm line count (`wc -l AGENTS.md`) is within the 30–80 line target (or explicitly justify anything above 100 lines).
5. **Consistency check:** One canonical command per task; no contradictions between root and nested `AGENTS.md` files.

## Deliverables

1. Write or update `AGENTS.md` at the repository root (and nested `AGENTS.md` files only if warranted or explicitly requested).
2. Reply with a concise summary:
   - **Mode:** generated, consolidated, or audited/pruned (with before → after line counts when updating).
   - **Verified commands:** list the sources used to verify commands (e.g., `package.json`, `Makefile`, `.github/workflows/ci.yml`).
   - **What was cut or omitted** (especially in Audit & Prune mode) and why.
   - **Human follow-ups (if any):** call out undocumented areas where only a human knows the answer (e.g., external consumers, production rollout invariants, legacy rule files ready for deletion) instead of inserting placeholders into `AGENTS.md`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.