### Install and run Codeg server on Windows Source: https://github.com/xintaofei/codeg/blob/main/README.md Use PowerShell to download and execute the installation script, then set the environment variable and start the server. ```powershell irm https://raw.githubusercontent.com/xintaofei/codeg/main/install.ps1 | iex $env:CODEG_STATIC_DIR="$env:LOCALAPPDATA\codeg\web"; codeg-server ``` -------------------------------- ### Install and run Codeg server on Linux or macOS Source: https://github.com/xintaofei/codeg/blob/main/README.md Use curl to download and execute the installation script, then start the server by specifying the static directory. ```bash curl -fsSL https://raw.githubusercontent.com/xintaofei/codeg/main/install.sh | bash CODEG_STATIC_DIR=/usr/local/share/codeg/web codeg-server ``` -------------------------------- ### Auto-detect and run project setup Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/using-git-worktrees/SKILL.md Detects the project type based on the presence of configuration files and runs the corresponding installation command. ```bash # Node.js if [ -f package.json ]; then npm install; fi # Rust if [ -f Cargo.toml ]; then cargo build; fi # Python if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f pyproject.toml ]; then poetry install; fi # Go if [ -f go.mod ]; then go mod download; fi ``` -------------------------------- ### Explicit Dependency and Usage Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/writing-skills/anthropic-best-practices.md Shows the correct approach to handling external dependencies by explicitly stating installation requirements before providing the Python code. ```python from pypdf import PdfReader reader = PdfReader("file.pdf") ``` -------------------------------- ### Compress examples Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/writing-skills/SKILL.md Use minimal examples to reduce word count while maintaining clarity. ```markdown # ❌ BAD: Verbose example (42 words) your human partner: "How did we handle authentication errors in React Router before?" You: I'll search past conversations for React Router authentication patterns. [Dispatch subagent with search query: "React Router authentication error handling 401"] # ✅ GOOD: Minimal example (20 words) Partner: "How did we handle auth errors in React Router?" You: Searching... [Dispatch subagent → synthesis] ``` -------------------------------- ### YAML Description Examples for Skill Discovery Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/writing-skills/SKILL.md Examples of good and bad description formats for skill discovery. Bad examples summarize workflows or provide too much process detail, while good examples focus strictly on triggering conditions. ```yaml # ❌ BAD: Summarizes workflow - agents may follow this instead of reading skill description: Use when executing plans - dispatches subagent per task with code review between tasks # ❌ BAD: Too much process detail description: Use for TDD - write test first, watch it fail, write minimal code, refactor # ✅ GOOD: Just triggering conditions, no workflow summary description: Use when executing implementation plans with independent tasks in the current session # ✅ GOOD: Triggering conditions only description: Use when implementing any feature or bugfix, before writing implementation code ``` -------------------------------- ### Install Dependencies Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/scientific-schematics/references/README.md Commands to install the required requests library or project dependencies. ```bash # Install requests library pip install requests # Or use the package manager pip install -r requirements.txt ``` -------------------------------- ### @phdthesis Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/citation-management/references/bibtex_formatting.md Example entry for a PhD dissertation. ```bibtex @phdthesis{Johnson2023, author = {Johnson, Mary L.}, title = {Novel Approaches to Cancer Immunotherapy Using {CRISPR} Technology}, school = {Stanford University}, year = {2023}, type = {{PhD} dissertation}, address = {Stanford, CA} } ``` -------------------------------- ### Utility script usage examples Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/writing-skills/anthropic-best-practices.md Examples of how to document and invoke utility scripts for form processing and validation. ```bash python scripts/analyze_form.py input.pdf > fields.json ``` ```json { "field_name": {"type": "text", "x": 100, "y": 200}, "signature": {"type": "sig", "x": 150, "y": 500} } ``` ```bash python scripts/validate_boxes.py fields.json # Returns: "OK" or lists conflicts ``` ```bash python scripts/fill_form.py input.pdf fields.json output.pdf ``` -------------------------------- ### Cursor Pagination Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/paper-lookup/references/openalex.md An example request using cursor-based pagination for retrieving large result sets. ```text GET /works?filter=publication_year:2024&cursor=*&per_page=100 ``` -------------------------------- ### Get Work by DOI Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/paper-lookup/references/crossref.md A concrete example of retrieving a work using an encoded DOI. ```text https://api.crossref.org/works/10.1038%2Fnature12373?mailto=you@example.com ``` -------------------------------- ### Start the Visual Companion Server Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/brainstorming/visual-companion.md Initializes the server with a project directory and opens the browser. The response includes the session URL and directory paths required for subsequent operations. ```bash # Start AFTER the user approves the companion. --open auto-opens their browser on # the first screen; --project-dir persists mockups and enables same-port restart. scripts/start-server.sh --project-dir /path/to/project --open # Returns: {"type":"server-started","port":52341, # "url":"http://localhost:52341/?key=ab12…", # "screen_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/content", # "state_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/state"} ``` -------------------------------- ### Search Works Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/paper-lookup/references/core.md A concrete example of a GET request to search for CRISPR gene therapy papers. ```http https://api.core.ac.uk/v3/search/works/?q=CRISPR+gene+therapy&limit=10 ``` -------------------------------- ### Install dependencies and configure API key Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/scientific-schematics/references/README.md Set up the environment by obtaining an OpenRouter API key and installing the required Python requests library. ```bash # Get OpenRouter API key # Visit: https://openrouter.ai/keys # Set environment variable export OPENROUTER_API_KEY='sk-or-v1-...' # Or add to .env file echo "OPENROUTER_API_KEY=sk-or-v1-..." >> .env # Install Python dependencies (if not already installed) pip install requests ``` -------------------------------- ### Testing setup instructions Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/writing-skills/testing-skills-with-subagents.md A template for setting up the agent's environment to ensure it treats the scenario as real work. ```markdown IMPORTANT: This is a real scenario. You must choose and act. Don't ask hypothetical questions - make the actual decision. You have access to: [skill-being-tested] ``` -------------------------------- ### Search Query Refinement Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/citation-management/references/google_scholar_search.md Examples of starting with broad search terms and refining them with specific filters. ```text # Too specific initially intitle:"deep learning" intitle:review source:Nature 2023..2024 # Better approach deep learning review # Review results # Add intitle:, source:, year filters as needed ``` -------------------------------- ### Define Skill Directory Structure Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/writing-skills/anthropic-best-practices.md Example of a modular skill directory containing main instructions, supplementary guides, and utility scripts. ```text pdf/ ├── SKILL.md # Main instructions (loaded when triggered) ├── FORMS.md # Form-filling guide (loaded as needed) ├── reference.md # API reference (loaded as needed) ├── examples.md # Usage examples (loaded as needed) └── scripts/ ├── analyze_form.py # Utility script (executed, not loaded) ├── fill_form.py # Form filling script └── validate.py # Validation script ``` -------------------------------- ### Circuit Diagram Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/scientific-schematics/references/QUICK_REFERENCE.md Generate an op-amp circuit diagram with specified components. ```bash python scripts/generate_schematic.py \ "Op-amp circuit with 1kΩ resistor and 10µF capacitor" \ -o circuit.png ``` -------------------------------- ### Verify Installation Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/scientific-schematics/references/QUICK_REFERENCE.md Run the test script to ensure the environment is configured correctly. ```bash # Verify installation python test_ai_generation.py # Should show: "6/6 tests passed" ``` -------------------------------- ### Create and enter the worktree Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/using-git-worktrees/SKILL.md Create a new worktree at the specified path and switch into it. ```bash # Determine path based on chosen location path="$LOCATION/$BRANCH_NAME" git worktree add "$path" -b "$BRANCH_NAME" cd "$path" ``` -------------------------------- ### Verbose PDF text extraction explanation Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/writing-skills/anthropic-best-practices.md An example of an overly verbose instruction set that provides unnecessary background information on PDF files and library installation. ```markdown ## Extract PDF text PDF (Portable Document Format) files are a common file format that contains text, images, and other content. To extract text from a PDF, you'll need to use a library. There are many libraries available for PDF processing, but we recommend pdfplumber because it's easy to use and handles most cases well. First, you'll need to install it using pip. Then you can use the code below... ``` -------------------------------- ### Skill Directory Structure Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/writing-skills/anthropic-best-practices.md A recommended directory layout for a skill, demonstrating how to organize reference files to enable progressive disclosure and minimize context token usage. ```text bigquery-skill/ ├── SKILL.md (overview, points to reference files) └── reference/ ├── finance.md (revenue metrics) ├── sales.md (pipeline data) └── product.md (usage analytics) ``` -------------------------------- ### curl API Request with Headers Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/paper-lookup/SKILL.md Example of using curl to perform a GET request to the Semantic Scholar API, including required headers for JSON acceptance and API key authentication. ```bash curl -s -H "Accept: application/json" -H "x-api-key: $S2_API_KEY" \ "https://api.semanticscholar.org/graph/v1/paper/DOI:10.1038/nature12373?fields=title,year,citationCount,tldr" ``` -------------------------------- ### Clarification Request Example (Good) Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/receiving-code-review/SKILL.md An example of how to handle unclear instructions by identifying what is understood and asking for clarification on the rest. ```text your human partner: "Fix items 1-6" You understand 1,2,3,6. Unclear on 4,5. ✅ "Understand 1,2,3,6. Need clarification on 4 and 5 before implementing." ``` -------------------------------- ### Install Dependencies Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/scientific-schematics/references/QUICK_REFERENCE.md Install required Python packages. ```bash # Install requests pip install requests ``` -------------------------------- ### CLI Help and Debugging Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/scientific-schematics/references/QUICK_REFERENCE.md Access help documentation or run in verbose mode for debugging. ```bash # Show help python scripts/generate_schematic.py --help # Verbose mode for debugging python scripts/generate_schematic.py "diagram" -o out.png -v ``` -------------------------------- ### arXiv Category Examples Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/citation-management/references/metadata_extraction.md Examples of arXiv subject categories. ```text cs.LG # Computer Science - Machine Learning q-bio.QM # Quantitative Biology - Quantitative Methods math.ST # Mathematics - Statistics ``` -------------------------------- ### Launch Server with Copilot CLI Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/brainstorming/visual-companion.md Uses the platform's background execution mechanism while maintaining --foreground to allow the harness to manage the process. ```bash # Start it with Copilot CLI's non-blocking/background shell mechanism so the # server survives across turns. Keep --foreground so the harness, not the # script, owns backgrounding. The launcher is a .sh, so invoke it via bash # (on Windows, call Git Bash's bash.exe from the PowerShell tool). bash scripts/start-server.sh --project-dir /path/to/project --open --foreground ``` -------------------------------- ### @incollection BibTeX Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/citation-management/references/bibtex_formatting.md Example of a book chapter citation. ```bibtex @incollection{Brown2020, author = {Brown, Peter O. and Botstein, David}, title = {Exploring the New World of the Genome with {DNA} Microarrays}, booktitle = {DNA Microarrays: A Molecular Cloning Manual}, editor = {Eisen, Michael B. and Brown, Patrick O.}, publisher = {Cold Spring Harbor Laboratory Press}, year = {2020}, pages = {1--45}, address = {Cold Spring Harbor, NY} } ``` -------------------------------- ### Valid URL Examples Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/citation-management/references/citation_validation.md Examples of valid, permanent HTTPS URLs. ```bibtex url = {https://www.nature.com/articles/nature12345} url = {https://arxiv.org/abs/2103.14030} ``` -------------------------------- ### Shallow reference structure (Good Example) Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/writing-skills/anthropic-best-practices.md Keep all reference files linked directly from SKILL.md to ensure agents can access complete information. ```markdown # SKILL.md **Basic usage**: [instructions in SKILL.md] **Advanced features**: See [advanced.md](advanced.md) **API reference**: See [reference.md](reference.md) **Examples**: See [examples.md](examples.md) ``` -------------------------------- ### @book BibTeX Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/citation-management/references/bibtex_formatting.md Example of a book citation for a medical textbook. ```bibtex @book{Kumar2021, author = {Kumar, Vinay and Abbas, Abul K. and Aster, Jon C.}, title = {Robbins and Cotran Pathologic Basis of Disease}, publisher = {Elsevier}, year = {2021}, edition = {10}, address = {Philadelphia, PA}, isbn = {978-0-323-53113-9} } ``` -------------------------------- ### Code review request workflow example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/requesting-code-review/SKILL.md A practical example showing the sequence of identifying SHAs, dispatching the subagent, and processing the returned assessment. ```text [Just completed Task 2: Add verification function] You: Let me request code review before proceeding. BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}') HEAD_SHA=$(git rev-parse HEAD) [Dispatch code reviewer subagent] DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types PLAN_OR_REQUIREMENTS: Task 2 from docs/superpowers/plans/deployment-plan.md BASE_SHA: a7981ec HEAD_SHA: 3df7661 [Subagent returns]: Strengths: Clean architecture, real tests Issues: Important: Missing progress indicators Minor: Magic number (100) for reporting interval Assessment: Ready to proceed You: [Fix progress indicators] [Continue to Task 3] ``` -------------------------------- ### Present Normal Repository Options Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/finishing-a-development-branch/SKILL.md Display these three options when working in a normal repository. ```text Implementation complete. What would you like to do? 1. Merge back to locally 2. Push and create a Pull Request 3. Keep the branch as-is (I'll handle it later) Which option? ``` -------------------------------- ### Vague description examples Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/writing-skills/anthropic-best-practices.md Examples of descriptions to avoid due to lack of specificity. ```yaml description: Helps with documents ``` ```yaml description: Processes data ``` ```yaml description: Does stuff with files ``` -------------------------------- ### PMCID Format Examples Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/citation-management/references/metadata_extraction.md Examples of PubMed Central ID (PMCID) identifiers. ```text PMC8287551 PMC7456789 ``` -------------------------------- ### Subagent-Driven Development Workflow Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/subagent-driven-development/SKILL.md A comprehensive example of the SDD workflow, demonstrating task dispatching, implementer interaction, review cycles, and ledger management. ```text You: I'm using Subagent-Driven Development to execute this plan. [Setup: worktree verified] [Read plan file once: docs/superpowers/plans/feature-plan.md] [Resolve workspace: scripts/sdd-workspace docs/superpowers/plans/feature-plan.md — no ledger inside, fresh start] [Create todos for all tasks] Task 1: Hook installation script [Run task-brief for Task 1; dispatch implementer with brief + report paths + context] Implementer: "Before I begin - should the hook be installed at user or system level?" You: "User level (~/.config/superpowers/hooks/)" Implementer: [Later] - Implemented install-hook command - Added tests, 5/5 passing - Self-review: Found I missed --force flag, added it - Committed [Run review-package PLAN_FILE BASE HEAD; dispatch task reviewer with the printed path] Task reviewer: Spec ✅ - all requirements met, nothing extra. Strengths: Good test coverage, clean. Issues: None. Task quality: Approved. [Ledger: Task 1: complete (commits a1b2c3d..d4e5f6a, review clean)] Task 2: Recovery modes [Run task-brief for Task 2; dispatch implementer with brief + report paths + context] Implementer: [No questions] - Added verify/repair modes - 8/8 tests passing - Committed [Run review-package PLAN_FILE BASE HEAD; dispatch task reviewer with the printed path] Task reviewer: Spec ❌: - Missing: Progress reporting (spec says "report every 100 items") Issues (Important): Magic number (100) [Fix round 1: resume the implementer with both findings] Implementer: Added progress reporting, extracted PROGRESS_INTERVAL constant. Re-ran test/recovery.test.js — 10/10 passing. Fix report appended. [Run review-package PLAN_FILE FIX_BASE HEAD; dispatch scoped re-review] Re-reviewer: Missing progress reporting — ADDRESSED (src/recovery.js:41). Magic number — ADDRESSED (src/recovery.js:7). New breakage: none. Verdict: all findings addressed. [Ledger: Task 2: fix round 1/5 (2 addressed, 0 open; commits d4e5f6a..b7c8d9e)] [Ledger: Task 2: complete (commits d4e5f6a..b7c8d9e, review clean)] ... [After all tasks] [Run review-package PLAN_FILE MERGE_BASE HEAD; dispatch final code-reviewer, most capable model] Final reviewer: All requirements met. Deferred minors triaged: none block merge. [Delete this plan's workspace — the record now lives in git] Done! Using superpowers:finishing-a-development-branch. ``` -------------------------------- ### PMID Format Examples Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/citation-management/references/metadata_extraction.md Examples of PubMed ID (PMID) numeric identifiers. ```text 34265844 28445112 35476778 ``` -------------------------------- ### @article BibTeX Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/citation-management/references/bibtex_formatting.md Example of a journal article citation for the AlphaFold paper. ```bibtex @article{Jumper2021, author = {Jumper, John and Evans, Richard and Pritzel, Alexander and others}, title = {Highly Accurate Protein Structure Prediction with {AlphaFold}}, journal = {Nature}, year = {2021}, volume = {596}, number = {7873}, pages = {583--589}, doi = {10.1038/s41586-021-03819-2} } ``` -------------------------------- ### Biological Pathway Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/scientific-schematics/references/QUICK_REFERENCE.md Generate a MAPK signaling pathway diagram. ```bash python scripts/generate_schematic.py \ "MAPK pathway: EGFR → RAS → RAF → MEK → ERK" \ -o mapk.png ``` -------------------------------- ### Move details to tool help Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/writing-skills/SKILL.md Avoid documenting all flags in SKILL.md. Instead, reference the --help command to save tokens. ```bash # ❌ BAD: Document all flags in SKILL.md search-conversations supports --text, --both, --after DATE, --before DATE, --limit N # ✅ GOOD: Reference --help search-conversations supports multiple modes and filters. Run --help for details. ``` -------------------------------- ### DOI Lookup Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/paper-lookup/references/biorxiv.md Example request for retrieving metadata for a specific preprint DOI. ```text https://api.biorxiv.org/details/biorxiv/10.1101/2024.01.16.575895/na/json ``` -------------------------------- ### Using simulate_power and find_sample_size Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/statistical-power/references/simulation_based_power.md Demonstrates how to use the simulation harness by defining a gen_and_test function to calculate power for a fixed sample size or search for the sample size required to achieve a target power. ```python from simulate_power import simulate_power, find_sample_size def gen_and_test(n, rng): # ... simulate n observations under the assumed effect ... # ... fit the planned model ... return pvalue < 0.05 # power at a fixed n print(simulate_power(gen_and_test, n=200, n_sims=2000)) # search for the n that hits 80% power n, est = find_sample_size(gen_and_test, target_power=0.80, n_sims=2000) ``` -------------------------------- ### Duplicate Detection Output Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/citation-management/references/citation_validation.md Example output generated when duplicate entries are detected. ```text Warning: Possible duplicate entries: - Smith2024a (DOI: 10.1038/nature12345) - Smith2024b (DOI: 10.1038/nature12345) Recommendation: Keep one entry, remove the other. ``` -------------------------------- ### Configure Skill Metadata and Documentation Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/experts/skills/writing-skills/anthropic-best-practices.md A SKILL.md file using YAML frontmatter for metadata and markdown for instructions, including references to external documentation files. ```markdown --- name: PDF Processing description: Extracts text and tables from PDF files, fills forms, and merges documents. Use when working with PDF files or when the user mentions PDFs, forms, or document extraction. --- # PDF Processing ## Quick start Extract text with pdfplumber: ```python import pdfplumber with pdfplumber.open("file.pdf") as pdf: text = pdf.pages[0].extract_text() ``` ## Advanced features **Form filling**: See [FORMS.md](FORMS.md) for complete guide **API reference**: See [REFERENCE.md](REFERENCE.md) for all methods **Examples**: See [EXAMPLES.md](EXAMPLES.md) for common patterns ``` -------------------------------- ### File Type Detection Example Source: https://github.com/xintaofei/codeg/blob/main/src-tauri/science/skills/exploratory-data-analysis/SKILL.md An example of how the system processes a user-provided file path to identify its extension, category, and format. ```text User: "Analyze data.fastq" → Extension: .fastq → Category: bioinformatics_genomics → Format: FASTQ Format (sequence data with quality scores) → Reference: references/bioinformatics_genomics_formats.md ```