Skip to main content
Glama

init_project

Creates project structure and task breakdown using Spec-Driven Development methodology based on project requirements.

Instructions

【初始化工程】按照 Spec-Driven Development 方式创建项目结构和任务分解,参考 https://github.com/github/spec-kit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputNo项目需求描述(可以是文字描述或文件内容)
project_nameNo项目名称

Implementation Reference

  • The core handler function `initProject` that implements the tool logic. It constructs a detailed Markdown prompt instructing on Spec-Driven Development project initialization, including directory structure, documents like constitution.md, spec.md, plan.md, etc., and returns it as tool content.
    export async function initProject(args: any) {
      try {
        const input = args?.input || "";
        const projectName = args?.project_name || "新项目";
    
        const message = `你需要按照 Spec-Driven Development(规范驱动开发)的方式初始化项目,参考 https://github.com/github/spec-kit 的工作流程。
    
    📋 **项目需求**:
    ${input}
    
    🎯 **初始化步骤**:
    
    **第一步:创建项目基础结构**
    在当前工作区创建以下目录和文件:
    
    \`\`\`
    .
    ├── memory/
    │   └── constitution.md    # 项目宪法(核心原则和约束)
    ├── specs/
    │   └── 001-${projectName.toLowerCase().replace(/\s+/g, '-')}/
    │       ├── spec.md        # 功能规格说明
    │       ├── plan.md        # 实现计划
    │       ├── tasks.md       # 任务分解
    │       └── research.md    # 技术调研
    ├── scripts/
    │   ├── check-prerequisites.sh
    │   └── setup.sh
    └── templates/
        ├── spec-template.md
        ├── plan-template.md
        └── tasks-template.md
    \`\`\`
    
    **第二步:生成 constitution.md**
    在 \`memory/constitution.md\` 中定义项目的核心原则,包括:
    - 代码风格规范
    - 架构原则
    - 安全准则
    - 测试要求
    - 文档标准
    
    **第三步:生成 spec.md(功能规格)**
    在 \`specs/001-${projectName.toLowerCase().replace(/\s+/g, '-')}/spec.md\` 中详细描述:
    - 项目背景和目标
    - 用户故事(User Stories)
    - 功能需求
    - 非功能需求
    - 约束条件
    - 验收标准
    
    **第四步:生成 plan.md(实现计划)**
    分析需求并生成实现计划,包括:
    - 技术栈选择(框架、数据库、部署方式等)
    - 系统架构设计
    - 模块划分
    - 数据模型设计
    - API 设计
    - 关键技术决策
    
    **第五步:生成 research.md(技术调研)**
    对选定的技术栈进行调研:
    - 确认版本兼容性
    - 识别潜在风险
    - 记录最佳实践
    - 列出参考文档
    
    **第六步:生成 tasks.md(任务分解)**
    将实现计划分解为可执行的任务,格式如下:
    \`\`\`markdown
    # 任务分解
    
    ## 阶段 1:项目初始化
    - [ ] Task 1.1: 搭建项目骨架 (文件: ./setup.sh)
    - [ ] Task 1.2: 配置开发环境 (文件: ./devcontainer.json)
    - [ ] Task 1.3: [P] 初始化数据库 (文件: ./database/schema.sql)
    
    ## 阶段 2:核心功能实现
    - [ ] Task 2.1: 实现数据模型 (文件: ./src/models/)
    - [ ] Task 2.2: [P] 实现用户认证 (文件: ./src/auth/)
    - [ ] Task 2.3: [P] 实现业务逻辑 (文件: ./src/services/)
      依赖: Task 2.1
    
    ## 阶段 3:API 开发
    - [ ] Task 3.1: 创建 REST API (文件: ./src/api/)
      依赖: Task 2.2, Task 2.3
    - [ ] Task 3.2: [P] 编写 API 测试 (文件: ./tests/api/)
    
    ## 阶段 4:前端开发
    - [ ] Task 4.1: 搭建前端框架 (文件: ./frontend/)
    - [ ] Task 4.2: [P] 实现 UI 组件 (文件: ./frontend/components/)
    - [ ] Task 4.3: [P] 集成 API (文件: ./frontend/services/)
      依赖: Task 3.1
    
    ## 阶段 5:测试与部署
    - [ ] Task 5.1: 集成测试 (文件: ./tests/integration/)
    - [ ] Task 5.2: 性能测试 (文件: ./tests/performance/)
    - [ ] Task 5.3: 部署配置 (文件: ./deploy/)
    
    ---
    **标记说明**:
    - [P]: 可以并行执行的任务
    - 依赖: 必须在指定任务完成后才能开始
    \`\`\`
    
    **第七步:生成辅助脚本**
    创建项目管理脚本:
    - \`scripts/check-prerequisites.sh\`: 检查环境依赖
    - \`scripts/setup.sh\`: 自动化项目初始化
    - \`scripts/create-new-feature.sh\`: 创建新功能分支
    
    📝 **注意事项**:
    1. 所有文件使用 Markdown 格式,保持清晰的结构
    2. 遵循项目 constitution 中定义的原则
    3. 任务分解要足够细致,每个任务应该在 2-4 小时内完成
    4. 标记清楚任务之间的依赖关系
    5. 识别可以并行执行的任务以优化开发效率
    
    🚀 **开始执行**:
    现在请按照上述步骤创建项目结构和所有必需的文档。`;
    
        return {
          content: [
            {
              type: "text",
              text: message,
            },
          ],
        };
      } catch (error) {
        const errorMessage =
          error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: "text",
              text: `❌ 初始化项目失败: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
    }
  • The input schema definition for the 'init_project' tool, specifying optional parameters 'input' (project description) and 'project_name'.
      name: "init_project",
      description: "【初始化工程】按照 Spec-Driven Development 方式创建项目结构和任务分解,参考 https://github.com/github/spec-kit",
      inputSchema: {
        type: "object",
        properties: {
          input: {
            type: "string",
            description: "项目需求描述(可以是文字描述或文件内容)",
          },
          project_name: {
            type: "string",
            description: "项目名称",
          },
        },
        required: [],
      },
    },
  • src/index.ts:465-466 (registration)
    The dispatch registration in the CallToolRequestSchema handler's switch statement, mapping 'init_project' tool name to the initProject function call.
    case "init_project":
      return await initProject(args);
  • src/tools/index.ts:3-3 (registration)
    Re-export of the initProject handler from its module in the tools index file, allowing import in src/index.ts.
    export { initProject } from "./init_project.js";
  • src/index.ts:11-15 (registration)
    Import statement in src/index.ts that brings in the initProject handler from tools/index.js for use in tool dispatch.
    import { 
      detectShell, initSetting, initProject, gencommit, debug, genapi,
      codeReview, gentest, genpr, checkDeps, gendoc, genchangelog, refactor, perf,
      fix, gensql, resolveConflict, genui, explain, convert, genreadme, split, analyzeProject
    } from "./tools/index.js";
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool creates project structure and task decomposition, which implies a write/mutation operation, but doesn't disclose critical behavioral traits such as: whether this overwrites existing files, what permissions are required, if it's idempotent, what the output looks like, or any rate limits. For a tool that likely modifies the filesystem, this lack of transparency is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, consisting of a single sentence that directly states the tool's purpose. It includes a reference link for additional context, which is efficient. However, the link might be considered extraneous if not essential, slightly reducing conciseness. Overall, it's well-structured with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (a tool that likely creates files/directories), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns, error conditions, side effects, or how it interacts with the filesystem. For a mutation tool with zero annotation coverage, this is inadequate; the description should provide more behavioral and output context to be complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with clear descriptions for both parameters ('input' as project requirement description, 'project_name' as project name). The tool description doesn't add any parameter-specific information beyond what's in the schema. According to the rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description, which applies here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '按照 Spec-Driven Development 方式创建项目结构和任务分解' (create project structure and task decomposition according to Spec-Driven Development). It specifies the verb ('创建' - create) and resource ('项目结构和任务分解' - project structure and task decomposition), and mentions the methodology. However, it doesn't explicitly differentiate from sibling tools like 'analyze_project' or 'init_setting', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal usage guidance. It references an external link (https://github.com/github/spec-kit) for Spec-Driven Development, implying this tool should be used for initial project setup following that methodology. However, it doesn't specify when to use this tool versus alternatives like 'analyze_project' or 'init_setting', nor does it mention prerequisites or exclusions. The guidance is implied but insufficient for clear decision-making.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mybolide/mcp-probe-kit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server