This document provides the dedicated specifications for AI Agents performing development tasks in the mcp-shrimp-task-manager project.
- Project Name:
mcp-shrimp-task-manager - Purpose: A task management tool designed for AI Agents, emphasizing chain-of-thought, reflection, and style consistency. It converts natural language into structured development tasks with dependency tracking and iterative refinement capabilities.
- Technology Stack:
- Primary Language: TypeScript
- Runtime Environment: Node.js (ES Module)
- Main Frameworks/Libraries: Express.js (for potential API or WebGUI), Zod (for data validation)
- Package Manager: npm
- Core Features:
- Natural language task parsing
- Structured task generation and management
- Task dependency tracking
- Task execution and verification assistance
- Integration with AI Agent's thought processes
- Main Source Code Directory:
src/src/index.ts: Main application entry point or module export point. Modifications to this file require careful impact assessment.src/utils/: General-purpose utility functions.src/types/: TypeScript type definitions. When adding or modifying types, ensure consistency with Zod schemas (if applicable).src/tools/: Project-specific tools or modules for integration with external services.src/models/: Data model definitions (potentially related to Zod schemas).src/prompts/: Prompt templates related to AI interaction. Modifying or adding prompts requires consideration of the potential impact on AI Agent behavior.src/public/: WebGUI or other static assets.src/tests/: Unit and integration tests.
- Compiled Output Directory:
dist/(This directory is auto-generated bytsc. Do not manually modify its contents.). - Configuration Files:
package.json: Project dependencies and scripts. After adding dependencies, you must runnpm install.tsconfig.json: TypeScript compilation settings. Do not modify the"strict": truesetting unless absolutely necessary..env.example&.env: Environment variable settings. Sensitive information must not be committed to version control.
- Documentation:
README.md: Main project documentation.docs/: May contain more detailed architecture, API documentation, etc.CHANGELOG.md: Record of version changes. Must be updated before releasing a new version.data/WebGUI.md: Contains the link to the Task Manager UI.
- Variables and Functions: Use camelCase.
- Do:
const taskName = "example"; function processTask() {} - Don't:
const Task_Name = "example"; function Process_Task() {}
- Do:
- Classes and Interfaces: Use PascalCase.
- Do:
class TaskManager {}; interface ITaskOptions {} - Don't:
class taskManager {}; interface iTaskOptions {}
- Do:
- File Names: Use camelCase or kebab-case for
.tsfiles.- Do:
taskProcessor.ts,task-utils.ts - Don't:
TaskProcessor.ts,task_utils.ts
- Do:
- Constants: Use UPPER_SNAKE_CASE.
- Do:
const MAX_RETRIES = 3; - Don't:
const maxRetries = 3;
- Do:
- Indentation: Use 2 spaces for indentation. Do not use Tab characters.
- Semicolons: Statements must end with a semicolon.
- Quotes: Prefer single quotes (
') for strings, unless the string itself contains single quotes.- Do:
const message = 'Hello World'; const complex = "It\\'s complex"; - Don't:
const message = "Hello World";
- Do:
- Max Line Length: Recommended not to exceed 120 characters.
- Comments:
- Use
//for single-line comments. - Use
/* ... */for multi-line comments. - Use JSDoc-style comments for public functions, classes, and methods.
- Do:
/** * Processes a given task. * @param taskId The ID of the task to process. * @returns True if successful, false otherwise. */ function processTaskById(taskId: string): boolean { // implementation return true; }
- Do:
- Use
- Type Annotations: All function parameters, return values, and variable declarations should have explicit type annotations. The use of the
anytype is forbidden, except in very specific and unavoidable circumstances, which require a comment explaining the reason.- Do:
function greet(name: string): string { return \Hello, ${name}`; }` - Don't:
function greet(name): any { return "Hello, " + name; }
- Do:
- Interfaces vs. Type Aliases: Prefer Interfaces for defining object shapes and Type Aliases for defining union types, tuples, or other complex types.
- ES Modules: Use
importandexportsyntax.- Do:
import { Task } from './models/task'; export class TaskService {} - Don't:
const Task = require('./models/task'); module.exports = TaskService;
- Do:
- Strict Mode: The project has
"strict": trueenabled. All TypeScript strict mode errors must be resolved.
- Single Responsibility Principle (SRP): Each function and class should be responsible for only one piece of functionality.
- Keep It Simple, Stupid (KISS): Avoid overly complex solutions.
- Don't Repeat Yourself (DRY): Extract common logic into reusable functions or classes, stored in
src/utils/or relevant modules. - Error Handling:
- Use
try...catchto handle expected errors. - Provide clear error messages for critical operations.
- Consider using custom error classes to provide richer error information.
- Use
- Logging:
- Add logging for critical operations, error handling, and important state changes.
- Consider using structured logging.
- Do not log sensitive information (e.g., passwords, API Keys).
-
Data structures defined in
src/models/orsrc/types/should primarily use Zod schemas for definition and validation. -
Zod schemas should be kept in sync with TypeScript types. You can use
z.infer<typeof schema>to generate types.-
Do:
import { z } from "zod"; export const TaskSchema = z.object({ id: z.string().uuid(), name: z.string().min(1), description: z.string().optional(), }); export type Task = z.infer<typeof TaskSchema>;
-
- Route definitions should be clear and follow RESTful principles (for APIs).
- Middleware should be effectively organized, e.g., error handling middleware, logging middleware.
- All external input (request parameters, body, query) must be validated using Zod or a similar mechanism.
- Adding Dependencies:
- Must first evaluate the necessity, maintenance status, and security of the dependency.
- Use
npm install <package-name>(for runtime dependencies) ornpm install --save-dev <package-name>(for development dependencies). - Must specify a clear version range in
package.json(e.g.,^1.2.3or~1.2.3), avoid using*.
- Updating Dependencies: Regularly check and update dependencies to the latest stable version to get security patches and new features. Assess potential breaking changes before updating.
- Removing Dependencies: If a dependency is no longer needed, remove it using
npm uninstall <package-name>and remove related references from the code.
- Understand the Task: Carefully read the task description, requirements, and acceptance criteria.
- Branch Management: Create a new feature branch from the latest
main(ordevelop) branch. Branch names should be concise and clear, e.g.,feature/add-task-editingorfix/login-bug. - Coding and Testing:
- Code according to these guidelines.
- Must write unit tests (stored in
src/tests/) for new features or bug fixes. - Run
npm run buildto ensure the code compiles successfully. - Run
npm run devornpm run startlocally for testing.
- Code Committing:
- Git commit messages should follow the Conventional Commits specification (e.g.,
feat: add user authentication,fix: resolve issue with task sorting). - Do not commit code with
console.logor other debugging messages to the main branches.
- Git commit messages should follow the Conventional Commits specification (e.g.,
- Pull Request (PR):
- Push the feature branch to the remote repository and create a Pull Request to the
main(ordevelop) branch. - The PR description should clearly explain the changes and their purpose.
- Push the feature branch to the remote repository and create a Pull Request to the
- Code Review: Wait for other developers or AI Agents to conduct a code review.
- Merge and Deploy: After the code review is passed, merge the PR. The deployment process follows the project setup.
- Main Branches:
main: Represents the stable and deployable product version.develop(if used): Represents the latest in-development version.
- Commit Frequency: Small, frequent, and meaningful commits are recommended.
- Resolving Conflicts: When merging or rebasing branches, if conflicts occur, they must be resolved carefully to ensure the correctness and integrity of the code.
- Before releasing a new version,
CHANGELOG.mdmust be updated. - The log should include the version number, release date, and a list of new features, bug fixes, and breaking changes.
- Modifying
src/types/orsrc/models/(especially Zod schemas):- Must check and update all files that reference these types or schemas to ensure type consistency.
- Must re-run relevant tests.
- Modifying
src/index.ts:- If the module's exported API is changed, must check all dependent projects or files and make necessary adjustments.
- Modifying
package.json(especiallydependenciesorscripts):- Must notify team members or relevant AI Agents to run
npm install. - If
scriptsare modified, ensure the CI/CD process (if any) is updated accordingly.
- Must notify team members or relevant AI Agents to run
- Modifying
.env.example:- Must synchronously update
.envfiles in all development environments and notify team members.
- Must synchronously update
- Modifying
README.mdor documents indocs/:- If changes involve core features or usage, must ensure the accuracy and timeliness of the documentation.
- When receiving a vague development instruction (e.g., "optimize the task list display"):
- Attempt to Clarify: If possible, request more specific details or expected outcomes from the user or task initiator.
- Analyze Context: Check related code (
src/), existing UI (if any), and relevant issues (if any) to infer intent. - Propose Solutions: Based on the analysis, propose 1-2 concrete implementation plans, explaining their pros, cons, and estimated effort.
- Wait for Confirmation: Do not proceed with large-scale code modifications until clear instructions are received.
- Priorities:
- User Experience: Avoid program crashes and provide friendly error messages.
- Data Integrity: Ensure errors do not lead to data corruption or inconsistency.
- System Stability: Log detailed error information for troubleshooting.
- Choices:
- For predictable errors (e.g., invalid user input), handle them within the operation's context and provide feedback.
- For unexpected system errors, catch, log, and potentially re-throw or trigger a global error handling mechanism.
- When needing to introduce a new third-party library:
- Check Existing: Verify if a similar library that meets the requirements already exists in the project.
- Evaluate Options:
- Activity and Community Support: Choose well-maintained libraries with active communities.
- Lightweight: Avoid introducing libraries that are too large or have redundant features.
- Security: Check for known security vulnerabilities.
- License: Ensure compatibility with the project's license.
- Minimization Principle: Only introduce libraries that are genuinely needed.
- Do not directly modify any files in the
dist/directory. This directory contains compiled output. - Do not assume a new dependency is available without running
npm install. - Do not commit untested or unfinished code directly to the main branches (
mainordevelop). Use feature branches. - Do not commit code containing API Keys, passwords, or other sensitive information to the version control system. Use the
.envfile for such information. - Do not make major changes to the core architecture or public API without notification and approval.
- Do not ignore TypeScript type errors. All errors reported by
tscmust be resolved. - Do not use the
anytype without a very good reason and a corresponding comment. - Do not leave large amounts of
console.logor other temporary debugging code in the codebase. - Do not release a new version without updating
CHANGELOG.md. - Do not introduce third-party libraries incompatible with the project's MIT license.
- When the project's tech stack, core architecture, main workflow, or important guidelines change, this document must be updated accordingly.
- Update requests should clearly specify the sections and content to be changed.
- If a vague "update rules" instruction is received, the AI Agent must:
- Autonomously analyze the current codebase for changes (e.g.,
git diff, recent commits). - Compare the existing
shrimp-rules.mdwith the project's current state to find inconsistent or outdated rules. - List the inferred update points and their justifications in the
process_thoughtstage. - Propose specific modifications or directly edit this document.
- Strictly prohibited to seek clarification from the user on a vague request before performing an autonomous analysis.
- Autonomously analyze the current codebase for changes (e.g.,
This development guide aims to ensure that AI Agents can participate in the development of the mcp-shrimp-task-manager project efficiently, consistently, and securely.