<- Back to Software Development

Common Programming File Types Beyond Normal Source Code

June 10, 20269 min read
Share

Programming projects contain many file types beyond normal source code. These files usually exist because tools need configuration, documentation, dependency metadata, database instructions, deployment rules, API contracts, environment variables, or structured AI prompts. Once you understand which tool reads the file, the file type becomes much easier to understand.

Short Answer

A file type tells the developer and the toolchain what kind of content is inside a file.

It usually answers four questions:

  • Is this file configuration?
  • Is this file documentation or content?
  • Is this file structured data?
  • Which tool is supposed to read this file?
File TypeMain PurposeCommon Reader
.json, .yaml, .toml, .iniConfiguration or structured dataApp, framework, DevOps tool
.xmlStrict structured markupMaven, Android, SOAP, enterprise tools
.md, .mdxDocumentation and rich contentDocumentation site or blog engine
.sqlDatabase schema and queriesDatabase engine
.envEnvironment variablesApplication runtime
Dockerfile, .dockerignoreContainer build rulesDocker
.sh, .ps1Automation scriptsShell or PowerShell
.proto, .graphqlAPI contractsAPI tooling
.lock filesExact dependency versionsPackage manager
.pem, .crt, .keyCertificates and keysTLS, SSH, infrastructure tools
.prompt, .prompty, .pomlAI prompt structureAI tooling or agent framework

The extension is not decoration. It is a signal to the toolchain.

The Main Categories

Most non-source programming file types fit into a few practical groups.

Common Non-Source File Responsibilities
  1. 1ConfigurationControls tools, frameworks, and runtime behavior
  2. 2ContentStores documentation, articles, and UI text
  3. 3DataMoves structured information between systems
  4. 4AutomationRuns build, deploy, and maintenance tasks
  5. 5ContractsDefines APIs, schemas, and communication formats
  6. 6Security FilesStores certificates, keys, and secure connection material

A backend project may contain pom.xml, application.properties, .sql, .env, Dockerfile, docker-compose.yml, .gitignore, .md, and lock files.

A frontend or documentation project may contain package.json, tsconfig.json, .mdx, .env, .svg, .json, .yaml, and lock files.

These files are not random. They separate different project responsibilities.

Configuration Files

Configuration files tell tools how to behave.

They are usually not business logic. They are instructions for frameworks, compilers, package managers, deployment systems, and runtime environments.

File TypeCommon FilePurpose
.jsonpackage.jsonNode.js package metadata and scripts
.jsontsconfig.jsonTypeScript compiler config
.js, .mjs, .cjsnext.config.mjsNext.js configuration
.yaml, .ymldocker-compose.ymlMulti-container local setup
.yaml, .ymlGitHub Actions workflowCI/CD pipeline
.tomlpyproject.tomlPython project config
.iniconfig.iniSimple key-value config
.propertiesapplication.propertiesJava / Spring Boot config
.gradlebuild.gradleGradle build config
.env.envRuntime environment variables

Example package.json:

{
  "scripts": {
    "dev": "next dev",
    "build": "next build"
  },
  "dependencies": {
    "next": "^16.0.0",
    "react": "^19.0.0"
  }
}

Example .env:

DATABASE_URL=postgresql://user:password@localhost:5432/app
PORT=3000

The key difference is ownership. package.json is read by Node.js package managers. tsconfig.json is read by TypeScript. .env is loaded by the application runtime or environment loader.

JSON, YAML, TOML, and INI

These formats are often used for configuration and structured data.

They can store similar information, but they have different trade-offs.

FormatStrengthWeaknessCommon Use
JSONStrict and machine-friendlyStandard JSON has no commentsAPIs, Node config, data exchange
YAMLEasy to read for nested configIndentation mistakes are commonDevOps, CI/CD, Kubernetes
TOMLClear config formatLess common than JSON/YAMLPython, Rust, tool config
INIVery simple key-value styleWeak for complex nested configOlder apps, simple config files

Example JSON:

{
  "name": "backend-service",
  "port": 3000
}

Example YAML:

name: backend-service
port: 3000

Example TOML:

name = "backend-service"
port = 3000

Example INI:

name=backend-service
port=3000

JSON is common when machines exchange data. YAML is common when humans write infrastructure config. TOML is common in some modern language ecosystems. INI is common when the config is small and flat.

XML Files

XML means Extensible Markup Language.

XML is a strict markup format that represents structured data with tags.

Example:

<user>
  <id>1001</id>
  <name>Alex</name>
  <role>admin</role>
</user>

XML is verbose, but it has several strengths:

  • explicit opening and closing tags
  • strict tree structure
  • good support for schemas
  • mature parser support
  • common in older enterprise systems
  • common in Java and Android ecosystems

You will often see XML in these places:

File / AreaWhy XML Appears
pom.xmlMaven uses XML to define Java project builds and dependencies
Android layout filesAndroid historically used XML for UI layouts and app configuration
SOAP APIsSOAP messages are XML-based
Enterprise integrationOlder enterprise tools often standardize on XML
Office document formatsSome document formats use zipped XML internally
RSS feedsMany feeds are XML documents
SVG filesSVG is XML-based vector graphics

A common Java example is Maven's pom.xml.

<project>
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.example</groupId>
  <artifactId>demo-service</artifactId>
  <version>1.0.0</version>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
  </dependencies>
</project>

This file tells Maven:

  • what the project is called
  • what version it is
  • what dependencies it needs
  • what plugins should run
  • how the project should be packaged

The important point: XML is not only for data. In many ecosystems, XML is used as configuration, build definition, UI layout, and message format.

Markdown and MDX Files

Markdown is used for readable documentation.

File TypePurposeCommon Use
.mdPlain MarkdownREADME, docs, notes
.mdxMarkdown plus JSX componentsBlog posts, component docs, interactive documentation

Example Markdown:

## Installation

Run this from the project root:

```bash
npm install

MDX adds component support.

Example MDX:

```mdx
<CardGrid columns={2}>
  <InfoCard title="Measure First">
    Find the bottleneck before changing the architecture.
  </InfoCard>

  <InfoCard title="Fix the Highest Cost">
    Optimize the part that creates the most user-visible delay.
  </InfoCard>
</CardGrid>

In a normal documentation repo, .md is enough.

In a blog or documentation site that needs custom UI components, .mdx is more useful.

The risk is that MDX can break the build if JSX is invalid or required components are missing.

Database Files

Database-related files define schema, queries, migrations, seed data, and exports.

File TypePurposeCommon Use
.sqlSQL commandsSchema, queries, migrations
.prismaPrisma schemaDatabase models and generated client
.csvTabular dataExports, imports, seed data
.sqlite, .dbDatabase fileLocal SQLite database
.dumpDatabase dumpBackup and restore

Example SQL migration:

CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  email TEXT NOT NULL UNIQUE,
  created_at TIMESTAMP NOT NULL DEFAULT NOW()
);

This file is usually read by the database engine or migration tool.

A .sql file is not application code, but it can change the structure and behavior of the database. That makes it very important in backend projects.

API Contract Files

API contract files define how systems communicate.

File TypePurposeCommon Use
.protoProtocol Buffers schemagRPC services
.graphqlGraphQL schema or queryGraphQL APIs
.wsdlWeb service definitionSOAP services
.avscAvro schemaKafka and data pipelines
.jsonOpenAPI documentREST API documentation
.yamlOpenAPI documentREST API documentation

Example .proto:

syntax = "proto3";

service UserService {
  rpc GetUser (GetUserRequest) returns (UserResponse);
}

message GetUserRequest {
  string id = 1;
}

message UserResponse {
  string id = 1;
  string email = 2;
}

This file does not implement the service. It defines the contract.

The server and client can generate code from it so both sides agree on the same communication shape.

Automation and Shell Files

Automation files are used to run commands repeatedly and consistently.

File TypePurposeCommon Use
.shShell scriptLinux/macOS automation
.ps1PowerShell scriptWindows automation
.bat, .cmdWindows command scriptOlder Windows automation
MakefileTask runnerBuild and maintenance commands
.github/workflows/*.ymlCI/CD workflowGitHub Actions automation

Example shell script:

#!/usr/bin/env bash

npm install
npm run build

Example PowerShell script:

npm install
npm run build

These files are useful because they reduce manual repetition.

Instead of remembering ten commands, the team can run one script.

Container and Deployment Files

Deployment files describe how the application runs outside the local machine.

File TypePurposeCommon Use
DockerfileBuild a container imageApp containerization
.dockerignoreExclude files from Docker build contextFaster, cleaner Docker builds
docker-compose.ymlRun multiple containers locallyApp + database + Redis
.tfTerraform configCloud infrastructure
.k8s.yml, .yamlKubernetes resourcesDeployment, service, ingress
nginx.confNginx configurationReverse proxy, static serving, routing

Example Dockerfile:

FROM node:22-alpine

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .
RUN npm run build

CMD ["npm", "start"]

This file is not application logic. It defines how to package and run the application environment.

Dependency and Lock Files

Dependency files tell the project what packages it needs.

Lock files record the exact resolved versions.

File TypeEcosystemPurpose
package.jsonNode.jsDeclares dependencies and scripts
package-lock.jsonnpmLocks exact dependency tree
yarn.lockYarnLocks exact dependency tree
pnpm-lock.yamlpnpmLocks exact dependency tree
pom.xmlMaven / JavaDeclares Java dependencies and build config
build.gradleGradle / JavaDeclares dependencies and build logic
requirements.txtPythonLists Python packages
poetry.lockPython PoetryLocks exact dependency versions
go.modGoDeclares Go module dependencies
go.sumGoVerifies dependency checksums
Cargo.tomlRustDeclares Rust package metadata and dependencies
Cargo.lockRustLocks exact dependency versions

Do not delete lock files randomly.

Lock files help make installs reproducible across machines, CI/CD, and production.

Git and Ignore Files

Git-related files control version history and what should not be committed.

File TypePurpose
.gitignoreTells Git which files to ignore
.gitattributesControls Git behavior for file types
.gitmodulesTracks Git submodules

Example .gitignore:

node_modules
.env
dist
.next

This prevents generated files, dependencies, and secrets from being committed.

A good .gitignore protects the repository from noise and accidental leaks.

Logs, Certificates, and Binary Files

Not every file in a project is source text.

Some files are generated outputs, runtime artifacts, or binary resources.

File TypePurposeCommon Use
.logRuntime logsDebugging, server output
.pem, .key, .crtCertificates and keysTLS, SSH, secure connections
.png, .jpg, .webpImagesUI assets
.pdfDocument outputReports, invoices
.zip, .tar, .gzArchivesPackage or backup files
.wasmWebAssembly binaryBrowser or edge runtime modules
.mapSource mapDebug bundled JavaScript

These files are often not meant to be manually edited.

Some should not be committed at all, especially private keys, local logs, and generated build artifacts.

AI and Prompt Files

Modern AI projects sometimes introduce prompt-specific files.

File TypePurposeCommon Use
.promptPlain prompt textSimple reusable prompts
.promptyStructured prompt filePrompt engineering workflows
.pomlPrompt orchestration markupStructured AI instructions and agent behavior
.jsonPrompt config or evaluation dataDataset, test case, config
.yamlAgent or workflow configTool routing, model settings

A normal prompt can become hard to maintain when it contains:

  • role definition
  • task definition
  • tool rules
  • input variables
  • output schema
  • examples
  • evaluation cases

That is why some teams move prompts into structured files.

A simplified POML-like shape may look like this:

<prompt>
  <role>
    You are a customer support assistant.
  </role>

  <task>
    Answer using only the provided context.
  </task>

  <output-format>
    Return a short answer with source references.
  </output-format>
</prompt>

The goal is not to replace programming languages. The goal is to make prompt behavior easier to version, review, and reuse.

How to Read an Unknown File Type

When you see a file type you do not know, do not memorize it blindly.

Use this inspection workflow:

1. Check the File Name

Some filenames reveal ownership directly, such as tsconfig.json, pom.xml, Dockerfile, or package.json.

2. Check the Syntax

Braces suggest JSON or code. Indentation may suggest YAML. Tags suggest XML or HTML. SQL keywords suggest database scripts.

3. Check the Tool

Ask which tool reads the file. TypeScript reads tsconfig.json. Maven reads pom.xml. Docker reads Dockerfile.

4. Check Whether It Is Source or Generated

Source files should be edited. Generated files, lock files, logs, and build outputs should be handled more carefully.

The best question is:

Who consumes this file?

Once you know the consumer, the file type becomes much easier to understand.

Practical Decision Rule

Use this table when deciding what a file probably does.

If the File Is ForIt Is Usually
Tool settingsJSON, YAML, TOML, INI, properties
Java build and dependenciespom.xml or build.gradle
Rich technical articleMDX
Plain documentationMarkdown
Database structureSQL or ORM schema file
API contractProto, GraphQL, OpenAPI, WSDL
DeploymentDockerfile, YAML, Terraform, Nginx config
AutomationShell, PowerShell, Makefile
Secrets and runtime settings.env, environment config
Exact dependency versionsLock file
Prompt orchestrationPrompt file, Promty, POML
Certificates and secure connection materialPEM, CRT, KEY files

File types are not random. They are boundaries between different responsibilities in a software project.

The Main Principle

Different file types exist because programming projects contain different kinds of information.

Configuration files control tools. Markdown explains. MDX renders rich content. XML represents strict structured markup. JSON and YAML move or configure structured data. SQL controls databases. Docker and CI files automate deployment. Lock files preserve dependency consistency. Certificate files support secure communication. Prompt files structure AI behavior.

When you see a new file type, do not ask only what the extension means. Ask which tool reads it, what responsibility it owns, and whether it is meant to be edited by humans or generated by machines.

编程项目里面除了普通源码以外,还会出现很多其他文件类型。这些文件通常是为了让工具读取配置、文档、依赖信息、数据库指令、部署规则、API contract、环境变量,或者结构化 AI prompt。只要你知道是哪一个工具读取这个文件,这个文件类型就会容易理解很多。

简短答案

文件类型会告诉 developer 和 toolchain:这个文件里面大概是什么内容。

它通常回答四个问题:

  • 这个文件是不是配置?
  • 这个文件是不是文档或内容?
  • 这个文件是不是结构化数据?
  • 哪一个工具应该读取这个文件?
文件类型主要用途常见读取者
.json, .yaml, .toml, .ini配置或结构化数据App、framework、DevOps tool
.xml严格结构化标记Maven、Android、SOAP、企业工具
.md, .mdx文档和 rich content文档站或 blog engine
.sql数据库 schema 和 queryDatabase engine
.env环境变量Application runtime
Dockerfile, .dockerignoreContainer build rulesDocker
.sh, .ps1自动化脚本Shell 或 PowerShell
.proto, .graphqlAPI contractAPI tooling
.lock files精确 dependency versionPackage manager
.pem, .crt, .keyCertificate 和 keyTLS、SSH、infra tool
.prompt, .prompty, .pomlAI prompt structureAI tooling 或 agent framework

文件 extension 不是装饰。它是给 toolchain 的信号。

主要分类

大多数非源码文件类型都可以放进几个实际分类。

常见非源码文件职责
  1. 1配置控制工具、框架和运行时行为
  2. 2内容保存文档、文章和 UI 文案
  3. 3数据在系统之间传递结构化信息
  4. 4自动化执行构建、部署和维护任务
  5. 5契约定义 API、schema 和通信格式
  6. 6安全文件保存 certificate、key 和安全连接材料

一个 backend 项目可能有 pom.xmlapplication.properties.sql.envDockerfiledocker-compose.yml.gitignore.md、lock file。

一个 frontend 或 documentation 项目可能有 package.jsontsconfig.json.mdx.env.svg.json.yaml、lock file。

这些文件不是随机出现的。它们是在拆分不同的项目责任。

配置文件

配置文件告诉工具应该怎样运行。

它们通常不是业务逻辑,而是给 framework、compiler、package manager、deployment system、runtime environment 的指令。

文件类型常见文件目的
.jsonpackage.jsonNode.js package metadata 和 scripts
.jsontsconfig.jsonTypeScript compiler config
.js, .mjs, .cjsnext.config.mjsNext.js configuration
.yaml, .ymldocker-compose.yml本地多 container 配置
.yaml, .ymlGitHub Actions workflowCI/CD pipeline
.tomlpyproject.tomlPython project config
.iniconfig.ini简单 key-value config
.propertiesapplication.propertiesJava / Spring Boot config
.gradlebuild.gradleGradle build config
.env.envRuntime environment variables

package.json 例子:

{
  "scripts": {
    "dev": "next dev",
    "build": "next build"
  },
  "dependencies": {
    "next": "^16.0.0",
    "react": "^19.0.0"
  }
}

.env 例子:

DATABASE_URL=postgresql://user:password@localhost:5432/app
PORT=3000

重点是 ownership。package.json 是给 Node.js package manager 读的。tsconfig.json 是给 TypeScript 读的。.env 是给 application runtime 或 environment loader 读的。

JSON、YAML、TOML、INI

这些格式经常被用来写配置和结构化数据。

它们可以保存类似的信息,但 trade-off 不一样。

格式优点缺点常见用途
JSON严格、适合机器读取标准 JSON 不支持 commentAPI、Node config、data exchange
YAML嵌套配置比较好读indentation 错误很常见DevOps、CI/CD、Kubernetes
TOML配置格式清楚没有 JSON/YAML 那么常见Python、Rust、tool config
INI非常简单的 key-value 格式不适合复杂嵌套配置旧应用、简单 config

JSON 例子:

{
  "name": "backend-service",
  "port": 3000
}

YAML 例子:

name: backend-service
port: 3000

TOML 例子:

name = "backend-service"
port = 3000

INI 例子:

name=backend-service
port=3000

JSON 常用于机器之间交换数据。YAML 常用于人手写 infrastructure config。TOML 在一些现代语言生态里比较常见。INI 适合很小、很平的配置。

XML 文件

XML 是 Extensible Markup Language。

XML 是一种严格的 markup format,用 tag 表示结构化数据。

例子:

<user>
  <id>1001</id>
  <name>Alex</name>
  <role>admin</role>
</user>

XML 很啰嗦,但它有几个优点:

  • opening tag 和 closing tag 很明确
  • tree structure 严格
  • schema 支持成熟
  • parser 生态成熟
  • 常见于旧企业系统
  • 常见于 Java 和 Android 生态

你经常会在这些地方看到 XML:

文件 / 场景为什么会出现 XML
pom.xmlMaven 用 XML 定义 Java project build 和 dependency
Android layout filesAndroid 过去常用 XML 写 UI layout 和 app config
SOAP APIsSOAP message 是基于 XML 的
Enterprise integration旧企业工具经常标准化使用 XML
Office document formats一些文档格式内部是 zipped XML
RSS feeds很多 feed 是 XML document
SVG filesSVG 本质上是 XML-based vector graphics

Java 里面常见例子是 Maven 的 pom.xml

<project>
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.example</groupId>
  <artifactId>demo-service</artifactId>
  <version>1.0.0</version>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
  </dependencies>
</project>

这个文件告诉 Maven:

  • project 叫什么
  • 当前版本是什么
  • 需要哪些 dependencies
  • 要跑哪些 plugins
  • 这个 project 应该怎样被 package

重点是:XML 不只是数据格式。在很多生态里面,XML 会被用作 configuration、build definition、UI layout 和 message format。

Markdown 和 MDX 文件

Markdown 用来写可读性高的文档。

文件类型目的常见用途
.md普通 MarkdownREADME、docs、notes
.mdxMarkdown 加 JSX componentBlog post、component docs、interactive documentation

Markdown 例子:

## Installation

Run this from the project root:

```bash
npm install

MDX 增加了 component 支持。

MDX 例子:

```mdx
<CardGrid columns={2}>
  <InfoCard title="Measure First">
    Find the bottleneck before changing the architecture.
  </InfoCard>

  <InfoCard title="Fix the Highest Cost">
    Optimize the part that creates the most user-visible delay.
  </InfoCard>
</CardGrid>

普通 documentation repo 用 .md 就够了。

如果是需要 custom UI component 的 blog 或 documentation site,.mdx 更有用。

风险是:MDX 不是纯文字。如果 JSX 写错,或者 component 不存在,build 可能会直接失败。

数据库文件

数据库相关文件用来定义 schema、query、migration、seed data 和 export。

文件类型目的常见用途
.sqlSQL commandSchema、query、migration
.prismaPrisma schemaDatabase model 和 generated client
.csv表格数据Export、import、seed data
.sqlite, .dbDatabase file本地 SQLite database
.dumpDatabase dumpBackup 和 restore

SQL migration 例子:

CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  email TEXT NOT NULL UNIQUE,
  created_at TIMESTAMP NOT NULL DEFAULT NOW()
);

这个文件通常是给 database engine 或 migration tool 读取的。

.sql 不是 application code,但它可以改变数据库结构和行为。所以在 backend 项目里面,它非常重要。

API Contract 文件

API contract 文件定义系统之间怎样沟通。

文件类型目的常见用途
.protoProtocol Buffers schemagRPC service
.graphqlGraphQL schema 或 queryGraphQL API
.wsdlWeb service definitionSOAP service
.avscAvro schemaKafka 和 data pipeline
.jsonOpenAPI documentREST API documentation
.yamlOpenAPI documentREST API documentation

.proto 例子:

syntax = "proto3";

service UserService {
  rpc GetUser (GetUserRequest) returns (UserResponse);
}

message GetUserRequest {
  string id = 1;
}

message UserResponse {
  string id = 1;
  string email = 2;
}

这个文件不是在实现 service。它是在定义 contract。

server 和 client 可以根据它 generate code,让两边同意同一个 communication shape。

自动化和脚本文件

自动化文件用来重复、稳定地执行命令。

文件类型目的常见用途
.shShell scriptLinux/macOS automation
.ps1PowerShell scriptWindows automation
.bat, .cmdWindows command script较旧的 Windows automation
MakefileTask runnerBuild 和 maintenance commands
.github/workflows/*.ymlCI/CD workflowGitHub Actions automation

Shell script 例子:

#!/usr/bin/env bash

npm install
npm run build

PowerShell script 例子:

npm install
npm run build

这些文件的价值是减少手动重复。

比起每次记十条 command,团队可以直接运行一个 script。

Container 和 Deployment 文件

部署文件描述应用离开本地电脑之后应该怎样运行。

文件类型目的常见用途
DockerfileBuild container imageApp containerization
.dockerignore排除 Docker build context 里的文件更快、更干净的 Docker build
docker-compose.yml本地跑多个 containerApp + database + Redis
.tfTerraform configCloud infrastructure
.k8s.yml, .yamlKubernetes resourcesDeployment、service、ingress
nginx.confNginx configurationReverse proxy、static serving、routing

Dockerfile 例子:

FROM node:22-alpine

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .
RUN npm run build

CMD ["npm", "start"]

这个文件不是业务逻辑。它定义的是 application environment 应该怎样被 package 和运行。

Dependency 和 Lock 文件

Dependency 文件告诉项目需要哪些 packages。

Lock 文件记录已经解析出来的精确版本。

文件类型生态目的
package.jsonNode.js声明 dependency 和 scripts
package-lock.jsonnpm锁定精确 dependency tree
yarn.lockYarn锁定精确 dependency tree
pnpm-lock.yamlpnpm锁定精确 dependency tree
pom.xmlMaven / Java声明 Java dependency 和 build config
build.gradleGradle / Java声明 dependency 和 build logic
requirements.txtPython列出 Python packages
poetry.lockPython Poetry锁定精确 dependency version
go.modGo声明 Go module dependency
go.sumGo验证 dependency checksum
Cargo.tomlRust声明 Rust package metadata 和 dependency
Cargo.lockRust锁定精确 dependency version

不要随便删除 lock file。

Lock file 可以让不同机器、CI/CD、production 安装到一致的 dependency version。

Git 和 Ignore 文件

Git 相关文件控制 version history,以及哪些东西不应该被 commit。

文件类型目的
.gitignore告诉 Git 哪些文件要忽略
.gitattributes控制 Git 对不同文件类型的行为
.gitmodules记录 Git submodule

.gitignore 例子:

node_modules
.env
dist
.next

这可以防止 generated files、dependencies 和 secrets 被 commit。

好的 .gitignore 可以让 repository 更干净,也可以降低 accidental leak 的风险。

Log、证书和 Binary 文件

项目里面不是所有文件都是源码文本。

有些文件是 generated output、runtime artifact 或 binary resource。

文件类型目的常见用途
.logRuntime logsDebug、server output
.pem, .key, .crtCertificate 和 keyTLS、SSH、安全连接
.png, .jpg, .webp图片UI assets
.pdf文档输出Report、invoice
.zip, .tar, .gzArchivePackage 或 backup
.wasmWebAssembly binaryBrowser 或 edge runtime module
.mapSource mapDebug bundled JavaScript

这些文件很多时候不是给人手动编辑的。

有些甚至不应该 commit,尤其是 private key、本地 log、generated build artifact。

AI 和 Prompt 文件

现代 AI 项目有时会出现 prompt 相关文件。

文件类型目的常见用途
.prompt普通 prompt text简单可复用 prompt
.prompty结构化 prompt filePrompt engineering workflow
.pomlPrompt orchestration markup结构化 AI instruction 和 agent behavior
.jsonPrompt config 或 evaluation dataDataset、test case、config
.yamlAgent 或 workflow configTool routing、model settings

普通 prompt 在变复杂之后会很难维护,例如它可能包含:

  • role definition
  • task definition
  • tool rules
  • input variables
  • output schema
  • examples
  • evaluation cases

所以有些团队会把 prompt 移到结构化文件里。

简化后的 POML-like 形状可能像这样:

<prompt>
  <role>
    You are a customer support assistant.
  </role>

  <task>
    Answer using only the provided context.
  </task>

  <output-format>
    Return a short answer with source references.
  </output-format>
</prompt>

目标不是取代 programming language。目标是让 prompt behavior 更容易 version、review 和 reuse。

看到不认识的文件类型时怎么判断

遇到不认识的 file type,不要死背 extension。

用这个流程判断:

1. 看文件名

有些文件名直接暴露 ownership,例如 tsconfig.jsonpom.xmlDockerfilepackage.json

2. 看语法形状

大括号通常是 JSON 或代码。缩进可能是 YAML。tag 通常是 XML 或 HTML。SQL keyword 通常是数据库脚本。

3. 看是哪一个工具读取

TypeScript 读取 tsconfig.json。Maven 读取 pom.xml。Docker 读取 Dockerfile

4. 判断是源码还是生成物

源码通常可以编辑。Generated file、lock file、log、build output 要更小心处理。

最重要的问题是:

谁会消费这个文件?

知道 consumer 之后,文件类型就容易理解很多。

实用判断规则

看到一个文件时,可以用这张表快速判断它大概负责什么。

如果文件是为了通常属于
工具设置JSON、YAML、TOML、INI、properties
Java build 和 dependencypom.xmlbuild.gradle
Rich technical articleMDX
普通文档Markdown
数据库结构SQL 或 ORM schema file
API contractProto、GraphQL、OpenAPI、WSDL
部署Dockerfile、YAML、Terraform、Nginx config
自动化Shell、PowerShell、Makefile
Secret 和 runtime setting.env、environment config
精确 dependency versionLock file
Prompt orchestrationPrompt file、Prompty、POML
Certificate 和安全连接材料PEM、CRT、KEY files

文件类型不是随机的。它们是软件项目中不同责任的边界。

核心原则

不同文件类型存在,是因为编程项目里面有不同种类的信息。

配置文件控制工具。Markdown 解释东西。MDX 渲染 rich content。XML 表示严格结构化 markup。JSON 和 YAML 传递或配置结构化数据。SQL 控制数据库。Docker 和 CI 文件自动化部署。Lock file 保证 dependency 一致性。Certificate 文件支持安全通信。Prompt 文件结构化 AI 行为。

看到新的 file type 时,不要只问 extension 是什么意思。要问是哪一个工具读取它、它负责哪一层、它是给人编辑的,还是机器生成的。