agentleFS
stephen-tataristephen-tatari/claude-skills/init-ai-docs/SKILL.md

init-ai-docs

Skill0 starsChanged 10 months agoMITView on GitHub

Bootstrap ai_docs/ directory structure for decision records. Creates plans/, research/, handoffs/, and templates/ directories with index.md. Idempotent - safe to run multiple times. Use before creating plans, research, or handoffs.

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. About 0 are common, 14 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before creating your first plan, research note, or handoff

    line 20
  2. Very specific:

    When /create-plan, /create-research, or /create-handoff is invoked (they call this automatically)

    line 21
  3. Distinctive:

    Read the project's AGENTS.md (or CLAUDE.md) to determine the mode:

    line 37
  4. Very specific:

    Read $REPO_ROOT/AGENTS.md (or CLAUDE.md)

    line 39
  5. Distinctive:

    If it references a central repo for plans/research → central mode

    line 41
  6. Very specific:

    If it references local ai_docs/ or explicitly describes local mode → local mode

    line 42
  7. Distinctive:

    If no "Decision Records" section exists → ask the user:

    line 43
  8. Distinctive:

    Use the answer for this run's directory creation.

    line 48
  9. Distinctive:

    After creating the local handoffs directory, verify the central repo:

    line 66
  10. Distinctive:

    Check if the path exists

    line 69
  11. Very specific:

    If it exists, check for expected structure: plans/, research/, templates/, index.md

    line 70
  12. Distinctive:

    If the path is missing or the structure is incomplete:

    line 71
  13. Very specific:

    Check if ai_docs/handoffs/ is already gitignored.

    line 78
  14. Distinctive:

    Only create if it doesn't exist.

    line 89
  15. Distinctive:

    Only create templates that don't already exist.

    line 143
  16. Distinctive:

    After creating the structure, offer to write the Decision Records section into the project's AGENTS.md.

    line 386
  17. Distinctive:

    Only creates files if they don't exist (check with Read first)

    line 427
  18. Distinctive:

    Never overwrites existing content

    line 428
  19. Distinctive:

    After completion, inform the user:

    line 432

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Initialize AI Docs Directory

Bootstrap the ai_docs/ directory structure for decision records following the Decision Records with AI Assistance convention.

When to Use

  • Starting a new project that will use decision records
  • Before creating your first plan, research note, or handoff
  • When /create-plan, /create-research, or /create-handoff is invoked (they call this automatically)

Process

Step 1: Detect Repository Root

# Always use current repo root (works in both worktree and main repo)
REPO_ROOT=$(git rev-parse --show-toplevel)
AI_DOCS="$REPO_ROOT/ai_docs"

Note: In worktrees, ai_docs/ is created in the worktree directory. Documents committed there will merge to main with your branch.

Step 2: Detect Mode and Create Directory Structure

Read the project's AGENTS.md (or CLAUDE.md) to determine the mode:

  1. Read $REPO_ROOT/AGENTS.md (or CLAUDE.md)
  2. Find the "Decision Records" section
  3. If it references a central repo for plans/research → central mode
  4. If it references local ai_docs/ or explicitly describes local mode → local mode
  5. If no "Decision Records" section exists → ask the user:

    "No Decision Records configuration found in AGENTS.md. Which mode should we use?"

    • Local: Plans and research stored in this repo under ai_docs/
    • Central: Plans and research stored in a separate shared repo Use the answer for this run's directory creation.

Local mode (plans/research stored in this repo):

mkdir -p "$AI_DOCS/plans"
mkdir -p "$AI_DOCS/research"
mkdir -p "$AI_DOCS/handoffs"
mkdir -p "$AI_DOCS/templates"

Central mode (plans/research in a separate repo):

# Only create handoffs locally — plans/research live in the central repo
mkdir -p "$AI_DOCS/handoffs"

After creating the local handoffs directory, verify the central repo:

  1. Extract the central repo path from AGENTS.md (e.g., ../<ai-docs-repo>/)
  2. Check if the path exists
  3. If it exists, check for expected structure: plans/, research/, templates/, index.md
  4. If the path is missing or the structure is incomplete:
    • Warn user: "Central repo at <path> appears uninitialized or incomplete"
    • Suggest: "Run /init-central-docs in that repo to set it up"
  5. Proceed with local setup regardless (handoffs are always local)

Step 3: Suggest .gitignore for Handoffs

Check if ai_docs/handoffs/ is already gitignored. If not, suggest adding:

# AI session handoffs — ephemeral by default
ai_docs/handoffs/

This keeps handoffs local by default. Users can force-add specific handoffs with git add -f when they want to preserve them.

Step 4: Create index.md (if missing)

Only create if it doesn't exist. Ask the user for the project name first.

Template for index.md:

---
schema_version: 1
date: [YYYY-MM-DD]
type: index
status: active
topic: "[Project Name] Decision Records Index"
author: [git-user]              # Human owner (run: git config user.name)
ai_assisted: true
ai_model:                                # optional: which model
---

# Project: [Project Name]

## Overview

[2-3 sentence project description. What problem does it solve? Who uses it?]

## Key Terminology

| Term | Definition |
|------|------------|
| [Domain term] | [Clear definition] |

## Architecture

[Brief description of system structure]

## Active Decisions

<!-- Add links to active research/ADRs here -->
<!-- Example: @ai_docs/research/YYYY-MM-DD-decision-name.md - One-line summary -->

## Current Plans

<!-- Add links to active plans here -->
<!-- Example: @ai_docs/plans/YYYY-MM-DD-feature-name.md - Status: planning|in-progress|blocked -->

## Conventions

- [Key coding convention or pattern]
- [Testing approach]

## Out of Scope

- [What this project explicitly doesn't handle]

Step 5: Create Template Files (if missing)

Only create templates that don't already exist.

<!-- Keep in sync: templates also appear in init-ai-docs, init-central-docs, and create-*/SKILL.md -->

templates/plan.md:

---
schema_version: 1
date: [YYYY-MM-DD]
type: plan
status: draft
topic: "[Feature Name] Implementation Plan"

# Accountability
author: [git-user]              # Human owner (run: git config user.name)
ai_assisted: true
ai_model:                                # optional: which model

# Linking
related_prs: []
related_issue:
superseded_by:                           # Link to replacement doc if superseded

# Project
project:                                 # Logical project/service name
repo:                                    # GitHub org/repo
# repos: []                             # Uncomment for cross-repo docs

# Git Context
git_commit: [short-sha]
branch: [branch name]
repository: [repo name]

# Classification
tags: []
data_sensitivity: internal
---

# Plan: [Feature Name]

## Overview

[1-2 paragraph summary of what this plan achieves]

## Assumptions

- [Assumption 1]
- [Assumption 2]

## Constraints

- [Constraint 1]
- [Constraint 2]

## Alternatives Considered

### Option A: [Name]

**Pros:** [benefits]
**Cons:** [drawbacks]

### Option B: [Name]

**Pros:** [benefits]
**Cons:** [drawbacks]

**Decision:** [Which option and why]

## Implementation Phases

### Phase 1: [Name]

**Goal:** [What this phase achieves]

**Tasks:**

- [ ] Task 1
- [ ] Task 2

**Success Criteria:**

- [Automated] `command to verify`
- [Manual] Description of manual check

### Phase 2: [Name]

...

## Verification

**Automated checks:**

```bash
# Commands to verify implementation
```

**Manual verification:**

- [ ] Check 1
- [ ] Check 2
<!-- Keep in sync: templates also appear in init-ai-docs, init-central-docs, and create-*/SKILL.md -->

templates/research.md:

---
schema_version: 1
date: [YYYY-MM-DD]
type: research
status: draft
topic: "[Topic] Research"

# Accountability
author: [git-user]              # Human owner (run: git config user.name)
ai_assisted: true
ai_model:                                # optional: which model

# Linking
related_prs: []
related_issue:
superseded_by:                           # Link to replacement doc if superseded

# Project
project:                                 # Logical project/service name
repo:                                    # GitHub org/repo
# repos: []                             # Uncomment for cross-repo docs

# Git Context
git_commit: [short-sha]
branch: [branch name]
repository: [repo name]

# Classification
tags: []
data_sensitivity: internal
---

# Research: [Topic]

## Context

[What prompted this research? What question are we trying to answer?]

## Findings

### [Finding 1]

[Details with links to sources]

### [Finding 2]

[Details with links to sources]

## Alternatives Considered

| Option | Pros | Cons |
|--------|------|------|
| [Option A] | [benefits] | [drawbacks] |
| [Option B] | [benefits] | [drawbacks] |

## Decision

[If this is an ADR: What was decided and why?]
[If exploratory: What are the key takeaways?]

## Consequences

[What are the implications of this decision/finding?]

## Open Questions

- [Question 1]
- [Question 2]

## Sources

- [Link to source 1]
- [Link to source 2]
<!-- Keep in sync: templates also appear in init-ai-docs, init-central-docs, and create-*/SKILL.md -->

templates/handoff.md:

---
schema_version: 1
date: [ISO datetime with timezone]
type: handoff
status: active
topic: "[Feature/Task Name] Implementation"

# Accountability
author: [git-user]              # Human owner (run: git config user.name)
ai_assisted: true
ai_model:                                # optional: which model

# Git context
git_commit: [short hash]
branch: [branch name]
repository: [repo name]

# Classification
tags: []
---

# Handoff: [Brief Description]

## Task(s)

[Task descriptions with status: completed, in progress, planned.
If working from a plan, call out current phase.
Reference plan/research docs with @ai_docs/ prefix.]

## Critical References

[2-3 most important file paths - specs, designs, decisions.
Leave blank if none.]

## Recent Changes

[Recent codebase changes in file:line syntax]

## Learnings

[Important discoveries - patterns, bug root causes, key info.
Include explicit file paths.]

## Artifacts

[Exhaustive list of files produced/updated as paths or file:line refs]

## Action Items & Next Steps

[Prioritized list for next session to accomplish]

## Other Notes

[Additional context - relevant codebase sections, docs, etc.]

Step 6: Write AGENTS.md Integration

After creating the structure, offer to write the Decision Records section into the project's AGENTS.md.

Based on the mode detected (or chosen) in Step 2, present the appropriate section and ask the user: "Would you like me to add the Decision Records section to AGENTS.md?"

If user accepts, use Edit to append the appropriate section to AGENTS.md:

Option A — Central repo (when plans/research are centralized):

## Decision Records

Plans and research for this project are centralized at:
**Repository:** ../<ai-docs-repo>/

Find this project's docs:
rg -l "repo: org/<this-repo>" ../<ai-docs-repo>/plans/

### Handoffs (Local)
Session handoffs live in `ai_docs/handoffs/` (gitignored by default).

Option B — Local (when plans/research are in this repo):

## Decision Records

Before implementing significant changes, check `ai_docs/` for existing context:
- **Plans** (`ai_docs/plans/`): Active implementation plans
- **Research** (`ai_docs/research/`): Technical investigations and ADRs
- **Handoffs** (`ai_docs/handoffs/`): Session continuity notes (gitignored by default)

Start at `ai_docs/index.md` for project overview.

If user declines, print the section as a suggestion they can add manually later.

Idempotency

This skill is safe to run multiple times:

  • Uses mkdir -p which succeeds if directory exists
  • Only creates files if they don't exist (check with Read first)
  • Never overwrites existing content

Response

After completion, inform the user:

Local mode:

ai_docs/ structure initialized at: $AI_DOCS

Created:
- ai_docs/index.md (edit to add project details)
- ai_docs/plans/
- ai_docs/research/
- ai_docs/handoffs/ (gitignored by default)
- ai_docs/templates/{plan,research,handoff}.md

Consider adding the Decision Records snippet to your AGENTS.md.

Central mode:

ai_docs/ structure initialized at: $AI_DOCS

Created:
- ai_docs/handoffs/ (gitignored by default)

Plans and research are managed in the central repo.
Consider adding the Decision Records snippet to your AGENTS.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.