### JSON Server Quick Setup and Usage Source: https://github.com/curiouslearner/devkit/blob/main/skills/mock-server/SKILL.md Provides instructions for installing JSON Server, creating a simple db.json file for mock data, and starting the mock server. It also includes examples of common RESTful API operations (GET, POST, PUT, PATCH, DELETE) and query parameter usage. ```bash # Install npm install -g json-server # Create db.json cat > db.json << EOF { "users": [ { "id": 1, "name": "John Doe", "email": "john@example.com" }, { "id": 2, "name": "Jane Smith", "email": "jane@example.com" } ], "posts": [ { "id": 1, "title": "Hello World", "userId": 1 }, { "id": 2, "title": "Mock APIs", "userId": 2 } ] } EOF # Start server json-server --watch db.json --port 3000 ``` ```bash # GET all users curl http://localhost:3000/users # GET user by ID curl http://localhost:3000/users/1 # POST new user curl -X POST http://localhost:3000/users \ -H "Content-Type: application/json" \ -d '{"name": "Bob", "email": "bob@example.com"}' # PUT update user curl -X PUT http://localhost:3000/users/1 \ -H "Content-Type: application/json" \ -d '{"id": 1, "name": "John Updated", "email": "john.new@example.com"}' # PATCH partial update curl -X PATCH http://localhost:3000/users/1 \ -H "Content-Type: application/json" \ -d '{"name": "John Patched"}' # DELETE user curl -X DELETE http://localhost:3000/users/1 # Query parameters curl "http://localhost:3000/users?_page=1&_limit=10" curl "http://localhost:3000/users?_sort=name&_order=asc" curl "http://localhost:3000/posts?userId=1" ``` -------------------------------- ### Basic Project Setup with venv Source: https://github.com/curiouslearner/devkit/blob/main/skills/python-venv-manager/SKILL.md Provides a step-by-step guide to setting up a basic Python project using the `venv` module. It includes creating a project directory, setting up the virtual environment, installing dependencies, and creating a `.gitignore` file. ```bash # Create project directory mkdir my-project cd my-project # Create virtual environment python3 -m venv venv # Activate environment source venv/bin/activate # Linux/Mac # or virtualenv\Scripts\activate # Windows # Upgrade pip pip install --upgrade pip # Install dependencies pip install requests pytest black flake8 # Freeze dependencies pip freeze > requirements.txt # Create .gitignore cat > .gitignore << EOF venv/ __pycache__/ *.pyc *.pyo *.pyd .Python *.so *.egg *.egg-info/ dist/ build/ .pytest_cache/ .coverage htmlcov/ .env .venv EOF ``` -------------------------------- ### Basic GET Request Examples (Bash, JavaScript, Python) Source: https://github.com/curiouslearner/devkit/blob/main/skills/api-tester/SKILL.md Demonstrates how to perform basic GET requests to an API endpoint using curl, JavaScript (fetch and axios), and Python (requests). Includes examples for authentication, query parameters, and verbose output. ```bash # curl curl -X GET https://api.example.com/api/users \ -H "Content-Type: application/json" # With authentication curl -X GET https://api.example.com/api/users \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" # With query parameters curl -X GET "https://api.example.com/api/users?page=1&limit=10&sort=created_at" \ -H "Authorization: Bearer YOUR_TOKEN" # Verbose output (includes headers) curl -v -X GET https://api.example.com/api/users ``` ```javascript // Using fetch async function getUsers() { const response = await fetch('https://api.example.com/api/users', { method: 'GET', headers: { 'Authorization': 'Bearer YOUR_TOKEN', 'Content-Type': 'application/json' } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); return data; } // Using axios const axios = require('axios'); async function getUsers() { try { const response = await axios.get('https://api.example.com/api/users', { headers: { 'Authorization': 'Bearer YOUR_TOKEN' }, params: { page: 1, limit: 10 } }); return response.data; } catch (error) { console.error('Error:', error.response?.data || error.message); throw error; } } ``` ```python import requests # Basic GET request response = requests.get('https://api.example.com/api/users') print(response.json()) # With authentication and parameters headers = { 'Authorization': 'Bearer YOUR_TOKEN', 'Content-Type': 'application/json' } params = { 'page': 1, 'limit': 10, 'sort': 'created_at' } response = requests.get( 'https://api.example.com/api/users', headers=headers, params=params ) if response.status_code == 200: data = response.json() print(data) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### Mock Service Worker (MSW) Setup Source: https://github.com/curiouslearner/devkit/blob/main/skills/mock-server/SKILL.md Details the initial setup step for Mock Service Worker (MSW), a popular library for mocking API requests at the network level. It shows the command to install MSW as a development dependency. ```bash npm install --save-dev msw ``` -------------------------------- ### Onboarding Guide Template (Markdown) Source: https://github.com/curiouslearner/devkit/blob/main/skills/onboarding-helper/SKILL.md A comprehensive template for onboarding documentation, covering project overview, technology stack, day 1 tasks, environment setup, and team processes. It is written in Markdown for easy rendering and customization. ```markdown # Welcome to [Project Name]! 👋 Welcome! We're excited to have you on the team. This guide will help you get up to speed quickly and smoothly. ## Table of Contents 1. [Overview](#overview) 2. [Day 1: Getting Started](#day-1-getting-started) 3. [Week 1: Core Concepts](#week-1-core-concepts) 4. [Month 1: Making Impact](#month-1-making-impact) 5. [Team & Processes](#team--processes) 6. [Resources](#resources) 7. [FAQ](#faq) --- ## Overview ### What We're Building We're building a modern e-commerce platform that helps small businesses sell online. Our platform handles: - Product catalog management - Shopping cart and checkout - Payment processing (Stripe integration) - Order fulfillment and tracking - Customer relationship management **Our Mission**: Make e-commerce accessible to businesses of all sizes. **Our Users**: Small to medium business owners with 10-1000 products. ### Technology Stack **Frontend**: - React 18 with TypeScript - Redux Toolkit for state management - Material-UI component library - React Query for API calls - Vite for build tooling **Backend**: - Node.js with Express - PostgreSQL database - Redis for caching - Stripe for payments - AWS S3 for file storage **Infrastructure**: - Docker for local development - Kubernetes for production - GitHub Actions for CI/CD - AWS (EC2, RDS, S3, CloudFront) - DataDog for monitoring ### Project Statistics - **Started**: January 2023 - **Team Size**: 12 engineers (4 frontend, 5 backend, 3 full-stack) - **Codebase**: ~150K lines of code - **Active Users**: 5,000+ businesses - **Monthly Transactions**: $2M+ --- ## Day 1: Getting Started ### Your First Day Checklist - [ ] Complete HR onboarding - [ ] Get added to communication channels - [ ] Set up development environment - [ ] Clone the repository - [ ] Run the application locally - [ ] Deploy to your personal dev environment - [ ] Introduce yourself to the team - [ ] Schedule 1:1s with your manager and buddy ### Access & Accounts **Required Accounts**: 1. **GitHub** - Source code ([github.com/company/project](https://github.com)) - Request access from @engineering-manager 2. **Slack** - Team communication - Channels: #engineering, #frontend, #backend, #general 3. **Jira** - Project management ([company.atlassian.net](https://company.atlassian.net)) 4. **Figma** - Design files 5. **AWS Console** - Production access (read-only initially) 6. **DataDog** - Monitoring and logs **Development Tools**: - Docker Desktop - Node.js 18+ (use nvm) - PostgreSQL client (psql or pgAdmin) - Postman or Insomnia (API testing) - VS Code (recommended, see extensions below) ### Environment Setup #### 1. Install Prerequisites **macOS**: ```bash # Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Install Node.js via nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash nvm install 18 nvm use 18 # Install Docker Desktop brew install --cask docker # Install PostgreSQL client brew install postgresql@14 ``` **Windows**: ```bash # Install using Chocolatey choco install nodejs-lts docker-desktop postgresql14 ``` #### 2. Clone Repository ```bash # Clone the repo git clone git@github.com:company/ecommerce-platform.git cd ecommerce-platform # Install dependencies npm install # Copy environment variables cp .env.example .env.local ``` #### 3. Configure Environment Variables Edit `.env.local`: ```bash # Database (local Docker) DATABASE_URL=postgresql://postgres:password@localhost:5432/ecommerce_dev # Redis REDIS_URL=redis://localhost:6379 ``` -------------------------------- ### Starting Development Environment (Bash) Source: https://github.com/curiouslearner/devkit/blob/main/skills/onboarding-helper/SKILL.md Commands to initiate the local development environment. This includes starting Docker services, running database migrations and seeds, and finally, starting the development server. ```bash # Start Docker services (PostgreSQL, Redis) docker-compose up -d # Run database migrations npm run db:migrate # Seed database with sample data npm run db:seed # Start development server npm run dev ``` -------------------------------- ### Get All Users API Request Examples Source: https://github.com/curiouslearner/devkit/blob/main/skills/api-documentation/SKILL.md Demonstrates how to retrieve a paginated list of users using different tools. Supports query parameters for pagination. ```http GET /api/users ``` ```bash curl -X GET "https://api.example.com/v1/api/users?page=1&limit=10" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ```javascript const response = await fetch('https://api.example.com/v1/api/users?page=1&limit=10', { headers: { 'Authorization': 'Bearer YOUR_TOKEN' } }); const data = await response.json(); ``` ```python import requests response = requests.get( 'https://api.example.com/v1/api/users', headers={'Authorization': 'Bearer YOUR_TOKEN'}, params={'page': 1, 'limit': 10} ) data = response.json() ``` -------------------------------- ### React + TypeScript + Vite Project Setup and Dependencies Source: https://github.com/curiouslearner/devkit/blob/main/skills/project-scaffolder/SKILL.md Commands to initialize a new React project with TypeScript and Vite, install essential development dependencies for linting, formatting, testing, and pre-commit hooks. ```bash # Initialize project npm create vite@latest my-app -- --template react-ts cd my-app npm install # Add essential dependencies npm install -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin npm install -D prettier eslint-config-prettier eslint-plugin-prettier npm install -D husky lint-staged npm install -D vitest @testing-library/react @testing-library/jest-dom npm install -D @vitejs/plugin-react ``` -------------------------------- ### Prism CLI: Mock Server from OpenAPI Spec (Bash) Source: https://github.com/curiouslearner/devkit/blob/main/skills/mock-server/SKILL.md Demonstrates how to use the Prism CLI to create a mock REST API server based on an OpenAPI specification file. It covers installation, starting the server, specifying a port, enabling validation, and using dynamic responses based on examples. The primary dependency is the '@stoplight/prism-cli' npm package. ```bash # Install npm install -g @stoplight/prism-cli # Start mock server from OpenAPI spec prism mock openapi.yaml # Specify port prism mock openapi.yaml --port 4010 # Enable validation prism mock openapi.yaml --errors # Dynamic responses based on examples prism mock openapi.yaml --dynamic ``` -------------------------------- ### Install Go CLI Dependencies Source: https://github.com/curiouslearner/devkit/blob/main/skills/project-scaffolder/SKILL.md Installs the latest versions of Cobra and Viper for Go CLI development using the go get command. ```bash go get github.com/spf13/cobra@latest go get github.com/spf13/viper@latest ``` -------------------------------- ### Modern Project Setup with Poetry Source: https://github.com/curiouslearner/devkit/blob/main/skills/python-venv-manager/SKILL.md Outlines the workflow for setting up a modern Python project using Poetry. This includes creating a new project, adding development and production dependencies, installing them, and configuring project settings in `pyproject.toml` for tools like Black, Pytest, and MyPy. ```bash # Create new project with structure poetry new my-project cd my-project # Project structure created: # my-project/ # ├── pyproject.toml # ├── README.md # ├── my_project/ # │ └── __init__.py # └── tests/ # └── __init__.py # Add dependencies poetry add requests httpx pydantic poetry add --group dev pytest pytest-cov black flake8 mypy # Install dependencies poetry install # Configure pyproject.toml cat >> pyproject.toml << EOF [tool.black] line-length = 88 target-version = ['py311'] [tool.pytest.ini_options] testpaths = ["tests"] python_files = "test_*.py" [tool.mypy] python_version = "3.11" warn_return_any = true warn_unused_configs = true EOF ``` -------------------------------- ### Setup Pytest for Testing Source: https://github.com/curiouslearner/devkit/blob/main/skills/python-venv-manager/SKILL.md Details the installation and configuration of `pytest` for project testing using Poetry. It includes adding `pytest`, `pytest-cov`, and `pytest-mock` as development dependencies, configuring `pytest` options in `pyproject.toml`, and commands to run tests, generate coverage reports, and execute specific tests. ```bash # Install pytest poetry add --group dev pytest pytest-cov pytest-mock # pyproject.toml [tool.pytest.ini_options] testpaths = ["tests"] python_files = "test_*.py" python_classes = "Test*" python_functions = "test_*" addopts = "-v --tb=short --strict-markers" # Run tests poetry run pytest # With coverage poetry run pytest --cov=src --cov-report=html # Run specific test poetry run pytest tests/test_core.py::test_function_name ``` -------------------------------- ### .env.example Template for Application Configuration Source: https://github.com/curiouslearner/devkit/blob/main/skills/env-manager/SKILL.md Provides a comprehensive example of a .env.example file, outlining common environment variables for application settings, database configuration, external services, feature flags, logging, security, and development-specific options. This template serves as a guide for setting up environment variables. ```dotenv # ====================== # Application Settings # ====================== # Environment (development, staging, production) NODE_ENV=development # Application port PORT=3000 # Application URL APP_URL=http://localhost:3000 # ====================== # Database Configuration # ====================== # PostgreSQL connection string # Format: postgresql://username:password@host:port/database DATABASE_URL=postgresql://user:password@localhost:5432/myapp # Database connection pool DB_POOL_MIN=2 DB_POOL_MAX=10 # ====================== # Redis Configuration # ====================== # Redis connection URL REDIS_URL=redis://localhost:6379 # Redis password (optional) # REDIS_PASSWORD= # ====================== # Authentication # ====================== # JWT secret key (REQUIRED - Generate with: openssl rand -base64 32) JWT_SECRET=your-secret-key-here # JWT expiration (default: 24h) JWT_EXPIRES_IN=24h # Session secret SESSION_SECRET=your-session-secret # ====================== # External Services # ====================== # AWS Configuration AWS_REGION=us-east-1 AWS_ACCESS_KEY_ID=your-access-key AWS_SECRET_ACCESS_KEY=your-secret-key AWS_S3_BUCKET=my-app-uploads # Email Service (SendGrid) SENDGRID_API_KEY=SG.xxxxx EMAIL_FROM=noreply@example.com # Stripe STRIPE_PUBLIC_KEY=pk_test_xxxxx STRIPE_SECRET_KEY=sk_test_xxxxx # ====================== # Feature Flags # ====================== # Enable new dashboard ENABLE_NEW_DASHBOARD=false # Enable email notifications ENABLE_EMAIL_NOTIFICATIONS=true # ====================== # Logging & Monitoring # ====================== # Log level (error, warn, info, debug) LOG_LEVEL=info # Sentry DSN for error tracking # SENTRY_DSN=https://xxxxx@sentry.io/xxxxx # ====================== # Security # ====================== # CORS allowed origins (comma-separated) CORS_ORIGINS=http://localhost:3000,http://localhost:3001 # Rate limiting RATE_LIMIT_MAX_REQUESTS=100 RATE_LIMIT_WINDOW_MS=900000 # ====================== # Development Only # ====================== # Enable debug mode DEBUG=false # Disable SSL verification (NEVER in production!) # NODE_TLS_REJECT_UNAUTHORIZED=0 ``` -------------------------------- ### Browser Mock Service Worker Setup (JavaScript) Source: https://github.com/curiouslearner/devkit/blob/main/skills/mock-server/SKILL.md Sets up and starts the Mock Service Worker (MSW) in the browser environment for development. It imports handlers and uses `setupWorker` to create the worker instance. This code should be placed in the application's entry point for development mode. ```javascript // src/mocks/browser.js import { setupWorker } from 'msw/browser'; import { handlers } from './handlers'; export const worker = setupWorker(...handlers); // src/index.js if (process.env.NODE_ENV === 'development') { const { worker } = await import('./mocks/browser'); await worker.start(); } ``` -------------------------------- ### Build and Install Go Projects Source: https://github.com/curiouslearner/devkit/blob/main/skills/go-mod-helper/SKILL.md Commands to build all packages within the cmd directory and install specific commands to the GOPATH/bin directory. ```bash # Build all go build ./cmd/... # Install to GOPATH/bin go install ./cmd/server go install ./cmd/cli ``` -------------------------------- ### Install Node.js via nvm (Bash) Source: https://github.com/curiouslearner/devkit/blob/main/skills/onboarding-helper/SKILL.md Shell script to install Node Version Manager (nvm) and then install and use Node.js version 18. This is a common step for setting up development environments on macOS and Linux. ```bash curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash nvm install 18 nvm use 18 ``` -------------------------------- ### Configure Black, isort, Flake8, Mypy, and Pylint Source: https://github.com/curiouslearner/devkit/blob/main/skills/python-venv-manager/SKILL.md Explains how to set up code formatting and linting tools within a Poetry project. It covers installing `black`, `isort`, `flake8`, `mypy`, and `pylint` as development dependencies and provides example configurations for `black` and `isort` in `pyproject.toml`, as well as `mypy` settings. ```bash # Install tools poetry add --group dev black isort flake8 mypy pylint # pyproject.toml configuration [tool.black] line-length = 88 target-version = ['py311'] include = '\.pyi?$' extend-exclude = ''' ( # directories \.eggs | \.git | \.venv | build | dist )/ ''' [tool.isort] profile = "black" line_length = 88 [tool.mypy] python_version = "3.11" warn_return_any = true warn_unused_configs = true disallow_untyped_defs = true # Run formatting poetry run black . poetry run isort . ``` -------------------------------- ### TypeScript Project Setup with npm Source: https://github.com/curiouslearner/devkit/blob/main/skills/npm-helper/SKILL.md Guide to setting up a Node.js project with TypeScript using npm. It covers installing TypeScript and related types, initializing the TypeScript compiler, and configuring the tsconfig.json file for common settings. ```bash # Initialize project npm init -y # Install TypeScript and types npm install --save-dev \ typescript \ @types/node \ @types/express \ ts-node \ nodemon # Initialize TypeScript npx tsc --init # Configure tsconfig.json cat > tsconfig.json << EOF { "compilerOptions": { "target": "ES2020", "module": "commonjs", "lib": ["ES2020"], "outDir": "./dist", "rootDir": "./src", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "moduleResolution": "node", "declaration": true, "declarationMap": true, "sourceMap": true }, "include": ["src/**/*"], "exclude": ["node_modules", "dist"] } EOF ``` -------------------------------- ### Go Project with Multiple Binaries Setup Source: https://github.com/curiouslearner/devkit/blob/main/skills/go-mod-helper/SKILL.md Demonstrates how to structure a Go project to build multiple independent binaries from different `main` packages within the `cmd` directory, along with the corresponding build commands. ```go // go.mod module github.com/username/project go 1.21 // cmd/server/main.go package main func main() { // Server implementation } // cmd/cli/main.go package main func main() { // CLI implementation } # Build specific binary go build -o bin/server ./cmd/server go build -o bin/cli ./cmd/cli ``` -------------------------------- ### Display DevKit Help and Usage Information Source: https://context7.com/curiouslearner/devkit/llms.txt Shows comprehensive help documentation for the DevKit plugin, including a quick start guide, skill categories, popular skills, and usage examples. This command is essential for understanding how to effectively utilize the plugin's features. ```bash # Get comprehensive help /devkit:help # Output includes: # - How to invoke skills with @skill-name # - List of all 10 skill categories # - Popular skills for daily development # - Example invocations ``` -------------------------------- ### Run Tests with npm (Bash) Source: https://github.com/curiouslearner/devkit/blob/main/skills/onboarding-helper/SKILL.md Commands for running tests using npm. Includes options for watching tests, generating coverage reports, and running specific test files. ```bash # All tests npm test # Watch mode npm test -- --watch # Coverage npm test -- --coverage # Specific file npm test UserService.test.ts ``` -------------------------------- ### Install and Use cargo-audit Source: https://github.com/curiouslearner/devkit/blob/main/skills/rust-cargo-assistant/SKILL.md Guide to installing and using cargo-audit for checking Rust dependencies for security vulnerabilities and attempting to fix them. ```bash cargo install cargo-audit cargo audit cargo audit fix ``` -------------------------------- ### Configure Local Database and Redis (Bash) Source: https://github.com/curiouslearner/devkit/blob/main/skills/onboarding-helper/SKILL.md Example of configuring local environment variables for database connection and Redis URL. This is typically done by editing a .env.local file. ```bash # Database (local Docker) DATABASE_URL=postgresql://postgres:password@localhost:5432/ecommerce_dev # Redis REDIS_URL=redis://localhost:6379 ``` -------------------------------- ### Clone Repository and Install Dependencies (Bash) Source: https://github.com/curiouslearner/devkit/blob/main/skills/onboarding-helper/SKILL.md Bash commands to clone a Git repository, navigate into the directory, install project dependencies using npm, and copy environment variable configuration. ```bash git clone git@github.com:company/ecommerce-platform.git cd ecommerce-platform npm install cp .env.example .env.local ``` -------------------------------- ### Slate: Set Up and Build API Documentation Source: https://github.com/curiouslearner/devkit/blob/main/skills/api-documentation/SKILL.md Instructions for setting up a Slate documentation site, including cloning the template, installing dependencies using Bundler, editing the main Markdown file, and running the development server or building a static site. ```bash # Clone template git clone https://github.com/slatedocs/slate.git my-api-docs cd my-api-docs # Install dependencies bundle install # Edit source/index.html.md # Run server bundle exec middleman server # Build static site bundle exec middleman build ``` -------------------------------- ### Initialize Poetry Project and Add Dependencies Source: https://github.com/curiouslearner/devkit/blob/main/skills/python-venv-manager/SKILL.md This snippet demonstrates initializing a new Poetry project, adding dependencies from a requirements.txt file, including development dependencies, and installing the project's environment. It concludes with verifying a package installation. ```bash # Navigate to project cd existing-project # Initialize poetry poetry init # Follow interactive prompts, then add dependencies poetry add $(cat requirements.txt) # Add dev dependencies poetry add --group dev pytest black flake8 # Create virtual environment poetry install # Verify installation poetry run python -c "import requests; print(requests.__version__)" ``` -------------------------------- ### PR Title Best Practices Examples Source: https://github.com/curiouslearner/devkit/blob/main/skills/pr-template-generator/SKILL.md Illustrates good and bad examples of pull request titles to guide developers in creating clear and informative titles. ```text ✅ GOOD Titles: - feat: Add real-time notification system - fix: Prevent duplicate order submissions - refactor: Extract payment processing logic - perf: Reduce initial page load time by 40% ❌ BAD Titles: - Update code - Fix bug - Changes - WIP - asdfasdf ``` -------------------------------- ### Add Cross-Compilation Target Source: https://github.com/curiouslearner/devkit/blob/main/skills/rust-cargo-assistant/SKILL.md Installs a new target triple for cross-compilation using `rustup`. Examples include Linux musl, Windows GNU, and ARM Linux. ```bash rustup target add x86_64-unknown-linux-musl rustup target add x86_64-pc-windows-gnu rustup target add aarch64-unknown-linux-gnu ``` -------------------------------- ### Mock Server Skill Usage Examples Source: https://github.com/curiouslearner/devkit/blob/main/skills/mock-server/SKILL.md Demonstrates various ways to invoke the mock-server skill, including basic invocation, generating from OpenAPI specs, specifying ports, enabling delays, and mocking GraphQL APIs. ```bash @mock-server @mock-server --from-openapi @mock-server --port 3000 @mock-server --with-delays @mock-server --graphql ``` -------------------------------- ### Generate Onboarding Docs with @onboarding-helper Source: https://context7.com/curiouslearner/devkit/llms.txt The @onboarding-helper skill generates onboarding documentation for new developers. It can optionally include a setup guide as part of the generated documentation. ```bash # Generate onboarding docs @onboarding-helper # Include setup guide @onboarding-helper --include-setup ``` -------------------------------- ### Turborepo Monorepo Setup Source: https://github.com/curiouslearner/devkit/blob/main/skills/project-scaffolder/SKILL.md Initializes a new monorepo using create-turbo and sets up the basic directory structure for applications and packages. ```bash # Create monorepo npx create-turbo@latest my-monorepo cd my-monorepo ``` -------------------------------- ### Example API Requests with cURL Source: https://context7.com/curiouslearner/devkit/llms.txt Demonstrates how to make API requests using cURL, including GET requests with authentication and query parameters, and POST requests with a JSON payload. ```bash # GET request with authentication curl -X GET https://api.example.com/api/users \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" # GET with query parameters curl -X GET "https://api.example.com/api/users?page=1&limit=10&sort=created_at" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ```bash # POST request to create resource curl -X POST https://api.example.com/api/users \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "John Doe", "email": "john@example.com", "role": "user" }' ``` -------------------------------- ### Project Structure Examples for Small and Medium Projects Source: https://github.com/curiouslearner/devkit/blob/main/skills/python-venv-manager/SKILL.md Presents recommended directory structures for small and medium-sized Python projects. The small project example includes basic files like .gitignore, README, requirements.txt, and a single module with tests. The medium project example incorporates pyproject.toml, a src layout, and separate requirement files for different environments. ```text Small Project my-project/ ├── .gitignore ├── README.md ├── requirements.txt ├── setup.py (optional) ├── my_module.py └── tests/ ├── __init__.py └── test_my_module.py Medium Project my-project/ ├── .gitignore ├── README.md ├── pyproject.toml ├── setup.py ├── requirements/ │ ├── base.txt # Common dependencies │ ├── development.txt # Dev dependencies │ └── production.txt # Production dependencies ├── src/ │ └── my_package/ │ ├── __init__.py │ ├── core.py │ ├── utils.py │ └── models.py ├── tests/ │ ├── __init__.py │ ├── conftest.py │ └── test_core.py └── docs/ └── index.md ``` -------------------------------- ### Modern ESM Project Setup in package.json Source: https://github.com/curiouslearner/devkit/blob/main/skills/npm-helper/SKILL.md Configuration for a modern ECMAScript Module (ESM) project. Key fields include `"type": "module"` to enable ESM syntax, and scripts for development (`dev`), build (`build`), and start (`start`). Dependencies like `express` and devDependencies like `typescript` are also listed. ```json { "name": "my-esm-project", "version": "1.0.0", "type": "module", "main": "dist/index.js", "scripts": { "dev": "node --watch src/index.js", "build": "tsc", "start": "node dist/index.js", "test": "node --test" }, "dependencies": { "express": "^4.18.2" }, "devDependencies": { "@types/node": "^20.10.0", "typescript": "^5.3.0" } } ``` -------------------------------- ### POST Request Examples (Bash) Source: https://github.com/curiouslearner/devkit/blob/main/skills/api-tester/SKILL.md Illustrates how to send POST requests to create resources using curl. Examples include sending JSON data directly in the request body and referencing a local JSON file. ```bash # curl curl -X POST https://api.example.com/api/users \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "John Doe", "email": "john@example.com", "role": "user" }' # From file curl -X POST https://api.example.com/api/users \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d @user.json ``` -------------------------------- ### Convert JSON to CSV (jq) Source: https://github.com/curiouslearner/devkit/blob/main/skills/json-transformer/SKILL.md Converts JSON data to CSV format using the jq command-line processor. Examples show how to extract specific fields and include headers. Requires jq to be installed. ```bash # Convert JSON array to CSV cat data.json | jq -r '.[] | [.name, .age, .email] | @csv' # With headers cat data.json | jq -r '["name", "age", "email"], (.[] | [.name, .age, .email]) | @csv' ``` -------------------------------- ### Cargo: Size Optimization Tools Source: https://github.com/curiouslearner/devkit/blob/main/skills/rust-cargo-assistant/SKILL.md Provides command-line examples for using external tools to further optimize binary size. It includes installing `cargo-bloat` to analyze binary composition and using `upx` for compressing the final executable. ```bash # Additional size reduction tools cargo install cargo-bloat # Show what's taking space cargo bloat --release # Show per-crate sizes cargo bloat --release --crates # Use UPX for compression upx --best --lzma target/release/my-app ``` -------------------------------- ### Example Environment Variables Source: https://github.com/curiouslearner/devkit/blob/main/skills/project-scaffolder/SKILL.md An example .env file demonstrating common environment variables for Node.js applications, including application settings, database connection strings, and authentication secrets. ```env # Application NODE_ENV=development PORT=3000 APP_URL=http://localhost:3000 # Database DATABASE_URL=postgresql://user:password@localhost:5432/mydb # Authentication JWT_SECRET=your-secret-key-here JWT_EXPIRE=7d # API Keys API_KEY=your-api-key ``` -------------------------------- ### WireMock Docker Setup and Mapping (Bash) Source: https://github.com/curiouslearner/devkit/blob/main/skills/mock-server/SKILL.md Provides instructions to run WireMock in a Docker container and create a basic API mapping for user data. This setup allows for mocking HTTP requests, particularly useful for Java-based projects requiring API simulation. ```bash # Run WireMock in Docker docker run -d \ --name wiremock \ -p 8080:8080 \ -v $(pwd)/wiremock:/home/wiremock \ wiremock/wiremock:latest # Create mapping mkdir -p wiremock/mappings cat > wiremock/mappings/users.json << EOF { "request": { "method": "GET", "url": "/api/users" }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "jsonBody": [ { "id": "1", "name": "John Doe", "email": "john@example.com" } ] } } EOF ``` -------------------------------- ### Merge JSON Objects (jq) Source: https://github.com/curiouslearner/devkit/blob/main/skills/json-transformer/SKILL.md Merges JSON objects using the jq command-line JSON processor. The first example performs a shallow merge, while the second demonstrates a deep merge using `reduce`. Requires jq to be installed. ```bash # Merge two JSON files jq -s '.[0] * .[1]' file1.json file2.json # Deep merge jq -s 'reduce .[] as $item ({}; . * $item)' file1.json file2.json ``` -------------------------------- ### API Communication: React Query for Data Fetching and Mutations in TypeScript Source: https://github.com/curiouslearner/devkit/blob/main/skills/onboarding-helper/SKILL.md Shows how to use React Query for server state management. It includes examples of fetching data with `useQuery` and performing data mutations with `useMutation`, including invalidating queries upon successful mutations. Assumes an `api` client is available. ```typescript import { useQuery, useMutation } from '@tanstack/react-query'; import { api } from '@/api/client'; // Fetching data const { data, isLoading, error } = useQuery({ queryKey: ['products'], queryFn: () => api.products.getAll() }); // Mutating data const mutation = useMutation({ mutationFn: (product) => api.products.create(product), onSuccess: () => { queryClient.invalidateQueries(['products']); } }); ``` -------------------------------- ### Docker Layer Caching Best Practices Source: https://github.com/curiouslearner/devkit/blob/main/skills/docker-helper/SKILL.md Illustrates effective use of Docker layer caching to speed up build times. The 'Good' example caches dependency installation separately from code copying, preventing unnecessary reinstalls when only code changes. ```dockerfile # ❌ Bad - Invalidates cache on any file change COPY . . RUN npm install # ✓ Good - Cache dependencies separately COPY package*.json ./ RUN npm install COPY . . ``` -------------------------------- ### Generate Changelog with conventional-changelog-cli Source: https://github.com/curiouslearner/devkit/blob/main/skills/changelog-generator/SKILL.md This section provides instructions for installing and using the conventional-changelog-cli to generate changelogs. It includes commands for initial setup, generating for the first release, and customizing with specific options like tag prefixes and presets. Requires Node.js and npm. ```bash # Install npm install -g conventional-changelog-cli # Generate changelog conventional-changelog -p angular -i CHANGELOG.md -s # For first release conventional-changelog -p angular -i CHANGELOG.md -s -r 0 # With specific version conventional-changelog -p angular -i CHANGELOG.md -s --release-count 0 \ --tag-prefix v --preset angular ``` -------------------------------- ### Ngrok Tunneling Commands Source: https://github.com/curiouslearner/devkit/blob/main/skills/webhook-tester/SKILL.md Demonstrates basic ngrok commands for setting up HTTP tunnels to localhost. Includes installation, authentication, starting tunnels for specific ports, using custom subdomains, and enabling the inspection UI. ngrok requires authentication with a token from ngrok.com. ```bash # Install ngrok # Download from https://ngrok.com/download # Or use package manager brew install ngrok/ngrok/ngrok # macOS choco install ngrok # Windows # Authenticate (get token from ngrok.com) ngrok config add-authtoken YOUR_TOKEN # Start tunnel to localhost:3000 ngrok http 3000 # Custom subdomain (requires paid plan) ngrok http 3000 --subdomain=myapp # Multiple ports ngrok http 3000 3001 # Use specific region ngrok http 3000 --region=us # Enable inspection UI ngrok http 3000 --inspect=true ``` -------------------------------- ### MkDocs: Create and Configure Python-based Documentation Site Source: https://github.com/curiouslearner/devkit/blob/main/skills/api-documentation/SKILL.md This section details the process of installing MkDocs and the Material theme, creating a new project, configuring the `mkdocs.yml` file for site name, theme, and navigation, and then serving or building the documentation. ```bash # Install pip install mkdocs mkdocs-material # Create new project mkdocs new my-api-docs cd my-api-docs # Configure mkdocs.yml site_name: My API Documentation theme: name: material features: - navigation.tabs - navigation.sections - toc.integrate nav: - Home: index.md - Getting Started: getting-started.md - API Reference: api-reference.md - Examples: examples.md # Serve locally mkdocs serve # Build mkdocs build ``` -------------------------------- ### JSON Server - Basic CRUD Operations Source: https://github.com/curiouslearner/devkit/blob/main/skills/mock-server/SKILL.md Demonstrates how to use JSON Server to create a mock API with basic CRUD operations for users and posts. Includes examples for GET, POST, PUT, PATCH, and DELETE requests, as well as query parameter usage. ```APIDOC ## JSON Server Mock API ### Description This section details how to set up and interact with a mock API server using JSON Server. It covers creating a `db.json` file to define your data and then starting the server to serve these resources. ### Method GET, POST, PUT, PATCH, DELETE ### Endpoint `http://localhost:3000/users` `http://localhost:3000/users/{id}` `http://localhost:3000/posts` `http://localhost:3000/posts/{id}` ### Parameters #### Query Parameters - **_page** (number) - Optional - Specifies the page number for paginated results. - **_limit** (number) - Optional - Specifies the number of items per page. - **_sort** (string) - Optional - Field to sort the results by. - **_order** (string) - Optional - Order of sorting ('asc' or 'desc'). - **userId** (number) - Optional - Filters posts by a specific user ID. ### Request Example #### GET all users ```bash curl http://localhost:3000/users ``` #### GET user by ID ```bash curl http://localhost:3000/users/1 ``` #### POST new user ```bash curl -X POST http://localhost:3000/users \ -H "Content-Type: application/json" \ -d '{"name": "Bob", "email": "bob@example.com"}' ``` #### PUT update user ```bash curl -X PUT http://localhost:3000/users/1 \ -H "Content-Type: application/json" \ -d '{"id": 1, "name": "John Updated", "email": "john.new@example.com"}' ``` #### PATCH partial update ```bash curl -X PATCH http://localhost:3000/users/1 \ -H "Content-Type: application/json" \ -d '{"name": "John Patched"}' ``` #### DELETE user ```bash curl -X DELETE http://localhost:3000/users/1 ``` #### Query parameters example (pagination and sorting) ```bash curl "http://localhost:3000/users?_page=1&_limit=10&_sort=name&_order=asc" ``` #### Query parameters example (filtering posts by userId) ```bash curl "http://localhost:3000/posts?userId=1" ``` ### Response #### Success Response (200) - **data** (array) - Array of user or post objects. - **object** (object) - Single user or post object for GET by ID, PUT, PATCH requests. #### Response Example (GET all users) ```json [ { "id": 1, "name": "John Doe", "email": "john@example.com" }, { "id": 2, "name": "Jane Smith", "email": "jane@example.com" } ] ``` #### Response Example (GET user by ID) ```json { "id": 1, "name": "John Doe", "email": "john@example.com" } ``` ``` -------------------------------- ### Complex npm Script Examples (JSON) Source: https://github.com/curiouslearner/devkit/blob/main/skills/npm-helper/SKILL.md Illustrates advanced npm script configurations for parallel and sequential execution, cross-platform commands, environment-specific setups, and passing arguments to scripts. This JSON object showcases powerful automation possibilities within npm. ```json { "scripts": { "// Parallel execution": "", "dev": "concurrently \"npm:dev:*\"", "dev:server": "nodemon src/server.ts", "dev:client": "vite", "// Sequential execution": "", "build": "npm run clean && npm run build:tsc && npm run build:bundle", "build:tsc": "tsc", "build:bundle": "webpack", "// Cross-platform commands": "", "clean": "rimraf dist", "copy": "copyfiles -u 1 src/**/*.json dist", "// Environment-specific": "", "start:dev": "NODE_ENV=development node dist/index.js", "start:prod": "NODE_ENV=production node dist/index.js", "// With arguments": "", "test": "jest", "test:file": "jest --", "// Usage: npm run test:file path/to/test.js" } } ``` -------------------------------- ### Running Tests and Linting (Bash) Source: https://github.com/curiouslearner/devkit/blob/main/skills/onboarding-helper/SKILL.md Commands to execute the test suite and run the linter for the project. These are crucial steps to ensure code quality and correctness before committing changes. ```bash npm run test npm run lint ``` -------------------------------- ### JSON Server Custom Routes Configuration Source: https://github.com/curiouslearner/devkit/blob/main/skills/mock-server/SKILL.md Illustrates how to define custom routes for JSON Server using a routes.json file. This allows for URL rewriting and aliasing, enabling more flexible API endpoint definitions. The example shows how to start JSON Server with these custom routes. ```javascript // routes.json { "/api/*": "/$1", "/users/:id/posts": "/posts?userId=:id", "/auth/login": "/login" } // Start with custom routes json-server db.json --routes routes.json ``` -------------------------------- ### Usage Examples for API Documentation Skill Source: https://github.com/curiouslearner/devkit/blob/main/skills/api-documentation/SKILL.md Demonstrates various command-line invocations for the API Documentation Skill to generate documentation, export collections, or generate SDKs. ```bash @api-documentation @api-documentation --from-openapi @api-documentation --interactive @api-documentation --export-postman @api-documentation --generate-sdk ``` -------------------------------- ### Prepare Go Module for Release Source: https://github.com/curiouslearner/devkit/blob/main/skills/go-mod-helper/SKILL.md This bash script outlines the steps to prepare a Go module for release. It includes running tests, tidying dependencies, verifying the module, running a linter, and updating documentation like CHANGELOG.md. These steps ensure the module is stable and well-documented before publishing. ```bash # Ensure tests pass go test ./... # Tidy dependencies go mod tidy # Verify module go mod verify # Run linter golangci-lint run # Update version in documentation # Update CHANGELOG.md ``` -------------------------------- ### Lockfile Example with Exact and Range Versions Source: https://github.com/curiouslearner/devkit/blob/main/skills/dependency-auditor/SKILL.md Illustrates best practices for using lock files, showing how to pin exact versions for production dependencies like 'express' and allow patch updates for development dependencies like 'lodash'. ```json { "dependencies": { "express": "4.18.2", // Exact version in production "lodash": "^4.17.21" // Allow patches in development } } ``` -------------------------------- ### Go Module Checksum File Example Source: https://github.com/curiouslearner/devkit/blob/main/skills/go-mod-helper/SKILL.md Provides an example of the go.sum file content, which contains cryptographic checksums for specific module versions, ensuring the integrity of downloaded dependencies. ```go github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= ``` -------------------------------- ### Localtunnel Commands and Node.js Usage Source: https://github.com/curiouslearner/devkit/blob/main/skills/webhook-tester/SKILL.md Details how to use localtunnel for creating public URLs for local web services. Includes installation via npm, starting a tunnel for a specific port, attempting to use a custom subdomain, and programmatic usage with the localtunnel Node.js library. Subdomain availability may vary. ```bash # Install npm install -g localtunnel # Start tunnel lt --port 3000 # Custom subdomain (may not be available) lt --port 3000 --subdomain myapp # Use localtunnel programmatically const localtunnel = require('localtunnel'); const tunnel = await localtunnel({ port: 3000 }); console.log('Tunnel URL:', tunnel.url); tunnel.on('close', () => { console.log('Tunnel closed'); }); ``` -------------------------------- ### Start Express Server Source: https://github.com/curiouslearner/devkit/blob/main/skills/project-scaffolder/SKILL.md Initializes the Express application by loading environment variables using dotenv and starts the HTTP server. It listens on a specified port, defaulting to 3000 if the PORT environment variable is not set, and logs a confirmation message to the console. ```typescript import app from './app'; import dotenv from 'dotenv'; dotenv.config(); const PORT = process.env.PORT || 3000; app.listen(PORT, () => { console.log(`Server running on port ${PORT}`); }); ```