### Project Installation and Usage Examples Source: https://github.com/nth5693/gemini-kit/blob/main/agents/docs-manager.md Standardized snippets for installing a package via npm and performing a quick start initialization in a JavaScript environment. ```bash npm install package-name ``` ```javascript import { thing } from 'package-name'; thing.doSomething(); ``` -------------------------------- ### Setup Gemini-Kit Development Environment Source: https://github.com/nth5693/gemini-kit/blob/main/CONTRIBUTING.md Commands to clone the repository, install dependencies, and build the project. Requires Node.js 18+ and npm installed on the local machine. ```bash git clone https://github.com/nth5693/gemini-kit.git cd gemini-kit npm install npm run build ``` -------------------------------- ### Install and Configure Gemini-Kit Source: https://github.com/nth5693/gemini-kit/blob/main/README.md Commands to clone the repository, install dependencies, and link the extension to the Gemini CLI environment. ```bash git clone https://github.com/nth5693/gemini-kit.git ~/.gemini/extensions/gemini-kit cd ~/.gemini/extensions/gemini-kit npm install && npm run build gemini extensions link $(pwd) ``` -------------------------------- ### Install and Build Gemini Kit Extension Source: https://context7.com/nth5693/gemini-kit/llms.txt Instructions to clone the Gemini Kit repository, install its Node.js dependencies, build the project, and link it to the Gemini CLI. ```bash # Clone repository git clone https://github.com/nth5693/gemini-kit.git ~/.gemini/extensions/gemini-kit # Install dependencies and build cd ~/.gemini/extensions/gemini-kit npm install && npm run build # Link extension to Gemini CLI gemini extensions link $(pwd) ``` -------------------------------- ### Setup Git Hooks with Husky and Lint-staged Source: https://github.com/nth5693/gemini-kit/blob/main/agents/git-manager.md Instructions for setting up Git hooks using Husky and lint-staged. This includes installation, initialization, and adding hooks to enforce code quality checks. ```bash # Install npm install -D husky lint-staged # Init npx husky init # Add hooks echo "npm run lint-staged" > .husky/pre-commit ``` -------------------------------- ### Configure Project Setup Wizard Command Source: https://github.com/nth5693/gemini-kit/blob/main/plans/add-conductor-features.md Defines the TOML configuration for the /kit:setup command, which initiates an interactive wizard to collect project context including product goals, tech stack, and development guidelines. ```toml # commands/kit-setup.toml description = "Interactive project setup wizard" prompt = """ # 🚀 Kit Setup Wizard This is the wizard to setup project context. ## Steps: 1. Product Context - Product description, users, goals 2. Tech Stack - Language, framework, database 3. Guidelines - Code style, commit conventions Start with: What are you building? For whom? """ ``` -------------------------------- ### Execute Gemini-Kit Commands Source: https://github.com/nth5693/gemini-kit/blob/main/README.md Basic usage examples for interacting with the Gemini-Kit extension within a project directory. ```bash cd /path/to/your/project gemini > /status > /explore React > /plan Add auth ``` -------------------------------- ### Configure Vitest Tests and Mocks Source: https://github.com/nth5693/gemini-kit/blob/main/agents/tester.md Provides examples for basic Vitest test setup and advanced mocking techniques including spies and clearing mocks. ```typescript import { describe, it, expect, vi, beforeEach } from 'vitest'; import { createUser } from '../user'; describe('createUser', () => { it('should create user successfully', async () => { const user = await createUser({ name: 'John' }); expect(user.id).toBeDefined(); }); }); // Vitest Mocking vi.mock('./emailService', () => ({ sendEmail: vi.fn().mockResolvedValue({ success: true }) })); const spy = vi.spyOn(console, 'log'); spy.mockImplementation(() => {}); beforeEach(() => { vi.clearAllMocks(); }); ``` -------------------------------- ### Git Pre-push Hook Example Source: https://github.com/nth5693/gemini-kit/blob/main/agents/git-manager.md Provides an example of a pre-push hook script that executes tests and builds the project before pushing to the remote repository. This ensures that only stable code is pushed. ```bash # .husky/pre-push #!/bin/sh npm test npm run build ``` -------------------------------- ### Security Audit Workflow Examples Source: https://context7.com/nth5693/gemini-kit/llms.txt Provides examples of how to perform security audits using the Gemini Kit. This includes auditing specific files, conducting a full security review of a system using the orchestrator, and utilizing the penetration-tester agent to identify vulnerabilities in an API. ```bash # Audit specific file > Use the security-auditor agent to audit src/api/auth.ts # Full security review workflow > Use the orchestrator for complete security audit of authentication system # Penetration testing > Use the penetration-tester agent to find vulnerabilities in the API ``` -------------------------------- ### Apply Indexing Strategies Source: https://github.com/nth5693/gemini-kit/blob/main/agents/database-admin.md Examples of single-column, composite, and partial index creation to improve database read performance. ```sql -- Single column CREATE INDEX ix_users_email ON users(email); -- Composite (order matters!) CREATE INDEX ix_orders_user_status ON orders(user_id, status); -- Partial CREATE INDEX ix_orders_pending ON orders(created_at) WHERE status = 'pending'; ``` -------------------------------- ### Exploring Topics with Bash Source: https://github.com/nth5693/gemini-kit/blob/main/docs/BEST-PRACTICES.md Use the '/explore' command followed by topic keywords to research and gather information when unsure where to start. This is a key step in the 'Explore Before Plan' pattern. ```bash /explore "topic" ``` -------------------------------- ### Project Setup Command Source: https://context7.com/nth5693/gemini-kit/llms.txt Explains the `/kit-setup` command used to initialize project-specific context. This command creates a `.gemini-kit/` directory containing essential configuration files like `product.md`, `tech-stack.md`, and `guidelines.md`. ```bash > /kit-setup # Creates .gemini-kit/ directory with: # - product.md: Product description # - tech-stack.md: Technologies used # - guidelines.md: Coding guidelines ``` -------------------------------- ### Next.js Route Handlers (API Routes) Example Source: https://github.com/nth5693/gemini-kit/blob/main/skills/nextjs/SKILL.md Demonstrates how to create API endpoints using Route Handlers in Next.js, including handling GET and POST requests to manage resources. ```ts // app/api/users/route.ts import { NextResponse } from 'next/server'; export async function GET(request: Request) { const users = await getUsers(); return NextResponse.json(users); } export async function POST(request: Request) { const body = await request.json(); const user = await createUser(body); return NextResponse.json(user, { status: 201 }); } ``` -------------------------------- ### Resume Project Documentation Work Source: https://github.com/nth5693/gemini-kit/blob/main/docs/specs/user-documentation/00-START-HERE.md This command allows you to resume working on the user documentation specification by displaying the content of the current specification file. It is useful for picking up where you left off. ```bash cat docs/specs/user-documentation/00-START-HERE.md ``` -------------------------------- ### Lint-staged Configuration Example Source: https://github.com/nth5693/gemini-kit/blob/main/agents/git-manager.md Configuration for lint-staged, specifying which files to lint and format using ESLint and Prettier. This ensures consistent code style across the project. ```json // package.json { "lint-staged": { "*.{ts,tsx}": ["eslint --fix", "prettier --write"], "*.{json,md}": ["prettier --write"] } } ``` -------------------------------- ### kit_team_start Source: https://context7.com/nth5693/gemini-kit/llms.txt Starts a new team session with a specified goal. The AI suggests the best workflow based on task analysis. ```APIDOC ## POST /kit_team_start ### Description Starts a new team session with a goal. AI suggests the best workflow based on task analysis. ### Method POST ### Endpoint /kit_team_start ### Parameters #### Request Body - **goal** (string) - Required - The main objective for the team session. - **sessionName** (string) - Required - The name for the new session. ### Request Example ```json { "goal": "Implement user authentication with JWT", "sessionName": "auth-feature" } ``` ### Response #### Success Response (200) - **session** (object) - Information about the created session. - **id** (string) - Unique identifier for the session. - **name** (string) - Name of the session. - **goal** (string) - The goal of the session. - **suggestedWorkflow** (string) - The AI-suggested workflow for the session. - **allWorkflows** (array) - A list of all available workflows. - **name** (string) - The name of the workflow. - **description** (string) - A description of the workflow. #### Response Example ```json { "session": { "id": "session-1705312200000", "name": "auth-feature", "goal": "Implement user authentication with JWT" }, "suggestedWorkflow": "feature", "allWorkflows": [ {"name": "cook", "description": "Full development cycle"}, {"name": "quickfix", "description": "Quick bug fix"}, {"name": "feature", "description": "New feature development"}, {"name": "refactor", "description": "Code refactoring"}, {"name": "review", "description": "Code review"}, {"name": "tdd", "description": "Test-driven development"}, {"name": "docs", "description": "Documentation"} ] } ``` ``` -------------------------------- ### Resume Session Source: https://github.com/nth5693/gemini-kit/blob/main/GEMINI.md Demonstrates the mandatory command to read session resume skills at the start of a new session. ```bash cat skills/session-resume/SKILL.md ``` -------------------------------- ### Waiting for Elements in Async Testing Source: https://github.com/nth5693/gemini-kit/blob/main/skills/testing/references/vitest-patterns.md Provides examples of using `waitFor` from Testing Library to handle asynchronous operations. The first example waits for an element with the text 'Loaded' to appear in the document, suitable for scenarios where data is fetched asynchronously. The second example waits for an element with the text 'Loading...' to disappear, indicating that a loading state has resolved. ```tsx await waitFor(() => { expect(screen.getByText('Loaded')).toBeInTheDocument(); }); ``` ```tsx await waitFor(() => { expect(screen.queryByText('Loading...')).not.toBeInTheDocument(); }); ``` -------------------------------- ### Gemini CLI Command Usage Examples Source: https://github.com/nth5693/gemini-kit/blob/main/commands/README.md Demonstrates how to use Gemini CLI commands from the terminal. Commands are invoked with a leading slash followed by the command name and optional arguments. ```bash # In Gemini CLI /command-name [arguments] # Examples /plan Add user authentication /code Implement login form /review @src/auth/login.ts ``` -------------------------------- ### Start Team Session with kit_team_start Source: https://context7.com/nth5693/gemini-kit/llms.txt Initializes a new development session with a specific goal. The system analyzes the task and returns a suggested workflow alongside a list of available workflow types. ```json // Request { "goal": "Implement user authentication with JWT", "sessionName": "auth-feature" } // Response { "session": { "id": "session-1705312200000", "name": "auth-feature", "goal": "Implement user authentication with JWT" }, "suggestedWorkflow": "feature", "allWorkflows": [ {"name": "cook", "description": "Full development cycle"}, {"name": "quickfix", "description": "Quick bug fix"}, {"name": "feature", "description": "New feature development"}, {"name": "refactor", "description": "Code refactoring"}, {"name": "review", "description": "Code review"}, {"name": "tdd", "description": "Test-driven development"}, {"name": "docs", "description": "Documentation"} ] } ``` -------------------------------- ### Check Current Documentation Tasks Source: https://github.com/nth5693/gemini-kit/blob/main/docs/specs/user-documentation/00-START-HERE.md This command displays the content of the tasks file, providing an overview of the current tasks related to user documentation. It helps in understanding the ongoing work and priorities. ```bash cat docs/specs/user-documentation/03-tasks.md ``` -------------------------------- ### Next.js Server and Client Component Examples Source: https://github.com/nth5693/gemini-kit/blob/main/skills/nextjs/SKILL.md Demonstrates the fundamental difference between Server Components (default, can directly access data) and Client Components (marked with 'use client', require state management). ```tsx // Server Component (default) async function UserProfile({ userId }: { userId: string }) { const user = await getUser(userId); // Direct DB access return
{user.name}
; } // Client Component 'use client'; import { useState } from 'react'; function Counter() { const [count, setCount] = useState(0); return ; } ``` -------------------------------- ### Git Pre-commit Hook Example Source: https://github.com/nth5693/gemini-kit/blob/main/agents/git-manager.md Shows a sample pre-commit hook script that runs linting and type checking before allowing a commit. This helps maintain code quality by enforcing standards automatically. ```bash # .husky/pre-commit #!/bin/sh npm run lint-staged npm run type-check ``` -------------------------------- ### Optimize Database Performance with Indexes Source: https://github.com/nth5693/gemini-kit/blob/main/skills/examples/supabase/references/common-patterns.md Provides examples of various indexing strategies including foreign key optimization, composite indexes for multi-column queries, and partial indexes for specific status filtering. ```sql -- Foreign key indexes (always) CREATE INDEX idx_transactions_fund_id ON transactions (fund_id); -- Composite index for fund + date queries CREATE INDEX idx_transactions_fund_date ON transactions (fund_id, created_at DESC); -- Partial index for pending items only CREATE INDEX idx_transactions_pending ON transactions (status, created_at) WHERE status = 'pending'; ``` -------------------------------- ### Search Before Solving with Bash Source: https://github.com/nth5693/gemini-kit/blob/main/docs/BEST-PRACTICES.md Execute a compound search using a bash script to find existing solutions or relevant information before starting to code. This helps avoid redundant work and leverages past knowledge. ```bash ./scripts/compound-search.sh "your problem keywords" ``` -------------------------------- ### Git Feature Branch Workflow Example Source: https://github.com/nth5693/gemini-kit/blob/main/agents/git-manager.md Demonstrates the standard workflow for creating and managing a feature branch, including committing changes and pushing to the remote repository. This is a common practice for developing new features in isolation. ```bash git checkout -b feature/new-feature # ... work ... git add -A git commit -m "feat: add new feature" git push origin feature/new-feature # Create PR ``` -------------------------------- ### Next.js App Router Structure Example Source: https://github.com/nth5693/gemini-kit/blob/main/skills/nextjs/SKILL.md Illustrates the standard directory structure for the Next.js App Router, including layouts, pages, loading states, error handling, not-found pages, route groups, and API routes. ```tree app/ ├── layout.tsx # Root layout ├── page.tsx # Home page ├── loading.tsx # Loading UI ├── error.tsx # Error UI ├── not-found.tsx # 404 page ├── (marketing)/ # Route group │ ├── about/ │ └── contact/ └── api/ └── route.ts # API route ``` -------------------------------- ### React Native Navigation Setup Source: https://github.com/nth5693/gemini-kit/blob/main/skills/mobile/SKILL.md Demonstrates how to set up basic navigation in a React Native application using `@react-navigation/native-stack`. It includes importing necessary components and defining a stack navigator with initial screens. ```tsx import { NavigationContainer } from '@react-navigation/native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; const Stack = createNativeStackNavigator(); function AppNavigator() { return ( ); } ``` -------------------------------- ### Initializing Script Environment Source: https://github.com/nth5693/gemini-kit/blob/main/scripts/lib/README.md Shows how to initialize a script's environment, including logging and configuration, by sourcing the integration wiring library. ```bash source ./scripts/lib/integration_wiring.sh # Logging and config now available ``` -------------------------------- ### Build and Run Gemini-Kit in a Docker Sandbox Source: https://github.com/nth5693/gemini-kit/blob/main/docs/SAFE-MODE.md This Dockerfile and associated commands allow you to run Gemini-Kit within a Docker container for maximum isolation. It sets up an Alpine-based Node.js environment, installs dependencies, and runs the container as a non-root user. ```dockerfile # Dockerfile.safe FROM node:20-alpine WORKDIR /app COPY . . RUN npm install # Run as non-root USER node ``` ```bash # Run in container docker build -f Dockerfile.safe -t gemini-kit-safe . docker run -it -v $(pwd):/app gemini-kit-safe gemini ``` -------------------------------- ### TSDoc API Documentation Source: https://github.com/nth5693/gemini-kit/blob/main/agents/docs-manager.md An example of documenting an asynchronous function using TSDoc syntax, including parameters, return types, error handling, and usage examples. ```typescript /** * Creates a new user in the system. * * @param userData - User creation data * @param userData.name - User's full name * @param userData.email - User's email address * @returns The created user object * @throws {ValidationError} If email is invalid * * @example * ```typescript * const user = await createUser({ * name: "John Doe", * email: "john@example.com" * }); * ``` */ async function createUser(userData: UserInput): Promise ``` -------------------------------- ### Generate Implementation Plans with /plan Source: https://context7.com/nth5693/gemini-kit/llms.txt The /plan command generates detailed implementation plans, supporting various modes like standard planning, comparing two approaches, fixing complex bugs, CRO optimization, and CI/CD fixes. ```bash # Standard planning > /plan Add user profile page # Output: plans/user-profile-page-20240115.md # Contains: # - Approach and alternatives considered # - Step-by-step implementation with code snippets # - Timeline estimates # - Security checklist # - Rollback plan # Compare two approaches > /plan:two REST vs GraphQL for mobile app # Complex bug fix planning > /plan:hard Fix checkout race condition causing double charges # CI/CD fix planning > /plan:ci Fix failing GitHub Actions workflow ``` -------------------------------- ### Documenting Solutions with Bash Source: https://github.com/nth5693/gemini-kit/blob/main/docs/BEST-PRACTICES.md After solving a problem, use a bash command to compound the solution, making it searchable and accessible for future reference. This promotes knowledge sharing and builds a collective understanding. ```bash /compound "How we solved X" ``` -------------------------------- ### kit_github_get_pr Source: https://context7.com/nth5693/gemini-kit/llms.txt Gets Pull Request details from GitHub with optional diff inclusion. ```APIDOC ## POST /kit_github_get_pr ### Description Gets Pull Request details from GitHub with optional diff inclusion. ### Method POST ### Endpoint /kit_github_get_pr ### Parameters #### Request Body - **prNumber** (integer) - Required - The number of the Pull Request. - **includeDiff** (boolean) - Optional - Whether to include the diff in the response. ### Request Example ```json { "prNumber": 123, "includeDiff": true } ``` ### Response #### Success Response (200) - **title** (string) - The title of the Pull Request. - **state** (string) - The current state of the Pull Request (e.g., 'open', 'closed'). - **author** (string) - The author of the Pull Request. - **labels** (array) - An array of labels applied to the Pull Request. - (string) - A label name. - **additions** (integer) - The number of lines added in the Pull Request. - **deletions** (integer) - The number of lines deleted in the Pull Request. - **changedFiles** (integer) - The number of files changed in the Pull Request. - **diff** (string) - The diff content of the Pull Request (only if includeDiff is true). #### Response Example ```json { "title": "feat: Add user authentication", "state": "open", "author": "developer", "labels": ["feature", "auth"], "additions": 450, "deletions": 23, "changedFiles": 12, "diff": "..." } ``` ``` -------------------------------- ### kit_get_next_step Source: https://context7.com/nth5693/gemini-kit/llms.txt Gets the prompt for the current workflow step with context from previous steps. ```APIDOC ## GET /kit_get_next_step ### Description Gets the prompt for the current workflow step with context from previous steps (just-in-time generation). ### Method GET ### Endpoint /kit_get_next_step ### Response #### Success Response (200) - **hasMore** (boolean) - Indicates if there are more steps in the workflow. - **stepIndex** (integer) - The index of the current step. - **step** (object) - Information about the current step. - **agent** (string) - The agent responsible for the step. - **description** (string) - Description of the step. - **prompt** (string) - The prompt for the current step, including context. - **remainingSteps** (integer) - The number of steps remaining in the workflow. - **completed** (boolean) - Indicates if the current step is completed. #### Response Example ```json { "hasMore": true, "stepIndex": 1, "step": { "agent": "scout", "description": "Find relevant files" }, "prompt": "You are a Scout agent. Find all relevant files and code for: Add user profile page\n\nContext from previous steps:\n{\"step_0_result\": \"Plan created with 4 phases...\"}", "remainingSteps": 3, "completed": false } ``` ``` -------------------------------- ### Execute Full Development Workflow with /cook Source: https://context7.com/nth5693/gemini-kit/llms.txt The /cook command initiates a complete development cycle including planning, coding, testing, and review, with automatic checkpointing and rollback. ```bash # Start a full development cycle for a feature > /cook Add user authentication with JWT # The workflow will: # 1. Create a git checkpoint before any changes # 2. Plan: Create detailed implementation plan # 3. Scout: Analyze codebase and find relevant files # 4. Code: Implement the solution # 5. Test: Create and run tests # 6. Review: Perform code review # If any step fails, automatically rollback to checkpoint ``` -------------------------------- ### kit_jira_get_ticket Source: https://context7.com/nth5693/gemini-kit/llms.txt Gets ticket details from Jira. Requires JIRA_BASE_URL, JIRA_EMAIL, and JIRA_API_TOKEN environment variables. ```APIDOC ## POST /kit_jira_get_ticket ### Description Gets ticket details from Jira. Requires JIRA_BASE_URL, JIRA_EMAIL, and JIRA_API_TOKEN environment variables. ### Method POST ### Endpoint /kit_jira_get_ticket ### Parameters #### Request Body - **ticketId** (string) - Required - The ID of the Jira ticket. ### Request Example ```json { "ticketId": "PROJ-123" } ``` ### Response #### Success Response (200) - **key** (string) - The key of the Jira ticket. - **summary** (string) - The summary of the ticket. - **status** (string) - The current status of the ticket. - **priority** (string) - The priority of the ticket. - **assignee** (string) - The assignee of the ticket. - **reporter** (string) - The reporter of the ticket. - **type** (string) - The type of the ticket (e.g., 'Story', 'Bug'). - **description** (string) - The description of the ticket. - **labels** (array) - An array of labels applied to the ticket. - (string) - A label name. #### Response Example ```json { "key": "PROJ-123", "summary": "Implement user authentication", "status": "In Progress", "priority": "High", "assignee": "John Developer", "reporter": "Product Owner", "type": "Story", "description": "As a user, I want to log in...", "labels": ["auth", "mvp"] } ``` ``` -------------------------------- ### Team Orchestration Tools Source: https://github.com/nth5693/gemini-kit/blob/main/docs/API.md Tools for managing and orchestrating teams of agents, including starting, stopping, and running workflows. ```APIDOC ## POST /kit_team_start ### Description Starts a new team of agents to work on a task. ### Method POST ### Endpoint /kit_team_start ### Parameters #### Request Body - **teamName** (string) - Required - Name of the team - **agents** (array) - Required - List of agent configurations - **task** (string) - Required - The task for the team to perform ### Response #### Success Response (200) - **teamId** (string) - Unique identifier for the started team ## GET /kit_team_status ### Description Retrieves the current status of a team of agents. ### Method GET ### Endpoint /kit_team_status ### Parameters #### Query Parameters - **teamId** (string) - Required - The ID of the team to check status for ### Response #### Success Response (200) - **status** (string) - Current status of the team (e.g., 'running', 'idle', 'completed') - **progress** (number) - Percentage of task completion ## POST /kit_team_end ### Description Ends a team of agents. ### Method POST ### Endpoint /kit_team_end ### Parameters #### Request Body - **teamId** (string) - Required - The ID of the team to end ### Response #### Success Response (200) - Success message indicating the team has been ended ## POST /kit_run_workflow ### Description Runs a predefined workflow with a team of agents. ### Method POST ### Endpoint /kit_run_workflow ### Parameters #### Request Body - **workflowName** (string) - Required - Name of the workflow to run - **teamId** (string) - Optional - ID of an existing team to use - **parameters** (object) - Optional - Parameters for the workflow ### Response #### Success Response (200) - **workflowRunId** (string) - Unique identifier for the workflow run ## POST /kit_smart_route ### Description Routes a task to the most appropriate agent or team. ### Method POST ### Endpoint /kit_smart_route ### Parameters #### Request Body - **task** (string) - Required - The task to route - **agents** (array) - Optional - List of available agents - **teams** (array) - Optional - List of available teams ### Response #### Success Response (200) - **route** (object) - Information about the chosen agent or team ## GET /kit_list_workflows ### Description Lists all available workflows. ### Method GET ### Endpoint /kit_list_workflows ### Response #### Success Response (200) - Array of workflow names ## GET /kit_session_history ### Description Retrieves the history of agent sessions. ### Method GET ### Endpoint /kit_session_history ### Parameters #### Query Parameters - **agentName** (string) - Optional - Filter history by agent name - **limit** (number) - Optional - Maximum number of sessions to retrieve ### Response #### Success Response (200) - Array of session history records ``` -------------------------------- ### AI Scout Prompt Template Source: https://github.com/nth5693/gemini-kit/blob/main/agents/scout.md A structured prompt template to guide AI agents in performing focused codebase exploration. ```markdown ## Prompt Template "Scout [project path] to learn about [topic]. - Tech stack: [framework, language] - Focus: [specific area] - Output: [structure, relevant files, patterns]" ``` -------------------------------- ### Run Project Tests Source: https://github.com/nth5693/gemini-kit/blob/main/CONTRIBUTING.md Commands to execute the test suite and generate coverage reports. Used to verify code integrity before submitting changes. ```bash npm test npm run test:coverage ``` -------------------------------- ### TypeScript Documentation and Logic Implementation Source: https://github.com/nth5693/gemini-kit/blob/main/agents/coder.md Example of using TSDoc for function documentation and implementing logic with clear inline comments. ```typescript /** * Calculates the total price including tax * @param items - Cart items * @param taxRate - Tax rate as decimal (e.g., 0.1 for 10%) * @returns Total price with tax */ function calculateTotal(items: Item[], taxRate: number): number { // Sum up item prices const subtotal = items.reduce((sum, item) => sum + item.price, 0); // Apply tax and round to 2 decimal places return Math.round(subtotal * (1 + taxRate) * 100) / 100; } ``` -------------------------------- ### SQL Migration Header and Idempotency Patterns Source: https://github.com/nth5693/gemini-kit/blob/main/skills/examples/supabase/references/best-practices.md Standardized header comments for tracking migration metadata and idempotent SQL patterns to ensure database scripts can be safely re-run without errors. ```sql -- Migration: Create app_role ENUM and profiles table for Identity Fortress -- Date: 2025-12-03 -- Purpose: Establish role-based authentication foundation with JWT custom claims -- Requirements: 4.1 -- Feature: identity-fortress -- Idempotent Table Creation CREATE TABLE IF NOT EXISTS profiles (...); -- Idempotent Type Handling DO $$ BEGIN CREATE TYPE status_type AS ENUM ('active', 'inactive'); EXCEPTION WHEN duplicate_object THEN null; END $$; ``` -------------------------------- ### GitHub Advanced Search Queries Source: https://github.com/nth5693/gemini-kit/blob/main/agents/researcher.md Common search patterns for finding repositories, code examples, and recent activity on GitHub using advanced query syntax. ```text # Find repos by language and stars language:typescript stars:>1000 topic:authentication # Find code examples extension:ts "useEffect" "useState" # Find recent activity pushed:>2024-01-01 language:go ``` -------------------------------- ### Core Tools - Project Context and Handoff Source: https://github.com/nth5693/gemini-kit/blob/main/docs/API.md Tools for gathering project context and transferring information between agents. ```APIDOC ## GET /kit_get_project_context ### Description Gather comprehensive project context including structure, dependencies, and recent changes. ### Method GET ### Endpoint /kit_get_project_context ### Parameters #### Query Parameters - **depth** (number) - Optional - Directory depth to scan (default: 2) ### Response #### Success Response (200) - **structure** (object) - File/directory tree - **package** (object) - Package info (if package.json exists) - **recentCommits** (array) - Last 5 git commits ## POST /kit_handoff_agent ### Description Transfer context from one agent to another in a workflow. ### Method POST ### Endpoint /kit_handoff_agent ### Parameters #### Request Body - **fromAgent** (string) - Required - Current agent name - **toAgent** (string) - Required - Target agent name - **context** (string) - Required - Context to pass - **artifacts** (array) - Optional - File paths of related artifacts ### Request Example ```json { "fromAgent": "planner", "toAgent": "coder", "context": "Plan complete. Implement auth module with JWT.", "artifacts": [".gemini-kit/artifacts/plan/auth-plan.md"] } ``` ### Response #### Success Response (200) - Success message indicating context transfer ``` -------------------------------- ### Get Learnings with Gemini-Kit Source: https://github.com/nth5693/gemini-kit/blob/main/docs/API.md Retrieves saved learnings, with options for semantic search, category filtering, and limiting results. Useful for recalling past knowledge or identifying patterns. ```json { "query": "typescript arrow functions", "limit": 3 } ``` -------------------------------- ### Multi-Stage Docker Build for Node.js Application Source: https://github.com/nth5693/gemini-kit/blob/main/skills/docker/SKILL.md This Dockerfile demonstrates a multi-stage build process for a Node.js application. It separates build dependencies from production runtime, resulting in a smaller and more secure production image. It includes steps for installing dependencies, building the application, copying artifacts, creating a non-root user, and setting up health checks and runtime commands. ```dockerfile # Stage 1: Build FROM node:20-alpine AS builder WORKDIR /app # Install dependencies first (cache layer) COPY package*.json ./ RUN npm ci # Build application COPY . . RUN npm run build # Stage 2: Production FROM node:20-alpine AS production WORKDIR /app # Create non-root user RUN addgroup -g 1001 -S nodejs && \ adduser -S nextjs -u 1001 # Copy only production dependencies COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/dist ./dist COPY --from=builder /app/package.json ./ # Run as non-root USER nextjs # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1 EXPOSE 3000 CMD ["node", "dist/server.js"] ``` -------------------------------- ### Optimize Queries and Avoid N+1 Source: https://github.com/nth5693/gemini-kit/blob/main/agents/database-admin.md Demonstrates the transition from inefficient N+1 query patterns to optimized JOIN operations for better performance. ```sql -- Bad: N+1 queries SELECT * FROM users; -- Then for each user: SELECT * FROM orders WHERE user_id = ?; -- Good: Single query with JOIN SELECT u.*, o.* FROM users u LEFT JOIN orders o ON o.user_id = u.id; ``` -------------------------------- ### Database Anti-Pattern Examples Source: https://github.com/nth5693/gemini-kit/blob/main/skills/examples/supabase/workflows/schema-design.md Demonstrates common database design mistakes to avoid, such as over-reliance on JSONB for core data and using non-timezone aware timestamps. ```sql -- BAD: Everything in JSON CREATE TABLE entities ( id UUID PRIMARY KEY, data JSONB ); -- BAD Timestamp created_at TIMESTAMP -- GOOD Timestamp created_at TIMESTAMPTZ ``` -------------------------------- ### Optimize Queries with Indexes Source: https://github.com/nth5693/gemini-kit/blob/main/skills/examples/supabase/workflows/schema-design.md Examples of creating indexes for foreign keys, composite indexes for multi-column queries, and partial unique indexes for data integrity. ```sql CREATE INDEX IF NOT EXISTS idx_transactions_fund_id ON transactions (fund_id); CREATE INDEX IF NOT EXISTS idx_transactions_fund_date ON transactions (fund_id, created_at DESC); CREATE UNIQUE INDEX IF NOT EXISTS idx_profiles_investor_code ON profiles (investor_code) WHERE investor_code IS NOT NULL; ``` -------------------------------- ### Manage Secrets and Security Auditing Source: https://github.com/nth5693/gemini-kit/blob/main/skills/security/SKILL.md Lists files that should be excluded from version control and provides common CLI commands for auditing dependencies and scanning for leaked secrets. ```bash # Never commit secrets .env .env.local *.pem *.key # NPM audit npm audit --audit-level=high # Check for leaked secrets npx secretlint "**/*" # Dependency vulnerabilities npx snyk test ``` -------------------------------- ### Configure Gemini-Kit for Safe Mode Source: https://github.com/nth5693/gemini-kit/blob/main/docs/SAFE-MODE.md Enable safe mode for Gemini-Kit by setting the 'safeMode' option to true in the .gemini/settings.json configuration file. This is the primary step for maximum safety. ```json // .gemini/settings.json { "gemini-kit": { "safeMode": true } } ``` -------------------------------- ### Create Reusable UI Components Source: https://github.com/nth5693/gemini-kit/blob/main/skills/tailwind/SKILL.md Examples of common UI patterns including cards, form inputs, and button variants using Tailwind utility classes. ```html

Card Title

Description...

``` -------------------------------- ### Search Solutions by Tag Source: https://github.com/nth5693/gemini-kit/blob/main/skills/compound-docs/SKILL.md Searches for solution files that contain a specific tag, such as 'performance', within their metadata. This helps in filtering solutions by category. ```bash # Search by tag grep -l "tags:.*performance" docs/solutions/**/*.md ``` -------------------------------- ### Next.js Metadata and SEO Configuration Source: https://github.com/nth5693/gemini-kit/blob/main/skills/nextjs/SKILL.md Provides examples for setting static metadata using the `metadata` object and dynamic metadata using `generateMetadata` for improved SEO in Next.js applications. ```tsx export const metadata: Metadata = { title: 'My App', description: 'App description', openGraph: { title: 'My App', images: ['/og-image.png'], }, }; // Dynamic metadata export async function generateMetadata({ params }): Promise { const post = await getPost(params.id); return { title: post.title }; } ``` -------------------------------- ### Create Migration Templates Source: https://github.com/nth5693/gemini-kit/blob/main/agents/database-admin.md A structured template for database migrations including Up and Down sections to manage schema evolution and rollbacks. ```sql -- Migration: 20241215_add_user_roles -- Description: Add roles table for RBAC -- Up CREATE TABLE roles ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), name VARCHAR(50) NOT NULL UNIQUE, created_at TIMESTAMP DEFAULT NOW() ); CREATE TABLE user_roles ( user_id UUID REFERENCES users(id), role_id UUID REFERENCES roles(id), PRIMARY KEY (user_id, role_id) ); -- Down DROP TABLE user_roles; DROP TABLE roles; ``` -------------------------------- ### Execute Frontend and Backend Tests Source: https://github.com/nth5693/gemini-kit/blob/main/skills/testing/SKILL.md Commands to run unit and integration tests for the frontend using npm/Vitest and backend API tests using pytest. Supports running all tests or filtering by specific test names. ```bash # Frontend (Unit/Integration) npm test npm test -- -t "ComponentName" # Backend (API) pytest pytest -k "test_name" ``` -------------------------------- ### Checking Session Status with Bash Source: https://github.com/nth5693/gemini-kit/blob/main/docs/BEST-PRACTICES.md Utilize bash commands to check the current state of the session, including pending work and active specifications. This is crucial at the start of each session to ensure continuity. ```bash cat skills/session-resume/SKILL.md ``` ```bash ls docs/specs/*/README.md ``` ```bash /status ``` -------------------------------- ### Optimize N+1 Queries Source: https://github.com/nth5693/gemini-kit/blob/main/skills/examples/supabase/workflows/debugging.md Demonstrates the transition from inefficient sequential queries to optimized single-query joins in TypeScript. ```typescript // ❌ BAD: N+1 queries const users = await supabase.from('users').select('*'); for (const user of users.data) { const profile = await supabase.from('profiles') .select('*') .eq('user_id', user.id); } // ✅ GOOD: Single query with join const users = await supabase .from('users') .select('*, profiles(*)'); // Add to supabaseClient.ts for debugging Logger.debug('[Supabase] Query:', { url, method }); ``` -------------------------------- ### Implement CSRF Protection Source: https://github.com/nth5693/gemini-kit/blob/main/skills/security/SKILL.md Configures CSRF protection middleware in an Express application using the csurf library. It demonstrates how to include the CSRF token in a hidden form field. ```typescript import csrf from 'csurf'; const csrfProtection = csrf({ cookie: true }); app.use(csrfProtection); // In form ```