Agent skill

auto-build

Skill for auto-detecting project type and executing builds. Suggests builds after code changes, proposes fixes for build errors. Supports Node.js, Rust, Python, Go, and Makefile projects.

Stars 1
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/dobachi/AI_Instruction_Kits/tree/main/templates/claude-skills/en/auto-build

SKILL.md

Auto Build Skill

Automatically detects project configuration and executes appropriate build commands.

Auto-Suggestion Triggers

Situation Suggestion
After code changes "Shall I run a build?"
After adding dependencies "Shall I install dependencies and build?"
After config file changes "Shall I run a clean build?"
On build error "Shall I fix the error and rebuild?"
Before tests "Shall I verify the build first?"

Project Type Detection

File Project Type Package Manager
package.json Node.js npm/yarn/pnpm
Cargo.toml Rust cargo
pyproject.toml Python pip/poetry
go.mod Go go
pom.xml Java (Maven) mvn
build.gradle Java (Gradle) gradle
Makefile Make make

Package Manager Detection (Node.js)

bash
# Priority order
if [ -f "pnpm-lock.yaml" ]; then
    PM="pnpm"
elif [ -f "yarn.lock" ]; then
    PM="yarn"
elif [ -f "bun.lockb" ]; then
    PM="bun"
else
    PM="npm"
fi

Build Commands

Node.js Projects

bash
# Install dependencies (if needed)
$PM install

# Standard build
$PM run build

# Production build
$PM run build:prod  # or NODE_ENV=production $PM run build

# Clean build
rm -rf dist node_modules/.cache && $PM run build

Rust Projects

bash
# Fetch dependencies
cargo fetch

# Debug build
cargo build

# Release build
cargo build --release

# Clean build
cargo clean && cargo build --release

Python Projects

bash
# Virtual environment (with pyproject.toml)
poetry install  # or pip install -e .

# Build
python -m build

# Create wheel
pip wheel .

Go Projects

bash
# Download dependencies
go mod download

# Build
go build

# Production build
CGO_ENABLED=0 go build -ldflags="-s -w"

Makefile Projects

bash
# Standard build
make

# Clean build
make clean && make

# Specific targets
make build
make release

Build Flow

┌─────────────────┐
│ Detect Project  │
└────────┬────────┘
         ↓
┌─────────────────┐
│ Check Deps      │ ──→ Install if missing
└────────┬────────┘
         ↓
┌─────────────────┐
│ Execute Build   │
└────────┬────────┘
         ↓
    ┌────┴────┐
    ↓         ↓
┌───────┐ ┌───────┐
│Success│ │Failed │ ──→ Analyze & suggest fix
└───────┘ └───────┘

Error Handling

Common Errors and Solutions

Error Cause Solution
MODULE_NOT_FOUND Missing dependency Run npm install
Type error TypeScript type error Fix type definitions
Syntax error Syntax error Fix the syntax
Out of memory Memory shortage NODE_OPTIONS=--max-old-space-size=4096

Error Analysis Flow

  1. Parse error message
  2. Identify error type
  3. Locate file and line
  4. Propose fix
  5. Apply fix and rebuild after user confirmation

Usage Scenarios

Scenario 1: After Code Changes

AI: Code has been modified. Shall I run a build?

# Detection result
Project type: Node.js (TypeScript)
Package manager: pnpm

# Execute
pnpm run build

Scenario 2: After Adding Dependencies

AI: New dependencies added. Shall I install and build?

# Execute
pnpm install && pnpm run build

Scenario 3: On Build Error

AI: Build error occurred.

Error: Cannot find module '@types/node'

Proposed fix:
1. Install @types/node
2. Rebuild

Proceed?

# Execute
pnpm add -D @types/node && pnpm run build

Scenario 4: Clean Build

AI: Config file changed. Clean build recommended.

# Execute
rm -rf dist .cache && pnpm run build

Project-Specific Configuration

Build settings can be specified in CLAUDE.md or PROJECT.md:

markdown
## Build Settings
- Build command: `npm run custom-build`
- Test command: `npm run test:all`
- Production build: `npm run build:prod`
- Pre-build: `npm run prebuild`

Decision Criteria

When to Suggest Build

  • Source code (.ts, .js, .rs, .py, .go) modified
  • Config files (tsconfig.json, Cargo.toml, etc.) modified
  • Dependency files (package.json, etc.) modified
  • User mentions "build" or "compile"

When to Suggest Clean Build

  • Build config files modified
  • Dependency versions changed
  • Previous build failed
  • Cache-related errors occurred

Notes

  • Check for unsaved changes before building
  • Show progress for long builds
  • Prompt for selection when multiple build targets exist
  • Consider CI/CD environment consistency

Expand your agent's capabilities with these related and highly-rated skills.

dobachi/AI_Instruction_Kits

auto-build

プロジェクトタイプを自動検出してビルドを実行するスキル。コード変更後にビルドを提案、エラー発生時は修正案を提示。Node.js、Rust、Python、Go、Makefileプロジェクトに対応。

1 0
Explore
dobachi/AI_Instruction_Kits

checkpoint-manager

タスクの進捗を追跡・管理するスキル。会話開始時に未完了タスクを確認、新規タスク依頼時にタスク開始を提案、作業完了時に完了報告を提案。チェックポイントシステムと連携。

1 0
Explore
dobachi/AI_Instruction_Kits

commit-safe

安全なコミットを支援するスキル。変更内容を確認してから選択的にコミット。大きな変更時にファイル指定コミットを提案、git add -Aの使用を防止。

1 0
Explore
dobachi/AI_Instruction_Kits

worktree-manager

Git worktreeの作成・管理を行うスキル。複雑なタスクや複数ファイル変更時にworktree作成を提案、タスク完了時にマージ・クリーンアップを案内。checkpoint-managerと連携。

1 0
Explore
dobachi/AI_Instruction_Kits

checkpoint-manager

Skill for tracking and managing task progress. Checks pending tasks at conversation start, proposes task creation for new requests, suggests completion reports when work is done. Integrates with checkpoint system.

1 0
Explore
dobachi/AI_Instruction_Kits

commit-safe

Skill for safe commits. Reviews changes before selective commits. Proposes file-specific commits for large changes, prevents use of git add -A.

1 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results