/rdf:r-initfrom RDF: rfxn Development Framework
Initializes RDF governance on a repository by scanning conventions, codebase, and tooling, then generating supplementary governance files under .rdf/governance/.
Ships in RDF: rfxn Development Framework. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Governance initialization for any codebase. Scans the project, ingests
existing convention files, detects languages and tooling, and generates
supplementary governance under .rdf/governance/.
$ARGUMENTS is the target path (optional, defaults to . for the
current working directory). Can be a subdirectory for monorepo scoping.
--force — delete existing .rdf/governance/ and regenerate
from scratch. Without this flag, /rdf:r-init refuses to run when
governance already exists (directs to /rdf:r-refresh instead). A
directory holding only reference/, as rdf init scaffolds it, is
not existing governance: proceed without asking and, unless --force
is set, leave it in place.See reference/progress-tracking.md. Create all 5 tasks in ONE batch before starting.
Tasks: Ingest convention files · Scan codebase · Detect tooling ·
Generate governance · Validate accuracy
Fallback checklist (Gemini CLI, Codex):
- [ ] Ingest conventions · - [ ] Scan codebase · - [ ] Detect tooling ·
- [ ] Generate governance · - [ ] Validate
schemas/governance-index.md
in the RDF installation.git/ is present)/rdf:r-init runs 5 phases in sequence:
Output directory: .rdf/governance/ (relative to target path)
Mark task "Ingest existing convention files" as in_progress.
Scan the target directory for convention files in priority order. These files remain authoritative — they are NEVER modified or replaced.
Scan for each file in this order. Higher-priority sources override lower ones when content overlaps:
Priority 1 (curated conventions — highest signal):
- CLAUDE.md (project root and parent directories)
- AGENTS.md
- GEMINI.md
Priority 2 (project state and decisions):
- MEMORY.md
- active plan (docs/plans/*.md canonical; PLAN.md legacy fallback)
Priority 3 (Cursor conventions):
- .cursorrules
- .cursor/rules/*.md
Priority 4 (Copilot conventions):
- .github/copilot-instructions.md
Priority 5-7 are covered by Phases 2-3 (scan and tooling).
For each file found:
{category -> [source_file, section_name, line_range]}If $ARGUMENTS points to a subdirectory:
Scope: {subdir}An internal coverage map (not written to disk) that tracks:
Mark task "Ingest existing convention files" as completed.
Mark task "Scan codebase: languages, frameworks, structure" as in_progress.
Analyze the target directory to detect languages, frameworks, directory structure, build system, and test infrastructure.
Before scanning, measure the codebase to select the right strategy:
# Use git ls-files to respect .gitignore (excludes node_modules, vendor, build, etc.)
git ls-files 2>/dev/null | wc -l
| Size | Files | Strategy |
|---|---|---|
| Small | <500 | Full scan — read configs, sample source files |
| Medium | 500-5,000 | Targeted scan — configs + extension counting only |
| Large | 5,000-50,000 | Fast scan — git ls-files + extension stats, no source reads |
| Monorepo | >50,000 | Scoped scan — require --scope or auto-detect top-level services |
For all sizes, always use git ls-files (not find) to avoid
scanning build output, node_modules, vendor directories, and other
gitignored paths. If not a git repo, use find with explicit
exclusions:
find . -not -path './.git/*' -not -path '*/node_modules/*' \
-not -path '*/vendor/*' -not -path '*/.venv/*' \
-not -path '*/dist/*' -not -path '*/build/*' \
-not -path '*/target/*' -not -path '*/__pycache__/*' \
-type f
Report the file count and chosen strategy in the output.
Use git ls-files with extension counting for fast, accurate results:
git ls-files | sed 's/.*\.//' | sort | uniq -c | sort -rn | head -20
For extensionless files, check shebangs:
git ls-files | while read -r f; do
[[ "$f" == *.* ]] && continue
head -1 "$f" 2>/dev/null | grep -q '^#!' && head -1 "$f"
done | sort | uniq -c | sort -rn
Supplement with package manifests: package.json, pyproject.toml,
Cargo.toml, go.mod, Gemfile, pom.xml, build.gradle.
Record: primary language, secondary languages, percentage breakdown,
total file count, approximate total lines (git ls-files | xargs wc -l
for small/medium, wc -l on a sample for large).
Detect the project version from (first match wins):
package.json → .versionpyproject.toml → [project] version or [tool.poetry] versionCargo.toml → [package] versionVERSION or VERSION.txt fileVERSION=, __version__, APP_VERSIONgit describe --tags --abbrev=0 2>/dev/nullCheck for LICENSE, LICENSE.md, LICENSE.txt, COPYING.
Extract the license type from the first line or SPDX identifier.
Identify frameworks from dependency declarations and imports:
dependencies and devDependencies for
React, Vue, Next.js, Express, Fastify, etc.next.config.js, nuxt.config.ts, angular.json,
webpack.config.js, vite.config.tsMap the project layout:
src/, lib/, app/, pkg/, cmd/, files/tests/, test/, __tests__/, spec/docs/, doc/dist/, build/, target/, out/Detect how the project builds and runs:
Makefile — scan targets (build, test, install, clean)package.json scripts — scan script names and commandspyproject.toml [tool.poetry.scripts] or [project.scripts]Identify test infrastructure:
.bats files, tests/ directory)go test (from _test.go files)cargo test (from #[test] in source)Record: test framework(s), test directory, test file count, test runner command.
Scan for configuration files:
.eslintrc*, .prettierrc*, biome.json (JS/TS).flake8, pyproject.toml [tool.ruff], setup.cfg (Python).shellcheckrc, shellcheck directives in source (Bash).golangci.yml (Go).editorconfig (cross-language).clang-format (C/C++)An internal scan result (not written to disk) containing:
Mark task "Scan codebase: languages, frameworks, structure" as completed.
Mark task "Detect tooling and infrastructure" as in_progress.
Detect CI/CD, containers, platform targets, dependency management, and git conventions.
Scan for CI configuration:
.github/workflows/*.yml — extract job names,
test matrix (OS, language versions), deployment targets.gitlab-ci.yml — extract stages, jobs, runnersJenkinsfile — extract stages and agents.circleci/config.yml.travis.ymlRecord: CI platform(s), test matrix, deployment targets, and the actual test/lint/build commands run in CI.
Dockerfile — extract base image, exposed ports, entrypointdocker-compose.yml — extract services, volumes, networks.dockerignore — note excluded pathsDetermine target operating systems and environments:
runs-on: [ubuntu-22.04, macos-latest])if [[ "$OSTYPE" == ... ]])package-lock.json, yarn.lock, pnpm-lock.yaml,
poetry.lock, Pipfile.lock, Cargo.lock, go.sumlerna.json, pnpm-workspace.yaml,
nx.json, Turborepo (turbo.json)Analyze recent git history (last ~50 commits):
[New], [Fix], type: description)An internal tooling result (not written to disk) containing:
Mark task "Detect tooling and infrastructure" as completed.
Mark task "Generate supplementary governance" as in_progress.
Create .rdf/governance/ directory and generate governance files.
This phase applies the supplement model: reference existing coverage,
generate from scan data where gaps exist, never duplicate.
mkdir -p .rdf/governance
If .rdf/governance/ holds anything besides reference/ (from a
prior /rdf:r-init or /rdf:r-refresh):
--force: stop and direct the user to /rdf:r-refresh
(see Error Handling #4). DO NOT modify existing files.--force: delete the existing .rdf/governance/
directory entirely, then proceed with fresh generation. Log the
deletion: Removed existing governance ({N} files).For each governance file, apply this decision tree:
Full coverage in existing .md files — governance file contains ONLY cross-references:
## Coding Style
See CLAUDE.md § "Shell Standards" (lines 45-92)
No coverage in existing .md files — governance file generates full content from Phase 2-3 scan data:
## Coding Style
Detected conventions from codebase analysis:
- Indentation: 2-space (consistent across 47 JS files)
- Semicolons: absent (ESLint no-semi rule in .eslintrc)
- Quotes: single (Prettier singleQuote: true)
Partial coverage — governance file cross-references what exists and supplements the gaps:
## Coding Style
See CLAUDE.md § "Shell Standards" for shell conventions.
Additional conventions detected from codebase:
- Python files use black formatter (pyproject.toml [tool.black])
- Line length: 88 (black default, confirmed in 23 files)
When sources disagree:
## Indentation
CONFLICT: CLAUDE.md specifies tabs, .editorconfig specifies 2-space.
Using CLAUDE.md value (higher priority). Review and resolve.
## Line Length
CONFLICT (same priority): .eslintrc max-len=120, .prettierrc printWidth=80.
Both documented — resolve by choosing one and updating the other config.
Content sources: Phase 2 directory structure, Phase 3 container/CI data, Phase 1 architecture sections from existing .md files.
Structure:
# Architecture
## Project Overview
{project name, primary language, framework}
## Components
{directory-to-purpose mapping from Phase 2}
## Data Flow
{inferred from framework detection — e.g., HTTP request flow for
web frameworks, CLI argument flow for CLI tools}
## Key Boundaries
{service boundaries from docker-compose, monorepo workspace boundaries,
module boundaries from package structure}
## External Dependencies
{frameworks, databases, external services from dependency analysis}
If existing .md files already describe architecture, this file contains cross-references and supplements only.
Content sources: Phase 2 linter/formatter configs, Phase 1 convention sections from existing .md files, Phase 3 git commit patterns.
Structure:
# Conventions
## Coding Style
{from linter/formatter configs and source analysis}
## Naming
{from source analysis — file naming, function naming, variable naming}
## File Organization
{from directory structure analysis}
## Commit Messages
{from git history analysis in Phase 3}
## Branch Strategy
{from git branch naming patterns in Phase 3}
Content sources: Phase 2 test framework and linter detection, Phase 3 CI configuration, Phase 1 verification sections.
Structure:
# Verification
## Lint
{linter tool, config file, run command}
## Type Checks
{type checker if detected, run command}
## Tests
{test framework, test directory, run command, test count}
## CI Checks
{CI platform, what runs in CI, how to run locally}
## Pre-Commit
{pre-commit hooks if detected, what they check}
## Manual Checks
{anything from existing .md files that requires manual verification}
This file is critical — it tells the QA agent exactly what checks to run. Be specific about commands.
Content sources: Phase 3 platform targets, Phase 2 version detection, Phase 1 constraint sections from existing .md files.
Structure:
# Constraints
## Platform Targets
{OS list from CI matrix, Dockerfiles, or existing docs}
## Language Version
{minimum version from configs, CI matrix, or source analysis}
## Compatibility
{backward compat requirements from existing docs or lockfiles}
## Dependencies
{pinned versions, version ranges, known conflicts}
## Performance
{performance constraints from existing docs if any}
Content sources: Phase 2 directory scan for known noise patterns (node_modules/, vendor/, dist/, build/, target/, pycache/, .venv/, venv/), Phase 3 CI config for artifact directories, profiles/core/reference/ignore-defaults.md for conservative defaults that apply to every project.
Structure:
# Excluded Paths
> Paths that agents and grep-based tooling should skip.
> .gitignore-style glob syntax. Comments begin with #.
# Build / dependency trees
node_modules/
vendor/
dist/
build/
target/
# Python / virtualenvs
__pycache__/
.venv/
venv/
*.pyc
# RDF working state (never contains source)
.rdf/work-output/
Merge behavior: if ignore.md already exists, treat as user-modified
(preserve entries, append any missing defaults under a heading
# Added by /rdf:r-init).
Content sources: Phase 1 anti-pattern sections from existing .md files, Phase 2 linter suppression comments, Phase 3 git history (reverted commits, frequent fix areas).
Structure:
# Anti-Patterns
## Project-Specific
{from existing .md files — known pitfalls for this project}
## Detected from Linter Config
{rules that are explicitly enabled or have custom severity,
indicating they were problems before}
## Common for {language/framework}
{well-known anti-patterns for the detected stack — but only
include ones that are relevant based on the codebase scan}
## Historical
{from git history — files with frequent reverts or fix commits
suggest fragile areas}
Generated LAST, after all other governance files. Follows the schema
from schemas/governance-index.md.
Structure (must stay under 50 lines / ~100-150 tokens):
# Governance Index
## Project
- Name: {detected project name from package manifest, git remote, or dirname}
- Branch: {current git branch}
- Mode: development
- Plan: none
## Authoritative Files
- CLAUDE.md — {one-line description of what it covers}
- AGENTS.md — {one-line description}
{one line per existing .md file found in Phase 1}
## Governance Files
- architecture.md — {one-line summary of what was generated}
- conventions.md — {one-line summary}
- verification.md — {one-line summary}
- constraints.md — {one-line summary}
- anti-patterns.md — {one-line summary}
{only list files that were actually generated with content}
## Reference
{omit this section if no reference docs exist}
Rules for index.md:
Mark task "Generate supplementary governance" as completed.
Mark task "Validate and spot-check accuracy" as in_progress.
Verify generated governance accuracy and flag low-confidence inferences for user review.
For each generated governance file, perform at least 3 spot checks:
conventions.md — pick 3 claimed conventions, verify each against actual source files. Example: if conventions.md says "2-space indent", check 3 source files to confirm.
verification.md — verify that each listed command actually works:
architecture.md — verify that listed components exist as actual directories or files in the project.
constraints.md — verify platform targets match CI matrix or documentation. Cross-check version floors against actual configs.
anti-patterns.md — verify that referenced linter rules exist in the actual linter config files.
Assign confidence to each governance file section:
Collect all LOW confidence items and any conflicts into a report presented to the user after generation:
Low-confidence items (review recommended):
- constraints.md § Platform Targets: inferred from Dockerfile only
(ubuntu:22.04) — no CI matrix or docs to confirm
- conventions.md § Line Length: CONFLICT between .eslintrc (120)
and .prettierrc (80) — using .eslintrc value
- anti-patterns.md § Historical: limited git history (< 20 commits)
— fragile area detection may be incomplete
If a spot check reveals an inaccuracy:
Mark task "Validate and spot-check accuracy" as completed.
After all 5 phases complete, present one clean, compact summary. This is the user's first impression of RDF — it must feel like a superpower.
Target: under 25 lines. Drop rows where the value is (not detected).
Only show what was actually found — absence is not information.
## {Project} initialized — {N} governance files from {N} sources
| Codebase | Governance | Confidence |
|----------|-----------|------------|
| {lang} {pct}%, {N} files, ~{N}k lines | {N} files ingested, {N} generated | {N} HIGH / {N} MED / {N} LOW |
**Stack**: {language} {version} · {framework} · {test framework} ({N} tests) · {linters} · {CI platform}
**Governance** ({N} files, {total_lines} lines):
- [x] `index.md` — project identity, always loaded
- [x] `architecture.md` — {source: scan / refs / mixed}
- [x] `conventions.md` — {source}
- [x] `verification.md` — {source}
- [x] `constraints.md` — {source}
- [x] `anti-patterns.md` — {source}
{only if LOW > 0 or conflicts:}
> **Review**: {N} low-confidence items — {1-line summary of top concern}
> **Ready** — `/rdf:r-start` to begin | `/rdf:r-spec` to design | `/rdf:r-plan` to plan
Pipeline-aware Ready line: If an active plan or specs already exist, adjust the hint:
> **Ready** — /rdf:r-plan to create implementation plan> **Ready** — /rdf:r-build to start phase 1> **Ready** — /rdf:r-startto begin |/rdf:r-spec to designAdaptation rules:
·-separated string — dense and
scannable. Omit fields that weren't detected rather than showing
empty slots.After generating governance, verify .rdf/ is in .git/info/exclude.
If not, add it automatically — governance is local operational state,
not committed source. Do not prompt the user; this is the default.
.git/, warn the user that git history
analysis (Phase 3) will be skipped, then continue with remaining
phases..rdf/governance/ holds anything besides reference/ AND
--force is NOT set, warn the user:
/rdf:r-refresh."/rdf:r-init --force."--force IS set, delete .rdf/governance/ and continue./rdf:r-init . at the repo root produces governance for the dominant
patterns across the whole repository./rdf:r-init ./services/api scopes Phases 2-3 to that subdirectory
but still checks parent directories for convention files (Phase 1).{subdir}/.rdf/governance/,
NOT to the repo root's .rdf/governance/./rdf:r-init is for first-time governance generation. It refuses to
run if .rdf/governance/ holds anything besides reference/ (see
Error Handling #4)./rdf:r-init --force deletes existing governance and regenerates from
scratch. Use when governance is stale, corrupt, or after major
codebase restructuring that /rdf:r-refresh can't handle./rdf:r-refresh is for updating governance after codebase changes.
It preserves user modifications and updates scan-derived content.Phase 1 (ingest):
## ) and extract the coverage
map from headings without reading every line..cursor/rules/*.md), read the 10 most recently modified.Phase 2 (scan):
git ls-files for file enumeration — never bare findgit ls-files | xargs wc -l.
For >5k files, sample 100 files per language and extrapolate.Phase 3 (tooling):
git log --oneline -50 (last 50 commits)git shortlog -sn --no-merges | wc -lTarget wall times:
Context budget: The init command should not consume more than ~20% of the context window. For large codebases, prefer running bash commands for stats over reading files into context.
If /rdf:r-init is run and produces governance files, running /rdf:r-init
again (without --force) will NOT modify anything — it detects
existing governance and directs the user to /rdf:r-refresh.
With --force, idempotency is explicitly broken — existing
governance is deleted and regenerated from the current codebase state.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub rfxn/rdf --plugin rdf38 skills in this plugin
/r-auditUse when you want a full codebase audit: dispatches parallel reviewer and QA passes across the tree.
/r-audit-slopAI slop audit. Finds dead code, orphan helpers, noop functions,
/r-buildUse when a plan exists and you want it built: dispatches the plan-execution orchestrator (engineer/QA/review gates) per phase at the right tier.
/r-context-auditMeasure, score, and report on Claude Code context overhead for this
Other plugins' skills for the same job