agentleFS
jmolzjmolz/m0lz.01/.agents/skills/source-command-create-rules/SKILL.md

source-command-create-rules

Skill0 starsChanged 6 months agoMITView on GitHub

Generate CLAUDE.md global rules from codebase analysis

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use this skill when the user asks to run the migrated source command create-rules.

    line 8
  2. Distinctive:

    Check for existing documentation:

    line 21
  3. Distinctive:

    If this is a new project with a PRD but no code yet, spin up sub-agents to research:

    line 62
  4. Distinctive:

    Write to AGENTS.md in the project root.

    line 70
  5. Distinctive:

    Use this template as the output structure — fill in every section with real data from the codebase analysis:

    line 72
  6. Distinctive:

    If the project has distinct subsystems, create on-demand rule files:

    line 84

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

source-command-create-rules

Use this skill when the user asks to run the migrated source command create-rules.

Command Template

Create Global Rules

Analyze the codebase and generate a AGENTS.md file with project-specific constraints and conventions.

Phase 1: Discover

Identify What Exists

Check for existing documentation:

  • PRD.md, .codex/PRD.md — product spec
  • README.md — project overview
  • package.json, pyproject.toml, Cargo.toml — dependencies
  • tsconfig.json, vite.config.*, next.config.* — build config
  • Existing test files and patterns
  • CI/CD workflows (.github/workflows/)
  • Docker files

Identify Project Type

TypeIndicators
Full-stack web appSeparate client/server, API routes
Frontend SPAReact/Vue/Svelte, no server
API/BackendExpress/FastAPI/etc, no frontend
Library/Packageexports in package.json, publishable
CLI Toolbin in package.json
MonorepoMultiple packages, workspaces

Map Structure

tree -L 3 -I 'node_modules|__pycache__|.git|dist|build|.next|venv*' 2>/dev/null || find . -maxdepth 3 -type f -not -path '*/node_modules/*' -not -path '*/.git/*' | head -60

Phase 2: Analyze

Extract Patterns (use sub-agents for research if needed)

From existing code, identify:

  • Naming: files, functions, classes, variables
  • Structure: how code is organized within files
  • Errors: how errors are created and handled
  • Types: how types/interfaces are defined
  • Imports: relative vs absolute, named vs namespace
  • Testing: framework, structure, patterns
  • Logging: strategy and format

Research Best Practices

If this is a new project with a PRD but no code yet, spin up sub-agents to research:

  • Testing strategy for the tech stack
  • Logging best practices
  • Common patterns for the framework
  • Component/module organization conventions

Phase 3: Generate AGENTS.md

Write to AGENTS.md in the project root. Keep it under 500 lines.

Use this template as the output structure — fill in every section with real data from the codebase analysis:

@.codex/templates/CLAUDE-template.md

What NOT to include

  • Exhaustive API documentation (put in .codex/docs/)
  • Framework-specific guides (put in .codex/rules/)
  • Full dependency lists (that's what package.json is for)
  • Anything that isn't needed every single session

Phase 4: Create On-Demand Context (if patterns identified)

If the project has distinct subsystems, create on-demand rule files:

.codex/rules/
├── frontend.md      ← component patterns, styling conventions
├── api.md           ← endpoint patterns, middleware, auth
├── database.md      ← query patterns, migrations, schema
└── testing.md       ← mock patterns, fixtures, test utilities

Each file should have path-scoped frontmatter:

---
paths:
  - "src/frontend/**"
  - "src/components/**"
---

Output

Confirm:

  1. AGENTS.md created with line count
  2. Any .codex/rules/ files created
  3. Any .codex/docs/ files created
  4. What to review and customize

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.