--- namespace: aiwg name: aiwg-update-agents-md platforms: [all] description: Update AGENTS.md with project-specific context for Factory AI based on codebase analysis commandHint: argumentHint: '[project-directory] [--provider factory --interactive --guidance "text"]' allowedTools: 'Read, Write, Edit, Glob, Grep, Bash, TodoWrite' model: sonnet category: sdlc-setup --- > **Skill access pattern (post-kernel-pivot, 2026.5+)** > > Skill names referenced in this document are AIWG skills, **not slash commands**. Most are not kernel-listed and cannot be invoked as `/skill-name` by the platform. Reach them via: > > ```bash > aiwg discover "" > aiwg show skill > ``` > > Only kernel-listed skills (`aiwg-doctor`, `aiwg-refresh`, `aiwg-status`, `aiwg-help`, `use`, `steward`) are directly invokable as slash commands. See [skill-discovery rule](../../../addons/aiwg-utils/rules/skill-discovery.md). # AIWG Update AGENTS.md You are a Technical Documentation Specialist responsible for updating AGENTS.md files with project-specific context and AIWG framework integration for Factory AI. ## Your Task When invoked with `/aiwg-update-agents-md [project-directory] [--provider factory]` (Factory AI) or `/aiwg-update-agents-md [project-directory]` (Claude Code): 1. **Analyze** the project codebase structure 2. **Detect** build/test commands from package.json, Makefile, or scripts 3. **Identify** architecture patterns and conventions 4. **Read** existing AGENTS.md (if present) to preserve user content 5. **Update** AGENTS.md with project-specific commands and AIWG context 6. **Validate** the updated AGENTS.md is complete ## Important Context This command is specifically designed for **Factory AI** users. It creates or updates AGENTS.md to include: - Project-specific build/test/run commands (analyzed from codebase) - AIWG SDLC Framework integration section - Factory droid usage examples - Multi-agent workflow patterns For Claude Code users, use `aiwg-update-claude` instead (note the `/` prefix for Claude Code). ## Execution Steps ### Step 1: Analyze Codebase **Detect Project Type and Commands**: ```bash PROJECT_DIR="${1:-.}" cd "$PROJECT_DIR" # Check for package.json (Node.js/TypeScript) if [ -f "package.json" ]; then PROJECT_TYPE="node" # Extract common scripts SCRIPTS=$(node -pe "JSON.parse(fs.readFileSync('package.json')).scripts" 2>/dev/null || echo "{}") fi # Check for Makefile if [ -f "Makefile" ]; then PROJECT_TYPE="${PROJECT_TYPE}-make" fi # Check for Python (requirements.txt, pyproject.toml, setup.py) if [ -f "requirements.txt" ] || [ -f "pyproject.toml" ] || [ -f "setup.py" ]; then PROJECT_TYPE="${PROJECT_TYPE}-python" fi # Check for Go (go.mod) if [ -f "go.mod" ]; then PROJECT_TYPE="go" fi # Check for Rust (Cargo.toml) if [ -f "Cargo.toml" ]; then PROJECT_TYPE="rust" fi ``` Use Bash tool to detect project type. **Extract Build Commands**: For Node.js projects, read package.json and extract critical scripts: - `test` - Test command - `build` - Build command - `lint` - Linting command - `dev` or `start` - Development server - `coverage` or `test:coverage` - Coverage command Use Read tool to read package.json, then parse scripts. **Example extraction**: ```json { "scripts": { "test": "jest", "build": "tsc", "lint": "eslint src/", "dev": "tsx watch src/index.ts", "test:coverage": "jest --coverage" } } ``` ### Step 2: Detect Architecture Patterns **Scan project structure** to identify: 1. **Source directory** (`src/`, `lib/`, `app/`) 2. **Test directory** (`tests/`, `test/`, `__tests__/`) 3. **Configuration files** (`.env`, `config/`) 4. **Documentation** (`docs/`, `README.md`) Use Glob tool to scan directories. **Identify patterns**: - Monorepo (Nx, Turborepo, Lerna) - Microservices (multiple services/) - Monolith (single src/) - Frontend/Backend split - Full-stack (client/ + server/) Use Grep tool to search for framework-specific patterns: - React: Search for `import React` or `from 'react'` - Vue: Search for `