Engineering Tools for AI

Lập trình

Môi trường chạy theo ngôn ngữ

Hướng dẫn tra cứu runtime, compiler, package manager và file cấu hình cần để chạy các ngôn ngữ phổ biến.

34 mục

Khái niệm chung

Runtime

Runtime

node index.js

Ý nghĩa

A program or environment that actually runs code.

Khi dùng

Node.js runs JavaScript, Python runs .py files, and the JVM runs compiled Java bytecode.

Ví dụ

node index.js

Ví dụ yêu cầu

Explain which runtime this project needs.

Khái niệm chung

Compiler

Compiler

gcc main.c -o main

Ý nghĩa

A tool that turns source code into another form, often an executable file.

Khi dùng

C, C++, Rust, Go, and Java usually need a compilation step before or during execution.

Ví dụ

gcc main.c -o main

Ví dụ yêu cầu

Tell me which compiler command is needed for this file.

Khái niệm chung

Interpreter

Interpreter

python3 main.py

Ý nghĩa

A program that reads and runs source code directly or with minimal preparation.

Khi dùng

Python is commonly run through an interpreter, while C is commonly compiled first.

Ví dụ

python3 main.py

Ví dụ yêu cầu

Explain whether this language is interpreted or compiled in normal use.

Khái niệm chung

PATH

PATH

echo $PATH

Ý nghĩa

A list of folders the terminal searches when you type a command.

Khi dùng

If python, node, go, cargo, or javac is not found, PATH is one of the first settings to check.

Lưu ý

Editing PATH incorrectly can make normal commands disappear from the terminal.

Ví dụ

echo $PATH

Ví dụ yêu cầu

Check whether the needed runtime command is on PATH.

Khái niệm chung

Version check

Version check

python3 --version && node -v && go version

Ý nghĩa

A command pattern for confirming which runtime or compiler version is installed.

Khi dùng

Use it before debugging version-specific build or package errors.

Ví dụ

python3 --version && node -v && go version

Ví dụ yêu cầu

List the version check commands for this language.

Khái niệm chung

Package manager

Package manager

pip install requests

Ý nghĩa

A tool that installs and records third-party libraries.

Khi dùng

pip, npm, cargo, go modules, Maven, and Gradle all handle dependencies in different ecosystems.

Ví dụ

pip install requests

Ví dụ yêu cầu

Explain which package manager this project uses.

Python

python3

python3

python3 main.py

Ý nghĩa

The common command for running Python 3 scripts.

Khi dùng

Use it to run a .py file directly or to create a virtual environment.

Ví dụ

python3 main.py

Ví dụ yêu cầu

Show how to run this Python file.

Python

venv

venv

python3 -m venv .venv

Ý nghĩa

A per-project Python environment for isolating installed packages.

Khi dùng

Use it when different projects need different package versions.

Lưu ý

After creating it, activate the environment before installing packages.

Ví dụ

python3 -m venv .venv

Ví dụ yêu cầu

Create and explain a Python virtual environment for this project.

Python

Activate venv

activate

source .venv/bin/activate

Ý nghĩa

Switches the terminal to use the Python and pip inside the virtual environment.

Khi dùng

Use it before pip install or python commands in that project.

Ví dụ

source .venv/bin/activate

Ví dụ yêu cầu

Tell me whether the Python virtual environment is active.

Python

pip

pip

pip install requests

Ý nghĩa

Python's package installation tool.

Khi dùng

Use it to install libraries listed by a project or needed by a script.

Lưu ý

Make sure pip belongs to the same Python environment you will run.

Ví dụ

pip install requests

Ví dụ yêu cầu

Check which Python environment this pip command uses.

Python

requirements.txt

requirements.txt

pip install -r requirements.txt

Ý nghĩa

A text file listing Python packages to install.

Khi dùng

Use it to recreate a project's Python package environment.

Ví dụ

pip install -r requirements.txt

Ví dụ yêu cầu

Install packages from requirements.txt in the active venv.

C

gcc

gcc

gcc main.c -o main

Ý nghĩa

A common compiler for C source files.

Khi dùng

Use it to turn main.c into an executable file.

Lưu ý

Compiling creates an executable; it does not automatically run it.

Ví dụ

gcc main.c -o main

Ví dụ yêu cầu

Compile this C file and explain the output executable.

C

clang

clang

clang main.c -o main

Ý nghĩa

A C compiler commonly available on macOS through Xcode Command Line Tools.

Khi dùng

Use it as an alternative to gcc for compiling C files.

Ví dụ

clang main.c -o main

Ví dụ yêu cầu

Check whether clang is installed and compile this C file.

C

.h header file

.h header file

#include "math_utils.h"

Ý nghĩa

A file that usually declares functions, types, constants, or shared interfaces for C code.

Khi dùng

Use it when multiple .c files need to share declarations.

Ví dụ

#include "math_utils.h"

Ví dụ yêu cầu

Explain how this header file connects to the C source files.

C

Makefile

Makefile

make

Ý nghĩa

A file that defines build commands and dependencies for make.

Khi dùng

Use it when compiling a C or C++ project needs multiple repeated commands.

Ví dụ

make

Ví dụ yêu cầu

Explain what this Makefile builds.

C++

g++

g++

g++ main.cpp -std=c++20 -o main

Ý nghĩa

A common compiler command for C++ source files.

Khi dùng

Use g++ instead of gcc when compiling C++ code.

Ví dụ

g++ main.cpp -std=c++20 -o main

Ví dụ yêu cầu

Compile this C++ file with the right standard option.

C++

C++ standard

C++ standard

-std=c++20

Ý nghĩa

A setting that tells the compiler which C++ language version to use.

Khi dùng

Use it when code depends on features from C++17, C++20, or another standard.

Lưu ý

A project can fail if the compiler is too old for the selected standard.

Ví dụ

-std=c++20

Ví dụ yêu cầu

Tell me which C++ standard this code needs.

C++

CMake

CMake

cmake -S . -B build

Ý nghĩa

A build configuration tool often used for C and C++ projects.

Khi dùng

Use it when a project has CMakeLists.txt instead of a simple single-file compile command.

Ví dụ

cmake -S . -B build

Ví dụ yêu cầu

Explain the CMake configure and build commands for this project.

Go

go

go

go version

Ý nghĩa

The main command for running, building, testing, and managing Go modules.

Khi dùng

Use it for go run, go build, go test, go mod, and dependency management.

Ví dụ

go version

Ví dụ yêu cầu

Check the installed Go version.

Go

go run

go run

go run main.go

Ý nghĩa

Compiles and runs Go code in one command.

Khi dùng

Use it while developing a small Go program or testing a main package quickly.

Ví dụ

go run main.go

Ví dụ yêu cầu

Run this Go program and explain any errors.

Go

go.mod

go.mod

go mod init example.com/my-app

Ý nghĩa

The file that defines a Go module and its dependency requirements.

Khi dùng

Use it as the project boundary for Go dependency and import resolution.

Ví dụ

go mod init example.com/my-app

Ví dụ yêu cầu

Explain what this go.mod file defines.

Go

go mod tidy

go mod tidy

go mod tidy

Ý nghĩa

Adds missing Go module requirements and removes unused ones.

Khi dùng

Use it after changing imports or before committing Go dependency changes.

Ví dụ

go mod tidy

Ví dụ yêu cầu

Run go mod tidy and summarize dependency changes.

JavaScript / Node.js

Node.js

Node.js

node index.js

Ý nghĩa

A runtime for running JavaScript outside the browser.

Khi dùng

Use it for backend scripts, build tools, and web framework tooling such as Next.js.

Lưu ý

Browser JavaScript and Node.js do not have exactly the same APIs.

Ví dụ

node index.js

Ví dụ yêu cầu

Check whether this JavaScript code is meant for Node.js or the browser.

JavaScript / Node.js

npm

npm

npm install

Ý nghĩa

The default package manager installed with Node.js.

Khi dùng

Use it to install packages and run scripts defined in package.json.

Ví dụ

npm install

Ví dụ yêu cầu

Explain the npm scripts in this package.json.

JavaScript / Node.js

package.json

package.json

"scripts": { "dev": "next dev" }

Ý nghĩa

A Node.js project file that records scripts, dependencies, and package metadata.

Khi dùng

Use it to understand npm run dev, npm run build, and required packages.

Ví dụ

"scripts": { "dev": "next dev" }

Ví dụ yêu cầu

Tell me what commands this package.json exposes.

JavaScript / Node.js

nvm

nvm

nvm use

Ý nghĩa

A tool for switching Node.js versions per project.

Khi dùng

Use it when a project requires a specific Node version.

Ví dụ

nvm use

Ví dụ yêu cầu

Check whether this project specifies a Node version.

Rust

rustup

rustup

rustup show

Ý nghĩa

The recommended tool for installing and managing Rust toolchains.

Khi dùng

Use it to install Rust, switch stable/nightly, or add targets.

Ví dụ

rustup show

Ví dụ yêu cầu

Check the active Rust toolchain.

Rust

rustc

rustc

rustc main.rs

Ý nghĩa

The Rust compiler.

Khi dùng

Use it for simple single-file Rust experiments, though real projects usually use cargo.

Ví dụ

rustc main.rs

Ví dụ yêu cầu

Explain whether this Rust project should use rustc or cargo.

Rust

cargo

cargo

cargo run

Ý nghĩa

Rust's package manager, build tool, test runner, and project runner.

Khi dùng

Use cargo run, cargo build, and cargo test for normal Rust projects.

Ví dụ

cargo run

Ví dụ yêu cầu

Run this Rust project with cargo and explain the output.

Rust

Cargo.toml

Cargo.toml

[dependencies]

Ý nghĩa

The manifest file that defines a Rust package, metadata, and dependencies.

Khi dùng

Use it to understand which crates the Rust project depends on.

Ví dụ

[dependencies]

Ví dụ yêu cầu

Explain the dependencies in this Cargo.toml.

Java

JDK

JDK

java -version

Ý nghĩa

The Java Development Kit includes tools needed to compile and run Java programs.

Khi dùng

Use it when a project needs javac, java, Maven, Gradle, or another Java build tool.

Ví dụ

java -version

Ví dụ yêu cầu

Check whether a JDK is installed and which version is active.

Java

javac

javac

javac Main.java

Ý nghĩa

The Java compiler that turns .java files into .class bytecode files.

Khi dùng

Use it for simple Java files or to understand what build tools do internally.

Ví dụ

javac Main.java

Ví dụ yêu cầu

Compile this Java file and explain the generated class file.

Java

java

java

java Main

Ý nghĩa

Runs compiled Java classes on the JVM.

Khi dùng

Use it after compiling a simple Java program with javac.

Lưu ý

Run java Main, not java Main.class.

Ví dụ

java Main

Ví dụ yêu cầu

Show the compile and run commands for this Java file.

Java

Maven / Gradle

Maven / Gradle

mvn test / ./gradlew test

Ý nghĩa

Common Java build tools for dependencies, tests, packaging, and project tasks.

Khi dùng

Use Maven when a project has pom.xml and Gradle when it has build.gradle or gradlew.

Ví dụ

mvn test / ./gradlew test

Ví dụ yêu cầu

Tell me whether this Java project uses Maven or Gradle.