### Quick Start: Fork, Clone, and Branch Source: https://github.com/luohaothu/everything-codex/blob/main/CONTRIBUTING.md Steps to get started with contributing: fork the repository, clone it locally, create a new branch for your changes, and install necessary scripts. ```bash # 1. Fork and clone gh repo fork Luohaothu/everything-codex --clone cd everything-codex # 2. Create a branch git checkout -b feat/my-contribution # 3. Add your contribution (see sections below) # 4. Test locally ./scripts/install.sh # Install to verify # Then test with Codex CLI # 5. Submit PR git add . && git commit -m "feat: add my-skill" && git push ``` -------------------------------- ### Install everything-codex Source: https://github.com/luohaothu/everything-codex/blob/main/llms.txt Use this script to install the toolkit. It includes backup and merge strategies. ```bash # Install ./scripts/install.sh ``` -------------------------------- ### PM2 Command Examples Source: https://github.com/luohaothu/everything-codex/blob/main/skills/pm2/SKILL.md Common PM2 commands for managing processes, including starting, stopping, logging, and saving process lists. Use 'ecosystem.config.cjs' for the initial start. ```bash pm2 start ecosystem.config.cjs # First time pm2 start all # After first time pm2 stop all / pm2 restart all pm2 logs / pm2 status / pm2 monit pm2 save # Save process list pm2 resurrect # Restore saved list ``` -------------------------------- ### Interactive Codex CLI Installation Wizard Source: https://context7.com/luohaothu/everything-codex/llms.txt This bash script outlines the steps for the interactive installation wizard within the Codex CLI. It guides users through cloning the repository, selecting installation levels and skills, and installing necessary files. ```bash # Inside Codex CLI session: /configure-codex # Wizard flow: # Step 0: Clone repository rm -rf /tmp/everything-codex git clone https://github.com/anthropics/everything-codex.git /tmp/everything-codex # Step 1: Choose installation level # > User-level (~/.codex/ + ~/.agents/skills/) ← applies to all projects # > Project-level (.agents/skills/) ← current project only # Step 2: Select skill categories # [x] Core Workflow — plan, code-review, tdd, security-review, verify, checkpoint # [x] Language-specific — go-review, go-test, python-review, database-review # [ ] Multi-Model — orchestrate, multi-plan, multi-execute, multi-workflow # [ ] Learning — continuous-learning-v2, learn, evolve, instinct management # [ ] All skills — install everything # Step 3: Install selected skills SKILLS_DIR="$HOME/.agents/skills" for skill_dir in /tmp/everything-codex/skills/plan \ /tmp/everything-codex/skills/tdd \ /tmp/everything-codex/skills/code-review; do skill_name=$(basename "$skill_dir") mkdir -p "$SKILLS_DIR/$skill_name" cp -r "$skill_dir"/* "$SKILLS_DIR/$skill_name/" done # Step 4: Install AGENTS.md and rules cp /tmp/everything-codex/AGENTS.md ~/.codex/AGENTS.md mkdir -p ~/.codex/rules cp /tmp/everything-codex/rules/*.rules ~/.codex/rules/ # Step 5: Post-install verification output # Skills Installed: 6 # AGENTS.md: ~/.codex/AGENTS.md # Rules: safety.rules, git-safety.rules, file-hygiene.rules # Validation: 6/6 SKILL.md files valid (name + description frontmatter present) rm -rf /tmp/everything-codex ``` -------------------------------- ### Commit Example File Changes Source: https://github.com/luohaothu/everything-codex/blob/main/docs/plans/2026-02-08-everything-codex-implementation.md Stages all changes and commits them with a descriptive message for updating examples. ```bash git add -A git commit -m "docs: update examples for Codex (AGENTS.md, config.toml)" ``` -------------------------------- ### Install Skills to User or Project Directory Source: https://github.com/luohaothu/everything-codex/blob/main/skills/configure-codex/SKILL.md Copies installed skills to the specified directory. Supports both user-level installation (`~/.agents/skills/`) and project-level installation (`.agents/skills/`). ```bash # Skills install to ~/.agents/skills/ (user-level) or .agents/skills/ (project-level) SKILLS_DIR="$HOME/.agents/skills" # or .agents/skills for project-level for skill_dir in $ECX_ROOT/skills/*/; do skill_name=$(basename "$skill_dir") mkdir -p "$SKILLS_DIR/$skill_name" cp -r "$skill_dir"* "$SKILLS_DIR/$skill_name/" done ``` -------------------------------- ### Install Everything Codex Source: https://github.com/luohaothu/everything-codex/blob/main/README.md Clone the repository, navigate to the directory, and run the installation script. This script sets up skills, rules, workflows, prompts, and AGENTS.md in the appropriate user directories. ```bash git clone https://github.com/Luohaothu/everything-codex.git cd everything-codex ./scripts/install.sh ``` -------------------------------- ### Manual Installation of Everything Codex Source: https://github.com/luohaothu/everything-codex/blob/main/README.md Manual installation steps for Everything Codex. This involves copying configuration files and directories to their target locations. ```bash git clone https://github.com/Luohaothu/everything-codex.git # Copy AGENTS.md cp everything-codex/AGENTS.md ~/.codex/AGENTS.md # Copy skills cp -r everything-codex/skills/* ~/.agents/skills/ # Copy execution policies cp everything-codex/rules/*.rules ~/.codex/rules/ # Copy workflows and prompts cp -r everything-codex/workflows/* ~/.codex/workflows/ cp -r everything-codex/prompts/* ~/.codex/prompts/ # Copy language-specific AGENTS.md (pick your stack) cp everything-codex/golang/AGENTS.md ~/.codex/golang/AGENTS.md cp everything-codex/python/AGENTS.md ~/.codex/python/AGENTS.md cp everything-codex/typescript/AGENTS.md ~/.codex/typescript/AGENTS.md # Copy config (optional) cp everything-codex/config.toml ~/.codex/config.toml ``` -------------------------------- ### Checkpoint Workflow Example Source: https://github.com/luohaothu/everything-codex/blob/main/skills/checkpoint/SKILL.md Illustrates a typical workflow using checkpoint commands at different stages of development. ```bash [Start] → /checkpoint create "feature-start" [Implement] → /checkpoint create "core-done" [Test] → /checkpoint verify "core-done" [Refactor] → /checkpoint create "refactor-done" [PR] → /checkpoint verify "feature-start" ``` -------------------------------- ### Pytest Fixture with Setup and Teardown Source: https://github.com/luohaothu/everything-codex/blob/main/skills/python-testing/SKILL.md Shows how to create a fixture that performs setup actions before a test and teardown actions afterward, using `yield`. ```python @pytest.fixture def database(): """Fixture with setup and teardown.""" # Setup db = Database(":memory:") db.create_tables() db.insert_test_data() yield db # Provide to test # Teardown db.close() def test_database_query(database): """Test database operations.""" result = database.query("SELECT * FROM users") assert len(result) > 0 ``` -------------------------------- ### Environment Variables Setup Source: https://github.com/luohaothu/everything-codex/blob/main/examples/project-AGENTS.md Lists required and optional environment variables for project configuration, including database URL and API key. ```bash # Required DATABASE_URL= API_KEY= # Optional DEBUG=false ``` -------------------------------- ### Install Codex Rules via Script Source: https://github.com/luohaothu/everything-codex/blob/main/rules/README.md Recommended installation method for Codex rules using the install.sh script. ```bash # Via install.sh (recommended) ./scripts/install.sh ``` -------------------------------- ### Manually Install Codex Markdown Guidelines Source: https://github.com/luohaothu/everything-codex/blob/main/rules/README.md Manual installation of markdown guidelines by copying common and language-specific directories to the Codex rules directory. ```bash # Manual: Copy markdown guidelines (for reference, typically loaded via skills) cp -r rules/common/* ~/.codex/rules/ cp -r rules/typescript/* ~/.codex/rules/ # pick your stack cp -r rules/python/* ~/.codex/rules/ cp -r rules/golang/* ~/.codex/rules/ ``` -------------------------------- ### pyproject.toml Configuration Example Source: https://github.com/luohaothu/everything-codex/blob/main/skills/python-patterns/SKILL.md Example of a pyproject.toml file for configuring Python project metadata, dependencies, and tool settings for Black, Ruff, and MyPy. ```toml [project] name = "mypackage" version = "1.0.0" requires-python = ">=3.9" dependencies = [ "requests>=2.31.0", "pydantic>=2.0.0", ] [project.optional-dependencies] dev = [ "pytest>=7.4.0", "pytest-cov>=4.1.0", "black>=23.0.0", "ruff>=0.1.0", "mypy>=1.5.0", ] [tool.black] line-length = 88 target-version = ['py39'] [tool.ruff] line-length = 88 select = ["E", "F", "I", "N", "W"] [tool.mypy] python_version = "3.9" warn_return_any = true warn_unused_configs = true disallow_untyped_defs = true [tool.pytest.ini_options] testpaths = ["tests"] addopts = "--cov=mypackage --cov-report=term-missing" ``` -------------------------------- ### Use Codex Skills Source: https://github.com/luohaothu/everything-codex/blob/main/README.md After installation, you can use the provided skills directly with the Codex CLI. Examples include planning, code review, TDD, and security review. ```bash /plan "Add user authentication" /code-review /tdd /security-review ``` -------------------------------- ### Install script for Everything Codex Source: https://github.com/luohaothu/everything-codex/blob/main/docs/plans/2026-02-08-everything-codex-implementation.md This bash script handles the installation of Everything Codex. It backs up existing configurations, merges AGENTS.md, copies skills and rules to their respective Codex directories, and records an install manifest for uninstallation. ```bash #!/usr/bin/env bash set -euo pipefail CODEX_DIR="$HOME/.codex" AGENTS_SKILLS_DIR="$HOME/.agents/skills" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" PROJECT_DIR="$(dirname "$SCRIPT_DIR")" BACKUP_DIR="$CODEX_DIR/.backup-$(date +%Y%m%d%H%M%S)" INSTALL_MANIFEST="$CODEX_DIR/.everything-codex-manifest" echo "everything-codex installer" echo "=========================" echo "" # 0. Backup if [ -d "$CODEX_DIR" ] || [ -d "$AGENTS_SKILLS_DIR" ]; then echo "Backing up existing configuration..." mkdir -p "$BACKUP_DIR" [ -f "$CODEX_DIR/AGENTS.md" ] && cp "$CODEX_DIR/AGENTS.md" "$BACKUP_DIR/" [ -d "$CODEX_DIR/rules" ] && cp -r "$CODEX_DIR/rules" "$BACKUP_DIR/" [ -d "$AGENTS_SKILLS_DIR" ] && cp -r "$AGENTS_SKILLS_DIR" "$BACKUP_DIR/skills" for lang in golang python typescript; do if [ -d "$CODEX_DIR/$lang" ]; then mkdir -p "$BACKUP_DIR/$lang" cp -r "$CODEX_DIR/$lang" "$BACKUP_DIR/" fi done echo "Backup saved to: $BACKUP_DIR" fi ``` -------------------------------- ### Default Installation Structure Source: https://github.com/luohaothu/everything-codex/blob/main/docs/agents-md-architecture.md Displays the default directory structure and files installed by the `scripts/install.sh` script for Codex AGENTS.md files. ```bash ``` ~/.codex/ AGENTS.md # Global standards (always loaded) golang/AGENTS.md # Go rules template python/AGENTS.md # Python rules template typescript/AGENTS.md # TypeScript rules template ``` ``` -------------------------------- ### Import Report Example Source: https://github.com/luohaothu/everything-codex/blob/main/skills/instinct-import/SKILL.md An example of the output report after a successful instinct import, detailing added, updated, and skipped instincts. ```text Import complete! Added: 8 instincts Updated: 1 instinct Skipped: 3 instincts (2 duplicates, 1 conflict) New instincts saved to: ~/.codex/instincts/inherited/ ``` -------------------------------- ### Manually Install Codex Execution Policies Source: https://github.com/luohaothu/everything-codex/blob/main/rules/README.md Manual installation of execution policies by copying .rules files to the Codex rules directory. ```bash # Manual: Copy execution policies cp rules/*.rules ~/.codex/rules/ ``` -------------------------------- ### Move and Update Example File Source: https://github.com/luohaothu/everything-codex/blob/main/docs/plans/2026-02-08-everything-codex-implementation.md Renames an existing Markdown file and updates its content to reference Codex. ```bash mv examples/CLAUDE.md examples/project-AGENTS.md # Update content to reference Codex ``` -------------------------------- ### Global AGENTS.md Example Source: https://context7.com/luohaothu/everything-codex/llms.txt Example of global AGENTS.md content covering coding standards, git workflow, and security guidelines. ```markdown # Global: ~/.codex/AGENTS.md (installed by scripts/install.sh) # Covers: coding standards, git workflow, security guidelines, skill reference ## Coding Standards ALWAYS create new objects, NEVER mutate existing ones. MANY SMALL FILES > FEW LARGE FILES: 200-400 lines typical, 800 max. ALWAYS handle errors explicitly at every level. ## Git Workflow Commit format: : Types: feat, fix, refactor, docs, test, chore, perf, ci ## Security Guidelines Mandatory before any commit: - No hardcoded secrets (API keys, passwords, tokens) - All user inputs validated - SQL injection prevention (parameterized queries) ## Post-Edit Reminders After editing code files, remember to: - Format: Run prettier / gofmt / black on modified files - Type check: Run tsc / mypy / go vet - Lint: Check for console.log/print debug statements --- # Language-specific: ~/.codex/golang/AGENTS.md # Auto-loaded when Codex works in directories containing Go files ## Error Handling (CRITICAL) ALWAYS wrap errors with context: fmt.Errorf("operation failed: %w", err) NEVER ignore errors with _. Use errors.Is() and errors.As() for error inspection. ## Concurrency ALWAYS cancel goroutines via context.Context. ALWAYS use defer mu.Unlock() immediately after Lock(). Run race detector: go build -race ./... --- # Project-level: /AGENTS.md # Use examples/project-AGENTS.md as a starting template: ## Project Overview [Brief description of your project — tech stack, purpose] ## File Structure src/ ├── app/ # Next.js app router ├── components/ # Reusable UI components ├── hooks/ # Custom React hooks └── lib/ # Utility libraries ## Key Patterns interface ApiResponse { success: boolean; data?: T; error?: string } ## Available Skills - /tdd Test-driven development workflow - /plan Create implementation plan - /code-review Review code quality - /verify Run verification checks ``` -------------------------------- ### PM2 Init Skill Usage Commands Source: https://github.com/luohaothu/everything-codex/blob/main/skills/pm2/SKILL.md Basic commands to initialize, start, stop, and check the status of services managed by the PM2 Init Skill. ```bash /pm2 init # Scan project and generate config /pm2 start # Start all services /pm2 stop # Stop all services /pm2 status # View service status ``` -------------------------------- ### Verify Install/Uninstall in Temp Environment Source: https://github.com/luohaothu/everything-codex/blob/main/docs/plans/2026-02-08-everything-codex-implementation.md Tests the installation and uninstallation scripts in a temporary home directory, verifying the presence and absence of key files and directories. ```bash # Create temp HOME export HOME_BACKUP="$HOME" export HOME=$(mktemp -d) bash scripts/install.sh <<< "3" # replace strategy test -f "$HOME/.codex/AGENTS.md" && echo "AGENTS.md: OK" test -d "$HOME/.agents/skills/plan" && echo "Skills: OK" test -f "$HOME/.codex/rules/safety.rules" && echo "Rules: OK" bash scripts/uninstall.sh test ! -d "$HOME/.agents/skills/plan" && echo "Uninstall: OK" export HOME="$HOME_BACKUP" ``` -------------------------------- ### Multi-Frontend Skill Usage Source: https://github.com/luohaothu/everything-codex/blob/main/skills/multi-frontend/SKILL.md Use this command to initiate a frontend task description with the multi-frontend skill. The skill then guides the user through a multi-model workflow. ```bash /multi-frontend ``` -------------------------------- ### Multi-Workflow Skill Execution Example Source: https://context7.com/luohaothu/everything-codex/llms.txt This example demonstrates the execution of the `/multi-workflow` skill in Codex CLI, showcasing a six-phase collaborative development process with quality gates and user interaction points. ```bash # In Codex CLI: /multi-workflow "Build a real-time notification system using WebSockets" # Phase 1 — Research & Analysis [Mode: Research] # Retrieves project context, enhances prompt # Scores requirement completeness: 8/10 ✓ (≥ 7 required to advance) # Phase 2 — Solution Ideation [Mode: Ideation] # Parallel analysis from multiple model perspectives # Option A: Server-Sent Events (SSE) — simpler, HTTP/2 compatible # Option B: WebSocket + Redis Pub/Sub — bidirectional, horizontally scalable # → User selects Option B # Phase 3 — Detailed Planning [Mode: Plan] # Architecture plan saved to .codex/plan/realtime-notifications.md # → Awaiting user approval before implementation # Phase 4 — Implementation [Mode: Execute] # Follows approved plan strictly # Milestone checkpoint: "WebSocket server initialized" → user feedback requested # Phase 5 — Code Optimization [Mode: Optimize] # Multi-model parallel code review findings: # - Memory leak in connection cleanup handler (HIGH) # - Missing heartbeat/ping for connection health (MEDIUM) # → User confirms optimization; changes applied by orchestrator # Phase 6 — Quality Review [Mode: Review] # Plan completion: 11/12 tasks complete (91%) # Tests: 23 passing, 0 failing ``` -------------------------------- ### Codemap Format Example Source: https://github.com/luohaothu/everything-codex/blob/main/skills/doc-updater/SKILL.md Illustrates the expected format for codemap files, including metadata and structural details. ```markdown # [Area] Codemap **Last Updated:** YYYY-MM-DD **Entry Points:** list of main files ## Architecture [Component relationships] ## Key Modules | Module | Purpose | Exports | Dependencies | ## Data Flow [How data flows through this area] ``` -------------------------------- ### Explicit Configuration in Python Source: https://github.com/luohaothu/everything-codex/blob/main/skills/python-patterns/SKILL.md Prefer explicit configuration over implicit side effects. Ensure setup processes are clear and understandable. ```python # Good: Explicit configuration import logging logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' ) # Bad: Hidden side effects import some_module some_module.setup() # What does this do? ``` -------------------------------- ### Initial Broad Query for Candidate Files Source: https://github.com/luohaothu/everything-codex/blob/main/skills/iterative-retrieval/SKILL.md Use this to start the retrieval process by defining broad search patterns, keywords, and exclusions. ```javascript // Start with high-level intent const initialQuery = { patterns: ['src/**/*.ts', 'lib/**/*.ts'], keywords: ['authentication', 'user', 'session'], excludes: ['*.test.ts', '*.spec.ts'] }; // Dispatch to retrieval agent const candidates = await retrieveFiles(initialQuery); ``` -------------------------------- ### Go Error Wrapping Example Source: https://github.com/luohaothu/everything-codex/blob/main/docs/agents-md-architecture.md Demonstrates the recommended way to wrap errors in Go using fmt.Errorf with the %w verb for error chaining. ```go fmt.Errorf("...: %w", err) ``` -------------------------------- ### Install AGENTS.md and Execution Policy Rules Source: https://github.com/luohaothu/everything-codex/blob/main/skills/configure-codex/SKILL.md Copies the root AGENTS.md, language-specific AGENTS.md templates, and execution policy rules to their respective locations within the Codex configuration directory. ```bash # Root AGENTS.md cp $ECX_ROOT/AGENTS.md ~/.codex/AGENTS.md # Language-specific AGENTS.md templates for lang in golang python typescript; do mkdir -p ~/.codex/$lang cp $ECX_ROOT/$lang/AGENTS.md ~/.codex/$lang/ done # Execution policy rules mkdir -p ~/.codex/rules cp $ECX_ROOT/rules/*.rules ~/.codex/rules/ ``` -------------------------------- ### TDD Workflow: Initial Setup Source: https://github.com/luohaothu/everything-codex/blob/main/skills/golang-testing/SKILL.md Demonstrates the initial steps of the TDD workflow in Go, including defining an interface, writing a failing test, and implementing minimal code to pass. ```go // Step 1: Define the interface/signature // calculator.go package calculator func Add(a, b int) int { panic("not implemented") // Placeholder } ``` ```go // Step 2: Write failing test (RED) // calculator_test.go package calculator import "testing" func TestAdd(t *testing.T) { got := Add(2, 3) want := 5 if got != want { t.Errorf("Add(2, 3) = %d; want %d", got, want) } } ``` ```go // Step 4: Implement minimal code (GREEN) func Add(a, b int) int { return a + b } ``` -------------------------------- ### Frontend Testing with npm Source: https://github.com/luohaothu/everything-codex/blob/main/skills/project-guidelines-example/SKILL.md Commands for running frontend tests using npm, including options for coverage and end-to-end (E2E) tests. Assumes a React project setup. ```bash # Run tests npm run test # Run with coverage npm run test -- --coverage # Run E2E tests npm run test:e2e ``` -------------------------------- ### Organizing Related Tests with Subtests Source: https://github.com/luohaothu/everything-codex/blob/main/skills/golang-testing/SKILL.md Uses t.Run to organize related tests for a User object, including Create, Get, Update, and Delete operations. Setup is shared across subtests. ```go func TestUser(t *testing.T) { // Setup shared by all subtests db := setupTestDB(t) t.Run("Create", func(t *testing.T) { user := &User{Name: "Alice"} err := db.CreateUser(user) if err != nil { t.Fatalf("CreateUser failed: %v", err) } if user.ID == "" { t.Error("expected user ID to be set") } }) t.Run("Get", func(t *testing.T) { user, err := db.GetUser("alice-id") if err != nil { t.Fatalf("GetUser failed: %v", err) } if user.Name != "Alice" { t.Errorf("got name %q; want %q", user.Name, "Alice") } }) t.Run("Update", func(t *testing.T) { // ... }) t.Run("Delete", func(t *testing.T) { // ... }) } ``` -------------------------------- ### Update README.md for Codex CLI Source: https://github.com/luohaothu/everything-codex/blob/main/docs/plans/2026-02-08-everything-codex-implementation.md This command stages the updated README.md file and commits it with a message reflecting the changes made for the Everything Codex CLI, including title, description, installation, and example updates. ```bash git add README.md git commit -m "docs: rewrite README for everything-codex Update title, description, installation, directory structure, and examples for OpenAI Codex CLI. Remove Claude Code references." ``` -------------------------------- ### __init__.py for Package Exports Source: https://github.com/luohaothu/everything-codex/blob/main/skills/python-patterns/SKILL.md Shows how to use __init__.py to define package version, export key components, and control the namespace using __all__. ```python # mypackage/__init__.py """mypackage - A sample Python package.""" __version__ = "1.0.0" # Export main classes/functions at package level from mypackage.models import User, Post from mypackage.utils import format_name __all__ = ["User", "Post", "format_name"] ``` -------------------------------- ### Initialize Codex Directory Structure Source: https://github.com/luohaothu/everything-codex/blob/main/skills/continuous-learning-v2/SKILL.md Sets up the necessary directories for storing instincts and evolved skills locally. ```bash mkdir -p ~/.codex/instincts/{personal,inherited} mkdir -p ~/.codex/evolved/skills ``` -------------------------------- ### Build Project with Maven or Gradle Source: https://github.com/luohaothu/everything-codex/blob/main/skills/springboot-verification/SKILL.md Use this command to clean and build your project. It skips tests during the initial build phase to save time. ```bash mvn -T 4 clean verify -DskipTests ``` ```bash ./gradlew clean assemble -x test ``` -------------------------------- ### Example Go Development Rules Source: https://github.com/luohaothu/everything-codex/blob/main/docs/agents-md-architecture.md Illustrates how AGENTS.md and skills provide complementary rules for Go development. AGENTS.md contains always-on standards, while skills offer on-demand detailed knowledge. ```markdown - `AGENTS.md` (always loaded): "Run `gofmt` after editing `.go` files. Wrap errors with `%w`." - `/golang-rules` skill (on demand): Comprehensive Go-specific rules including formatting, design principles, error handling patterns, testing, and security. - `/golang-patterns` skill (on demand): Detailed Go idioms -- functional options, dependency injection, concurrency patterns. - `/golang-testing` skill (on demand): Table-driven test templates, benchmark patterns, mock strategies. ``` -------------------------------- ### Delete Claude Code Specific Examples Source: https://github.com/luohaothu/everything-codex/blob/main/docs/plans/2026-02-08-everything-codex-implementation.md Removes specific example files and directories related to Claude Code. ```bash rm -f examples/user-CLAUDE.md examples/statusline.json rm -rf examples/sessions/ ``` -------------------------------- ### Go Basic Benchmark Source: https://github.com/luohaothu/everything-codex/blob/main/skills/golang-testing/SKILL.md Write basic benchmarks using the testing package's `testing.B` type. Use `b.ResetTimer()` to exclude setup time and `b.N` for the number of iterations. ```go func BenchmarkProcess(b *testing.B) { data := generateTestData(1000) b.ResetTimer() // Don't count setup time for i := 0; i < b.N; i++ { Process(data) } } // Run: go test -bench=BenchmarkProcess -benchmem // Output: BenchmarkProcess-8 10000 105234 ns/op 4096 B/op 10 allocs/op ``` -------------------------------- ### Evolve Skill Usage Examples Source: https://github.com/luohaothu/everything-codex/blob/main/skills/evolve/SKILL.md Demonstrates how to use the evolve command with different flags to analyze and suggest skill evolutions. Use `--dry-run` to preview changes without execution. ```bash /evolve # Analyze all instincts and suggest evolutions ``` ```bash /evolve --domain testing # Only evolve instincts in testing domain ``` ```bash /evolve --dry-run # Show what would be created ``` ```bash /evolve --threshold 5 # Require 5+ related instincts to cluster ``` -------------------------------- ### SKILL.md Behavioral Constraints Example Source: https://github.com/luohaothu/everything-codex/blob/main/CONTRIBUTING.md Example of how to specify behavioral constraints for a skill, such as read-only access or prohibiting file modifications. ```markdown ## Behavioral Constraints - This is a READ-ONLY review skill - Do NOT modify any files directly - Present findings as a report for the user to act on ``` -------------------------------- ### Install and Uninstall everything-codex Source: https://context7.com/luohaothu/everything-codex/llms.txt Automated script for installing and uninstalling the everything-codex toolkit. Supports merge strategies for AGENTS.md and rollback options. ```bash # Clone and install git clone https://github.com/Luohaothu/everything-codex.git cd everything-codex ./scripts/install.sh ``` ```bash # The installer prompts for AGENTS.md merge strategy if one already exists: # 1) append - Add everything-codex rules to end of existing file # 2) include - Add reference comment to existing file # 3) replace - Replace with everything-codex version (original backed up) # 4) skip - Do not modify (default) # 5) dry-run - Show diff only ``` ```bash # Files are installed to: # ~/.agents/skills//SKILL.md — 62 skills # ~/.codex/rules/*.rules — execution policies # ~/.codex/workflows/*.md — workflow playbooks # ~/.codex/prompts/*.md — prompt templates # ~/.codex/AGENTS.md — global instructions # ~/.codex/{golang,python,typescript}/AGENTS.md — language templates # ~/.codex/config.toml.example — config reference ``` ```bash # To uninstall (manifest-based, leaves AGENTS.md intact): ./scripts/uninstall.sh ``` ```bash # To rollback to last backup: ./scripts/uninstall.sh --rollback ``` -------------------------------- ### Essential Go Build and Run Commands Source: https://github.com/luohaothu/everything-codex/blob/main/skills/golang-patterns/SKILL.md Provides a list of essential Go command-line tools for building, running, testing, static analysis, module management, and formatting projects. ```bash # Build and run go build ./... go run ./cmd/myapp # Testing go test ./... go test -race ./... go test -cover ./... # Static analysis go vet ./... staticcheck ./... golangci-lint run # Module management go mod tidy go mod verify # Formatting gofmt -w . goimports -w . ``` -------------------------------- ### Initialize Instinct Directory Structure Source: https://context7.com/luohaothu/everything-codex/llms.txt Set up the necessary directories for storing personal and inherited instincts, as well as evolved skills. ```bash # Initialize the instinct directory structure: mkdir -p ~/.codex/instincts/{personal,inherited} mkdir -p ~/.codex/evolved/skills ``` -------------------------------- ### Multi-Backend Skill Usage Source: https://github.com/luohaothu/everything-codex/blob/main/skills/multi-backend/SKILL.md Use this command to initiate the multi-backend skill, providing a description of the backend task you need to accomplish. ```bash /multi-backend ``` -------------------------------- ### Dependency Injection in Go Source: https://github.com/luohaothu/everything-codex/blob/main/golang/AGENTS.md Demonstrates dependency injection for creating services. Dependencies like repositories and loggers are passed into the constructor. ```go func NewUserService(repo UserRepository, logger Logger) *UserService { return &UserService{repo: repo, logger: logger} } ``` -------------------------------- ### Recommended Linter Configuration (.golangci.yml) Source: https://github.com/luohaothu/everything-codex/blob/main/skills/golang-patterns/SKILL.md A sample configuration file for golangci-lint, specifying enabled linters and their settings for code quality checks. ```yaml linters: enable: - errcheck - gosimple - govet - ineffassign - staticcheck - unused - gofmt - goimports - misspell - unconvert - unparam linters-settings: errcheck: check-type-assertions: true govet: check-shadowing: true issues: exclude-use-default: false ``` -------------------------------- ### Pull Request Title Format Examples Source: https://github.com/luohaothu/everything-codex/blob/main/CONTRIBUTING.md Examples of correctly formatted pull request titles, indicating the type of contribution (feat, fix, docs) and the scope (skills, rules). ```text feat(skills): add rust-patterns skill feat(rules): add docker-safety execution policy docs: improve contributing guide fix(skills): update React patterns ``` -------------------------------- ### Make install.sh Executable Source: https://github.com/luohaothu/everything-codex/blob/main/docs/plans/2026-02-08-everything-codex-implementation.md Sets execute permissions for the install.sh script. ```bash chmod +x scripts/install.sh ``` -------------------------------- ### Install AGENTS.md with Merge Strategy Source: https://github.com/luohaothu/everything-codex/blob/main/docs/plans/2026-02-08-everything-codex-implementation.md Installs or merges the AGENTS.md file into the user's codex directory, offering options to append, include a reference, replace, skip, or perform a dry-run. ```bash #!/usr/bin/env bash set -euo pipefail CODEX_DIR="$HOME/.codex" PROJECT_DIR="$(dirname "$0")" AGENTS_SKILLS_DIR="$HOME/.agents/skills" INSTALL_MANIFEST="$CODEX_DIR/.everything-codex-manifest" BACKUP_DIR="$CODEX_DIR/.backup-$(date +%Y%m%d-%H%M%S)" mkdir -p "$CODEX_DIR" if [ -f "$CODEX_DIR/AGENTS.md" ]; then echo "" echo "Existing AGENTS.md detected. Choose merge strategy:" echo " 1) append - Add everything-codex rules to end of existing file" echo " 2) include - Add reference comment to existing file" echo " 3) replace - Replace with everything-codex version (original backed up)" echo " 4) skip - Do not modify (default)" echo " 5) dry-run - Show diff only" read -rp "Choice [1-5, default=4]: " choice case "${choice:-4}" in 1) printf '\n# --- everything-codex rules ---\n\n' >> "$CODEX_DIR/AGENTS.md" cat "$PROJECT_DIR/AGENTS.md" >> "$CODEX_DIR/AGENTS.md" echo "Appended to AGENTS.md" ;; 2) printf '\n# everything-codex rules: see ~/.codex/.everything-codex/AGENTS.md\n' >> "$CODEX_DIR/AGENTS.md" echo "Added reference to AGENTS.md" ;; 3) cp "$PROJECT_DIR/AGENTS.md" "$CODEX_DIR/AGENTS.md" echo "Replaced AGENTS.md" ;; 4) echo "Skipped AGENTS.md" ;; 5) diff "$CODEX_DIR/AGENTS.md" "$PROJECT_DIR/AGENTS.md" || true ;; esac else cp "$PROJECT_DIR/AGENTS.md" "$CODEX_DIR/AGENTS.md" echo "Installed AGENTS.md" fi # 2. Language AGENTS.md templates for lang in golang python typescript; do mkdir -p "$CODEX_DIR/$lang" if [ -f "$CODEX_DIR/$lang/AGENTS.md" ]; then echo "Existing $lang/AGENTS.md, skipping (use --force to overwrite)" else cp "$PROJECT_DIR/$lang/AGENTS.md" "$CODEX_DIR/$lang/AGENTS.md" echo "Installed $lang/AGENTS.md" fi done # 3. Skills → ~/.agents/skills/ mkdir -p "$AGENTS_SKILLS_DIR" echo "Installing skills..." for skill_dir in "$PROJECT_DIR"/skills/*/; do skill_name=$(basename "$skill_dir") target="$AGENTS_SKILLS_DIR/$skill_name" mkdir -p "$target" cp -r "$skill_dir"* "$target/" done echo "Installed $(ls -d "$PROJECT_DIR"/skills/*/ | wc -l | tr -d ' ') skills" # 4. Rules → ~/.codex/rules/ mkdir -p "$CODEX_DIR/rules" cp "$PROJECT_DIR"/rules/*.rules "$CODEX_DIR/rules/" echo "Installed execution policy rules" # 5. Config examples cp "$PROJECT_DIR/config.toml" "$CODEX_DIR/config.toml.example" echo "Installed config.toml.example" # 6. Install manifest : > "$INSTALL_MANIFEST" find "$AGENTS_SKILLS_DIR" -type f >> "$INSTALL_MANIFEST" find "$CODEX_DIR/rules" -name "*.rules" -type f >> "$INSTALL_MANIFEST" echo "$CODEX_DIR/config.toml.example" >> "$INSTALL_MANIFEST" echo "Manifest written to $INSTALL_MANIFEST" # 7. Post-install verification echo "" echo "Running verification..." if command -v codex &>/dev/null; then codex --check-config 2>/dev/null && echo "Config: OK" || echo "Config: check failed (may need manual review)" else echo "codex CLI not found, skipping config check" fi echo "" echo "Installation complete!" echo "Backup at: $BACKUP_DIR" echo "To uninstall: $(dirname "$0")/uninstall.sh" echo "To rollback: $0 --rollback" ``` -------------------------------- ### Pytest Fixtures for Test Setup Source: https://github.com/luohaothu/everything-codex/blob/main/skills/python-testing/SKILL.md Define fixtures for shared setup and teardown logic in tests. The `client` fixture provides a test client for the application, and `auth_headers` generates authentication headers. ```python import pytest @pytest.fixture def client(): """Shared fixture for all tests.""" app = create_app(testing=True) with app.test_client() as client: yield client @pytest.fixture def auth_headers(client): """Generate auth headers for API testing.""" response = client.post("/api/login", json={ "username": "test", "password": "test" }) token = response.json["token"] return {"Authorization": f"Bearer {token}"} ``` -------------------------------- ### Clean Up Cloned Repository Source: https://github.com/luohaothu/everything-codex/blob/main/skills/configure-codex/SKILL.md Removes the temporary directory where the everything-codex repository was cloned after installation is complete. ```bash rm -rf /tmp/everything-codex ``` -------------------------------- ### Run Skill Create Tool Source: https://github.com/luohaothu/everything-codex/blob/main/skills/skill-create/SKILL.md Execute the skill-create tool to analyze the current repository. Options include specifying the number of commits to analyze or a custom output directory. ```bash /skill-create ``` ```bash /skill-create --commits 100 ``` ```bash /skill-create --output ./skills ``` -------------------------------- ### QuerySet Caching in Django Source: https://github.com/luohaothu/everything-codex/blob/main/skills/django-patterns/SKILL.md Cache the results of a Django QuerySet for a specified duration. This example caches popular categories. ```python from django.core.cache import cache def get_popular_categories(): cache_key = 'popular_categories' categories = cache.get(cache_key) if categories is None: categories = list(Category.objects.annotate( product_count=Count('products') ).filter(product_count__gt=10).order_by('-product_count')[:20]) cache.set(cache_key, categories, timeout=60 * 60) # 1 hour return categories ``` -------------------------------- ### Run Verification Commands Source: https://github.com/luohaothu/everything-codex/blob/main/skills/verify/SKILL.md Execute the verification skill with different levels of checks. Use '/verify' for a full check, '/verify quick' for build and types only, '/verify pre-commit' for commit-relevant checks, and '/verify pre-pr' for full checks including security. ```bash /verify # Full verification (default) /verify quick # Build + types only /verify pre-commit # Checks relevant for commits /verify pre-pr # Full checks plus security scan ``` -------------------------------- ### Create config.toml Source: https://github.com/luohaothu/everything-codex/blob/main/docs/plans/2026-02-08-everything-codex-implementation.md Write the main configuration file for Everything Codex, specifying the model, sandbox mode, and network access settings. ```toml #:schema https://developers.openai.com/codex/config-schema.json # everything-codex configuration # Minimum Codex CLI version: 0.98.0 model = "o4-mini" sandbox_mode = "workspace-write" [sandbox_workspace_write] network_access = true ``` -------------------------------- ### Golang Testing Commands Source: https://github.com/luohaothu/everything-codex/blob/main/skills/golang-testing/SKILL.md Common command-line instructions for running Go tests, including options for verbosity, specific test selection, race detection, coverage, short tests, timeouts, benchmarks, fuzzing, and counting test runs. ```bash # Run all tests go test ./... # Run tests with verbose output go test -v ./... # Run specific test go test -run TestAdd ./... # Run tests matching pattern go test -run "TestUser/Create" ./... # Run tests with race detector go test -race ./... # Run tests with coverage go test -cover -coverprofile=coverage.out ./... # Run short tests only go test -short ./... # Run tests with timeout go test -timeout 30s ./... # Run benchmarks go test -bench=. -benchmem ./... # Run fuzzing go test -fuzz=FuzzParse -fuzztime=30s ./... # Count test runs (for flaky test detection) go test -count=10 ./... ``` -------------------------------- ### Bug Fix Workflow Sequence Source: https://github.com/luohaothu/everything-codex/blob/main/workflows/orchestrate.md Sequence for addressing bugs, starting with root cause investigation, followed by testing and review. ```bash (investigate root cause) -> /tdd -> /code-review -> /verify ``` -------------------------------- ### Go 测试覆盖率命令 Source: https://github.com/luohaothu/everything-codex/blob/main/docs/zh-CN/skills/golang-testing/SKILL.md 提供一系列用于运行和分析 Go 测试覆盖率的命令行命令,包括基本覆盖率、生成覆盖率文件、在浏览器中查看覆盖率以及按函数查看覆盖率。 ```bash # Basic coverage go test -cover ./... # Generate coverage profile go test -coverprofile=coverage.out ./... # View coverage in browser go tool cover -html=coverage.out # View coverage by function go tool cover -func=coverage.out # Coverage with race detection go test -race -coverprofile=coverage.out ./... ``` -------------------------------- ### Security Workflow Sequence Source: https://github.com/luohaothu/everything-codex/blob/main/skills/orchestrate/SKILL.md This sequence is specifically for security-focused reviews, starting with a security review, followed by a code review, and then planning. ```bash /security-review → /code-review → /plan ``` -------------------------------- ### Run Go Tests with Coverage Source: https://github.com/luohaothu/everything-codex/blob/main/skills/test-coverage/SKILL.md Execute Go tests and generate coverage profiles. Use 'go tool cover' to analyze the generated profile. ```bash go test -cover ./... ``` ```bash go test -coverprofile=coverage.out ./... ``` ```bash go tool cover -func=coverage.out ``` -------------------------------- ### Feature Workflow Sequence Source: https://github.com/luohaothu/everything-codex/blob/main/skills/orchestrate/SKILL.md This sequence outlines the steps for a full feature implementation, starting with planning and ending with a security review. ```bash /plan → /tdd → /code-review → /security-review ``` -------------------------------- ### JPA Pagination Example Source: https://github.com/luohaothu/everything-codex/blob/main/skills/jpa-patterns/SKILL.md Demonstrates creating a `PageRequest` with sorting and using it to query entities by status. Suitable for standard page-based navigation. ```java PageRequest page = PageRequest.of(pageNumber, pageSize, Sort.by("createdAt").descending()); Page markets = repo.findByStatus(MarketStatus.ACTIVE, page); ``` -------------------------------- ### Test Product Creation with Factories Source: https://github.com/luohaothu/everything-codex/blob/main/skills/django-tdd/SKILL.md Use ProductFactory and UserFactory to create instances for testing model logic. Customize fields like price and stock during creation. ```python # tests/test_models.py import pytest from tests.factories import ProductFactory, UserFactory def test_product_creation(): """Test product creation using factory.""" product = ProductFactory(price=100.00, stock=50) assert product.price == 100.00 assert product.stock == 50 assert product.is_active is True def test_product_with_tags(): """Test product with tags.""" tags = [TagFactory(name='electronics'), TagFactory(name='new')] product = ProductFactory(tags=tags) assert product.tags.count() == 2 def test_multiple_products(): """Test creating multiple products.""" products = ProductFactory.create_batch(10) assert len(products) == 10 ``` -------------------------------- ### Verify Core Skills Frontmatter Source: https://github.com/luohaothu/everything-codex/blob/main/docs/plans/2026-02-08-everything-codex-implementation.md Loop through core skills to display the first 5 lines of each SKILL.md file, verifying proper frontmatter. ```bash for skill in plan code-review tdd security-review; do echo "--- $skill ---" head -5 skills/$skill/SKILL.md echo "" done ``` -------------------------------- ### Eval Report Format Source: https://github.com/luohaothu/everything-codex/blob/main/skills/eval/SKILL.md Example format for an evaluation report. Summarizes capability and regression eval results, and provides an overall status. ```markdown EVAL REPORT: feature-xyz ======================== Capability: 3/3 passed (pass@3: 100%) Regression: 3/3 passed (pass^3: 100%) Status: SHIP IT ``` -------------------------------- ### Backend Testing with pytest Source: https://github.com/luohaothu/everything-codex/blob/main/skills/project-guidelines-example/SKILL.md Demonstrates running backend tests using pytest, including commands for running all tests, with coverage, and for specific files. Requires pytest and httpx. ```bash # Run all tests poetry run pytest tests/ # Run with coverage poetry run pytest tests/ --cov=. --cov-report=html # Run specific test file poetry run pytest tests/test_auth.py -v ``` -------------------------------- ### Go 内存分配基准测试 Source: https://github.com/luohaothu/everything-codex/blob/main/docs/zh-CN/skills/golang-testing/SKILL.md 使用 `testing.B` 运行不同字符串拼接方式的性能基准测试,包括 '+' 运算符、`strings.Builder` 和 `strings.Join`。 ```go func BenchmarkStringConcat(b *testing.B) { parts := []string{"hello", "world", "foo", "bar", "baz"} b.Run("plus", func(b *testing.B) { for i := 0; i < b.N; i++ { var s string for _, p := range parts { s += p } _ = s } }) b.Run("builder", func(b *testing.B) { for i := 0; i < b.N; i++ { var sb strings.Builder for _, p := range parts { sb.WriteString(p) } _ = sb.String() } }) b.Run("join", func(b *testing.T) { for i := 0; i < b.N; i++ { _ = strings.Join(parts, "") } }) } ``` -------------------------------- ### Go Build and Vet Checks Source: https://github.com/luohaothu/everything-codex/blob/main/skills/build-fix/SKILL.md Commands to build all Go packages and run static analysis checks. Use 'go build' to check for compilation errors and 'go vet' for detecting suspicious constructs. ```bash go build ./... ``` ```bash go vet ./... ``` -------------------------------- ### REST API Controller Structure Source: https://github.com/luohaothu/everything-codex/blob/main/docs/zh-CN/skills/springboot-patterns/SKILL.md Defines a REST controller for managing markets, handling GET and POST requests with pagination and validation. ```java import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.http.ResponseEntity; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import jakarta.validation.Valid; @RestController @RequestMapping("/api/markets") @Validated class MarketController { private final MarketService marketService; MarketController(MarketService marketService) { this.marketService = marketService; } @GetMapping ResponseEntity> list( @RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "20") int size) { Page markets = marketService.list(PageRequest.of(page, size)); return ResponseEntity.ok(markets.map(MarketResponse::from)); } @PostMapping ResponseEntity create(@Valid @RequestBody CreateMarketRequest request) { Market market = marketService.create(request); return ResponseEntity.status(HttpStatus.CREATED).body(MarketResponse.from(market)); } } ``` -------------------------------- ### Parametrized Fixtures in Pytest Source: https://github.com/luohaothu/everything-codex/blob/main/skills/python-testing/SKILL.md Create fixtures that can be parametrized to run tests against different configurations or environments. This example tests against multiple database backends. ```python @pytest.fixture(params=["sqlite", "postgresql", "mysql"]) def db(request): """Test against multiple database backends.""" if request.param == "sqlite": return Database(":memory:") elif request.param == "postgresql": return Database("postgresql://localhost/test") elif request.param == "mysql": return Database("mysql://localhost/test") def test_database_operations(db): """Test runs 3 times, once for each database.""" result = db.query("SELECT 1") assert result is not None ```