### Install a Complete Workflow (Bash) Source: https://github.com/nicepkg/ai-workflow/blob/main/README.md Installs a complete AI workflow with a single command. This is the recommended method for getting started quickly. After installation, the skills become active in your AI assistant. ```bash # Pick your workflow and run ONE command: npx add-skill nicepkg/ai-workflow/workflows/content-creator-workflow # That's it! Skills are now active in your AI assistant. ``` -------------------------------- ### Automatic Dependency Installation Configuration (JSON) Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/claude-code-on-the-web.md Configures automatic dependency installation using SessionStart hooks in the .claude/settings.json file. This ensures necessary packages are installed when a session starts. ```json { "hooks": { "SessionStart": [ { "matcher": "startup", "hooks": [ { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/scripts/install_pkgs.sh" } ] } ] } } ``` -------------------------------- ### Use Installed Plugin Command Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/discover-plugins.md This command demonstrates how to invoke a command provided by an installed plugin. 'commit-commands:commit' is an example command from the 'commit-commands' plugin, used here to stage changes, generate a commit message, and create a commit. ```bash /commit-commands:commit ``` -------------------------------- ### Advanced Installation Options (Bash) Source: https://github.com/nicepkg/ai-workflow/blob/main/README.md Provides advanced options for installing workflows, including global installation, targeting specific AI tools, and non-interactive mode for CI/CD pipelines. These options offer greater control over the installation process. ```bash # Install globally (available in all projects) npx add-skill nicepkg/ai-workflow/workflows/video-creator-workflow --global # Install to specific AI tools only npx add-skill nicepkg/ai-workflow/workflows/content-creator-workflow -a claude-code -a cursor # Non-interactive mode (for CI/CD) npx add-skill nicepkg/ai-workflow/workflows/marketing-pro-workflow -y ``` -------------------------------- ### Install Individual Skills (Bash) Source: https://github.com/nicepkg/ai-workflow/blob/main/README.md Allows installation of specific skills within a workflow or listing available skills. This provides flexibility to add only the necessary functionalities. Use the --list flag to see available skills before installing. ```bash # Install just what you need npx add-skill nicepkg/ai-workflow/workflows/stock-trader-workflow --skill a-share-analysis # List available skills first npx add-skill nicepkg/ai-workflow/workflows/marketing-pro-workflow --list ``` -------------------------------- ### Custom GitHub App Integration Example Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/github-actions.md Illustrates the manual setup for integrating a custom GitHub App with Claude Code Action. This involves creating a GitHub App, granting necessary permissions (contents, issues, pull requests), and using the `actions/create-github-app-token` action to generate tokens within workflows for API access. ```yaml steps: - name: Checkout code uses: actions/checkout@v4 - name: Generate GitHub App Token id: app_token uses: actions/create-github-app-token@v1 with: owner: "your-github-username" app-id: "your-app-id" private-key: "${{ secrets.APP_PRIVATE_KEY }}" - name: Run Claude Code Action uses: anthropics/claude-code-action@v1 with: anthropic_api_key: "${{ secrets.ANTHROPIC_API_KEY }}" github_token: "${{ steps.app_token.outputs.token }}" prompt: "Review this code for potential issues." ``` -------------------------------- ### Example: Allow Specific Marketplaces Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/settings.md Configuration example demonstrating how to allow a curated list of specific plugin marketplaces using `strictKnownMarketplaces`. ```bash { "strictKnownMarketplaces": [ { "source": "github", "repo": "acme-corp/approved-plugins" }, { "source": "github", "repo": "acme-corp/security-tools", "ref": "v2.0" }, { "source": "url", "url": "https://plugins.example.com/marketplace.json" }, { "source": "npm", "package": "@acme-corp/compliance-plugins" } ] } ``` -------------------------------- ### Setup Repository and Branching Source: https://github.com/nicepkg/ai-workflow/blob/main/website/content/en/docs/contributing.mdx Commands to clone the AI Workflow repository and initialize a new feature branch for development. This is the standard starting point for all contributors. ```bash git clone https://github.com/your-username/ai-workflow.git cd ai-workflow git checkout -b feature/my-contribution ``` -------------------------------- ### Example New Product Initiative Workflow (Text) Source: https://github.com/nicepkg/ai-workflow/blob/main/workflows/product-manager-workflow/README.md Demonstrates a step-by-step example workflow for a new product initiative, illustrating the application of various PM skills in sequence. This is a text-based example. ```text 1. "I have a new feature request for user data export, run work-intake" 2. "Plan user research to validate this need" 3. "Analyze customer feedback about data export" 4. "Generate a PRD for the data export feature" 5. "Prioritize against current backlog using effort-impact" 6. "Create implementation plan" ``` -------------------------------- ### Example Documentation Skill Source: https://github.com/nicepkg/ai-workflow/blob/main/website/content/en/docs/creating-skills.mdx Provides a complete markdown example of a 'write-docs' skill, including metadata, overview, instructions, output format, and a code example with its generated documentation. ```markdown --- name: write-docs description: Generate documentation for code triggers: - "document this" - "write docs" - "add documentation" --- # Documentation Generator ## Overview Generates comprehensive documentation for code files, functions, and modules. ## Instructions ### Step 1: Analyze the Code - Identify the purpose of the code - Note all public functions and classes - Understand the input/output types ### Step 2: Generate Documentation - Write a module-level docstring - Document each public function - Include parameter types and return values - Add usage examples ### Step 3: Review - Ensure documentation is accurate - Check for completeness - Verify examples work ## Output Format Use the project's existing documentation style. Default to: - JSDoc for JavaScript/TypeScript - Docstrings for Python - XML comments for C# ## Example Input: ```python def calculate_total(items, tax_rate): subtotal = sum(item.price for item in items) return subtotal * (1 + tax_rate) ``` Output: ```python def calculate_total(items: list[Item], tax_rate: float) -> float: """ Calculate the total price including tax. Args: items: List of items to calculate total for tax_rate: Tax rate as a decimal (e.g., 0.08 for 8%) Returns: Total price including tax Example: >>> items = [Item(price=10), Item(price=20)] >>> calculate_total(items, 0.08) 32.4 """ subtotal = sum(item.price for item in items) return subtotal * (1 + tax_rate) ``` ``` -------------------------------- ### Install a Plugin using CLI (Bash) Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/plugins-reference.md This bash command installs a specified plugin from available marketplaces. It supports installing to different scopes: 'user' (default), 'project', or 'local', allowing for flexible plugin management in various environments. ```bash # Install to user scope (default) claude plugin install formatter@my-marketplace # Install to project scope (shared with team) claude plugin install formatter@my-marketplace --scope project # Install to local scope (gitignored) claude plugin install formatter@my-marketplace --scope local ``` -------------------------------- ### Install Workflow via NPX Source: https://github.com/nicepkg/ai-workflow/blob/main/website/content/en/docs/creating-workflows.mdx Command to install a published workflow into an existing project environment. ```bash npx add-skill nicepkg/ai-workflow/workflows/your-workflow ``` -------------------------------- ### Claude Code Hooks Configuration Schema Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/hooks-guide.md The JSON structure for defining hooks in the ~/.claude/settings.json file. This example demonstrates a PreToolUse hook filtered by a Bash matcher. ```json { "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [ { "type": "command", "command": "jq -r '\"\\(.tool_input.command) - \\(.tool_input.description // \"No description\")\"' >> ~/.claude/bash-command-log.txt" } ] } ] } } ``` -------------------------------- ### Create a personal command Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/slash-commands.md Demonstrates how to initialize a custom command by creating a directory and a markdown file in the user's configuration path. ```bash mkdir -p ~/.claude/commands echo "Review this code for security vulnerabilities:" > ~/.claude/commands/security-review.md ``` -------------------------------- ### Add and Install Local Marketplace and Plugin (CLI) Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/plugin-marketplaces.md Demonstrates the command-line interface commands to add a local plugin marketplace and then install a specific plugin from that marketplace. This is how users would integrate your marketplace and its plugins into their environment. ```bash /plugin marketplace add ./my-marketplace /plugin install review-plugin@my-plugins ``` -------------------------------- ### Plugin Source Configuration Example Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/plugin-marketplaces.md Example of how to configure a plugin source using GitHub in a marketplace configuration. This is a recommended alternative to relative paths for URL-based marketplaces. ```json { "name": "my-plugin", "source": { "source": "github", "repo": "owner/repo" } } ``` -------------------------------- ### Verify Hook Logs Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/hooks-guide.md Commands to display the contents of the generated log file to verify that the hook is capturing tool execution data correctly. ```bash cat ~/.claude/bash-command-log.txt ``` -------------------------------- ### Install Prerequisites for Media Processing Source: https://github.com/nicepkg/ai-workflow/blob/main/website/content/en/workflows/video-creator.mdx Installs essential media handling tools and local transcription libraries. Requires Homebrew for system dependencies and pip for Python-based AI models. ```bash # Required for media skills brew install yt-dlp ffmpeg # Optional: Local transcription pip install whisperkit ``` -------------------------------- ### Add Demo Marketplace to Claude Code Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/discover-plugins.md This command adds the 'anthropics/claude-code' demo marketplace to your Claude Code environment. It downloads the marketplace catalog, making its plugins available for browsing and installation. This is a prerequisite for using the example plugins. ```bash /plugin marketplace add anthropics/claude-code ``` -------------------------------- ### Install nicepkg/ai-workflow Skills (Bash) Source: https://github.com/nicepkg/ai-workflow/blob/main/website/content/en/workflows/talk-to-slidev.mdx Provides bash commands for installing the nicepkg/ai-workflow, either globally or specific skills. It also includes a command to list available skills. ```bash # Install globally npx add-skill nicepkg/ai-workflow/workflows/talk-to-slidev-workflow --global # Install specific skill npx add-skill nicepkg/ai-workflow/workflows/talk-to-slidev-workflow --skill slidev-presentations # List all skills npx add-skill nicepkg/ai-workflow/workflows/talk-to-slidev-workflow --list ``` -------------------------------- ### Upgrade Claude Code via Homebrew (macOS) Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/claude-code-llms.txt Upgrades an existing Claude Code installation managed by Homebrew on macOS. Run this periodically to get the latest features and security fixes. ```bash brew upgrade claude-code ``` -------------------------------- ### Start Claude Code in a project directory Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/claude-code-llms.txt Navigates to a project directory and initiates the Claude Code application. This command is used after installation to begin using Claude Code within your project's context. ```bash cd your-awesome-project claude ``` -------------------------------- ### Refactor Code with Modern Patterns Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/claude-code-llms.txt Guide to refactoring legacy code using modern patterns and practices with AI assistance. Includes identifying code, getting recommendations, applying changes, and verifying with tests. ```bash > find deprecated API usage in our codebase ``` ```bash > suggest how to refactor utils.js to use modern JavaScript features ``` ```bash > refactor utils.js to use ES2024 features while maintaining the same behavior ``` ```bash > run tests for the refactored code ``` -------------------------------- ### Configure Skill with Metadata and Substitutions Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/skills.md Demonstrates the use of YAML frontmatter to define skill metadata and the inclusion of dynamic variables like session IDs and arguments within the skill content. ```yaml --- name: session-logger description: Log activity for this session --- Log the following to logs/${CLAUDE_SESSION_ID}.log: $ARGUMENTS ``` -------------------------------- ### Send Desktop Notifications for Input Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/hooks-guide.md This hook provides custom desktop notifications when Claude requires user input. It uses the `notify-send` command to display a message on the desktop, alerting the user to provide necessary input. ```json { "hooks": { "Notification": [ { "matcher": "", "hooks": [ { "type": "command", "command": "notify-send 'Claude Code' 'Awaiting your input'" } ] } ] } } ``` -------------------------------- ### Reference files in commands Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/slash-commands.md Demonstrates how to include file contents in command prompts using the @ prefix to provide context to the AI. ```text # Reference a specific file Review the implementation in @src/utils/helpers.js # Reference multiple files Compare @src/old-version.js with @src/new-version.js ``` -------------------------------- ### Log Bash Commands via Claude Code Hook Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/hooks-guide.md A command-line snippet using jq to log executed bash commands and their descriptions to a local text file. This is intended for use within the PreToolUse hook configuration. ```bash jq -r '"\(.tool_input.command) - \(.tool_input.description // "No description")"' >> ~/.claude/bash-command-log.txt ``` -------------------------------- ### Format TypeScript Files Automatically Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/hooks-guide.md This hook automatically formats TypeScript files after they are edited or written. It uses `jq` to extract the file path and then `prettier` to format the file if it has a .ts extension. This ensures consistent code style across the project. ```json { "hooks": { "PostToolUse": [ { "matcher": "Edit|Write", "hooks": [ { "type": "command", "command": "jq -r '.tool_input.file_path' | { read file_path; if echo \"$file_path\" | grep -q '\\.ts$'; then npx prettier --write \"$file_path\"; fi; }" } ] } ] } } ``` -------------------------------- ### Implement Multi-file Skills with Python Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/skills.md Demonstrates a complex Skill structure using supporting documentation and utility scripts, including Python code for PDF processing. ```python import pdfplumber with pdfplumber.open("doc.pdf") as pdf: text = pdf.pages[0].extract_text() ``` ```bash pip install pypdf pdfplumber ``` -------------------------------- ### Non-Matching Git Source Examples Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/settings.md Illustrates examples of Git sources that will NOT match due to differences in 'repo', 'ref', or 'path' fields, highlighting the exact matching requirement. ```json // These are DIFFERENT sources: { "source": "github", "repo": "acme-corp/plugins" } { "source": "github", "repo": "acme-corp/plugins", "ref": "main" } // These are also DIFFERENT: { "source": "github", "repo": "acme-corp/plugins", "path": "marketplace" } { "source": "github", "repo": "acme-corp/plugins" } ``` -------------------------------- ### Block Edits to Sensitive Files Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/hooks-guide.md This hook prevents edits to sensitive files by checking the file path before any edit or write operation. It uses a Python one-liner to exit with a non-zero status if the file path contains sensitive patterns like '.env', 'package-lock.json', or '.git/'. ```json { "hooks": { "PreToolUse": [ { "matcher": "Edit|Write", "hooks": [ { "type": "command", "command": "python3 -c \"import json, sys; data=json.load(sys.stdin); path=data.get('tool_input',{}).get('file_path',''); sys.exit(2 if any(p in path for p in ['.env', 'package-lock.json', '.git/']) else 0)\"" } ] } ] } } ``` -------------------------------- ### Create Directory Structure for Plugin Marketplace Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/plugin-marketplaces.md Sets up the necessary directories for a local plugin marketplace and a sample plugin. This includes the main marketplace directory, a hidden .claude-plugin directory for configuration, a plugins directory, and a specific plugin directory with its own .claude-plugin and commands subdirectories. ```bash mkdir -p my-marketplace/.claude-plugin mkdir -p my-marketplace/plugins/review-plugin/.claude-plugin mkdir -p my-marketplace/plugins/review-plugin/commands ``` -------------------------------- ### Install Plugin from Command Line Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/discover-plugins.md This command directly installs a specific plugin, 'commit-commands', from the 'anthropics-claude-code' marketplace. The '@' symbol specifies the marketplace source. This bypasses the need to browse through the UI. ```bash /plugin install commit-commands@anthropics-claude-code ``` -------------------------------- ### Format Markdown Files Automatically Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/hooks-guide.md This hook automatically formats markdown files, fixing missing language tags in code blocks and correcting excessive blank lines. It relies on a Python script (`markdown_formatter.py`) to perform the actual formatting. The script detects languages and applies formatting rules. ```json { "hooks": { "PostToolUse": [ { "matcher": "Edit|Write", "hooks": [ { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/markdown_formatter.py" } ] } ] } } ``` ```python #!/usr/bin/env python3 """ Markdown formatter for Claude Code output. Fixes missing language tags and spacing issues while preserving code content. """ import json import sys import re import os def detect_language(code): """Best-effort language detection from code content.""" s = code.strip() # JSON detection if re.search(r'^\s*[\{\[]', s): try: json.loads(s) return 'json' except: pass # Python detection if re.search(r'^\s*def\s+\w+\s*\(', s, re.M) or \ re.search(r'^\s*(import|from)\s+\w+', s, re.M): return 'python' # JavaScript detection if re.search(r'\b(function\s+\w+\s*\(|const\s+\w+\s*=)', s) or \ re.search(r'=>|console\.(log|error)', s): return 'javascript' # Bash detection if re.search(r'^#!.*\b(bash|sh)\b', s, re.M) or \ re.search(r'\b(if|then|fi|for|in|do|done)\b', s): return 'bash' # SQL detection if re.search(r'\b(SELECT|INSERT|UPDATE|DELETE|CREATE)\s+', s, re.I): return 'sql' return 'text' def format_markdown(content): """Format markdown content with language detection.""" # Fix unlabeled code fences def add_lang_to_fence(match): indent, info, body, closing = match.groups() if not info.strip(): lang = detect_language(body) return f"{indent}```{lang}\n{body}{closing}\n" return match.group(0) fence_pattern = r'(?ms)^([ \t]{0,3})```([^\n]*)\n(.*?)(\n\1```)\s*$' content = re.sub(fence_pattern, add_lang_to_fence, content) # Fix excessive blank lines (only outside code fences) content = re.sub(r'\n{3,}', '\n\n', content) return content.rstrip() + '\n' # Main execution try: input_data = json.load(sys.stdin) file_path = input_data.get('tool_input', {}).get('file_path', '') if not file_path.endswith(('.md', '.mdx')): sys.exit(0) # Not a markdown file if os.path.exists(file_path): with open(file_path, 'r', encoding='utf-8') as f: content = f.read() formatted = format_markdown(content) if formatted != content: with open(file_path, 'w', encoding='utf-8') as f: f.write(formatted) print(f"✓ Fixed markdown formatting in {file_path}") except Exception as e: print(f"Error formatting markdown: {e}", file=sys.stderr) sys.exit(1) ``` -------------------------------- ### Guide Claude to Ask Clarifying Questions Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/common-workflows.md Provides instructions to Claude AI, typically within a 'CLAUDE.md' file, to encourage it to ask clarifying questions when multiple valid approaches exist for a task. This promotes more robust solutions. ```bash Always ask clarifying questions when there are multiple valid approaches to a task. ``` -------------------------------- ### Install Claude Code (macOS, Linux, WSL) Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/overview.md Installs Claude Code using a curl command to download and execute an installation script. This is the recommended native installation method for macOS, Linux, and Windows Subsystem for Linux (WSL). Native installations automatically update in the background. ```bash curl -fsSL https://claude.ai/install.sh | bash ``` -------------------------------- ### Fix WSL npm OS Detection for Claude Code Installation Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/troubleshooting.md When encountering OS/platform detection issues in WSL during Claude Code installation, this command can be used to force the installation to recognize the Linux environment. It bypasses OS checks and ensures the correct installation. Do not use sudo with this command. ```bash npm config set os linux npm install -g @anthropic-ai/claude-code --force --no-os-check ``` -------------------------------- ### Install Claude Code (WinGet) Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/overview.md Installs Claude Code using the Windows Package Manager (WinGet). This command installs the 'Anthropic.ClaudeCode' package. WinGet installations do not auto-update, requiring periodic manual upgrades. ```bash winget install Anthropic.ClaudeCode ``` -------------------------------- ### Install Content Creator Workflow Skills via CLI Source: https://github.com/nicepkg/ai-workflow/blob/main/workflows/content-creator-workflow/README.md Use the npx command to install the full suite of 32 content creation skills or specific individual skills into your project. This requires a Node.js environment and the add-skill utility. ```bash # Install all 32 skills with one command npx add-skill nicepkg/ai-workflow/workflows/content-creator-workflow # Or install specific skills npx add-skill nicepkg/ai-workflow/workflows/content-creator-workflow --skill blog-post-writer ``` -------------------------------- ### Install Claude Code (Homebrew) Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/overview.md Installs Claude Code using the Homebrew package manager on macOS. This command installs the 'claude-code' cask. Homebrew installations do not auto-update, requiring periodic manual upgrades. ```bash brew install --cask claude-code ``` -------------------------------- ### Manual Workflow Directory and File Setup Source: https://github.com/nicepkg/ai-workflow/blob/main/website/content/en/docs/creating-workflows.mdx Creates the necessary directory structure, configuration files, and documentation stubs for a custom workflow. ```bash mkdir -p workflows/my-workflow/.claude/skills echo '{"permissions": {}}' > workflows/my-workflow/.claude/settings.json touch workflows/my-workflow/README.md touch workflows/my-workflow/AGENTS.md ``` -------------------------------- ### Example: Disable All Marketplace Additions Source: https://github.com/nicepkg/ai-workflow/blob/main/claude-code-docs/docs/settings.md Configuration example showing how to completely disable users from adding any new plugin marketplaces by setting `strictKnownMarketplaces` to an empty array. ```bash { "strictKnownMarketplaces": [] } ```