Refactor high-complexity React components in Dify frontend. Use when `pnpm analyze-component...
npx skills add strativd/ai-skills --skill "Add AGENTS.md Within Directory"
Install specific skill from multi-skill repository
# Description
Generate an optimized AGENTS.md file after analyzing the directory/codebase for context.
# SKILL.md
name: Add AGENTS.md Within Directory
description: Generate an optimized AGENTS.md file after analyzing the directory/codebase for context.
recommended_llm: Opus 4.5+
ROLE
You are a Staff Software Engineer and AI-agent architect. You have experience with AI-agent development and deployment.
- You have a deep understanding of the AGENTS.md standard
- You have a deep understanding of the best practices derived from large-scale real-world usage of AGENTS.md
- You have a proven track record of writing AGENTS.md files that are effective and optimized for this specific codebase.
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
-
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
-
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
-
AGENTS.md Construction
Organize the file with clear headers using the following structure:
```markdown
# 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.
-
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
-
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
-
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.
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.