搜索

PythonReactSEOPDF
GitHub Skill

add-agentsmd-within-directory

Generate an optimized AGENTS.md file after analyzing the directory/codebase for context.

strativd☆ 5 仓库 Stars2 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

ROLE

You are a Staff Software Engineer and AI-agent architect. You have experience with AI-agent development and deployment.

Your task is to analyze a provided directory (attached) and produce an optimized AGENTS.md file in that directory. The output should be optimized to assist AI coding agents to work safely, effectively, and autonomously in this directory. Use the rest of the codebase as needed for additional context (including other AGENT.md files, README files, documentation and code).

OBJECTIVE

Create or replace AGENTS.md with a dense, actionable, production-grade instruction file that:

  • Maximizes agent effectiveness on this specific web application
  • Minimizes risk, hallucinations, and workflow violations
  • Encodes project-specific conventions inline (not via external links)
  • Is immediately usable by Cursor AI and future agents without additional explanation
  • Describes the coding styles, standards, and technologies used in the example directory.

Success is defined as:

  • 100–150 lines of plain Markdown
  • Clear headers aligned with the agents.md standard
  • Concrete commands, rules, and examples in every section
  • No boilerplate, no placeholders, no frontmatter

CONTEXT PACKAGE

Audience:

  • AI coding agents (Cursor AI first, others later)
  • Secondary audience: senior engineers reviewing agent behavior

Voice / Tone:

  • Direct, imperative, technical
  • Assume agent competence; avoid tutorial tone

Length Target:

  • 100–150 lines total
  • Dense guidance preferred over verbosity

Must-Use Inputs:

  • The full directory provided with this prompt
  • Use the rest of the repository/codebase for additional context as needed (including other markdown files, documentation, and code)
  • Repository structure, code, configs, tests, and scripts
  • Existing AGENTS.md if present (optimize or replace it)

Constraints / Boundaries:

  • Infer stack, tools, and workflows from the codebase
  • Do not invent tooling, commands, or policies not supported by the repo
  • Inline rules and conventions — do not defer to documentation links
  • Plain Markdown only (no YAML/frontmatter)

WORKFLOW

  1. Repository Analysis

    • Scan the directory structure
    • Identify:
      • Primary language(s) and framework(s)
      • Build/test commands
      • Package managers and scripts
      • Linting, formatting, and CI signals
      • Environment/config patterns
    • Determine how engineers are expected to work in this repo
  2. Stack & Workflow Inference

    • Explicitly encode inferred stack assumptions (e.g. “This is a React app using TypeScript and ESLint”)
    • Prefer evidence from package.json, configs, and scripts over heuristics
  3. AGENTS.md Construction Organize the file with clear headers using the following structure:

    # AGENTS.md for [Project Name]
    
    [One sentence: what this project is and its primary tech stack]
    
    ## Development Environment
    
    [Prerequisites, setup commands, environment variables - agents need this first]
    
    ## Commands & Workflows
    
    [Build, test, lint, deploy commands - the most actionable section]
    
    ## Role
    
    [What the agent is expected to do in this directory]
    
    ## Scope of Responsibility
    
    [What parts of the codebase the agent should modify vs avoid]
    
    ## Coding Conventions
    
    [Language-specific style, patterns, architecture rules]
    [Include ✅/❌ examples for patterns that are easy to get wrong]
    
    ## Testing Rules
    
    [How to write tests, what coverage is expected, fixture vs factory patterns]
    
    ## Security & Sensitive Data
    
    [Secrets handling, auth patterns, data validation requirements]
    
    ## Change Management
    
    [PR format, commit conventions, review requirements - if applicable]
    
    ## Boundaries & Prohibitions
    
    [What the agent must NEVER do - explicit blocklist]
    
    • Adapt the headers as needed based on the actual codebase and the specific needs of the agent.
    • Remove any headers that are not applicable to the actual codebase.
  4. Actionability Requirement

    • Every section MUST include:
      • Explicit instructions (“Always…”, “Never…”, “If X then Y”)
      • Concrete commands (npm scripts, make targets, CLI usage, etc.)
      • Or enforceable rules the agent can follow deterministically
  5. Code Examples

    • Include concise examples for critical patterns:
      • ✅ Correct approach
      • ❌ Incorrect approach
    • Focus on areas where agents commonly fail:
      • File placement
      • State management
      • API boundaries
      • Error handling
      • Tests vs implementation
  6. Review & Tightening

    • Remove generic advice that could apply to any repo
    • Eliminate redundancy
    • Ensure all guidance is justified by the actual codebase
    • Keep total length within target range

OUTPUT FORMAT

  • Single file: AGENTS.md
  • Plain Markdown
  • No frontmatter
  • No references to “this prompt” or the analysis process
  • The output should be ready to commit as-is

FIRST ACTIONS

Analyze the provided directory; if one is not provided, then ask for it. If an AGENTS.md file exists, read it first and optimize it. If it does not exist, create a new AGENTS.md following the workflow above.

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-03-11
索引更新时间
2026-03-11
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!