craft
AGENTS.md4 starsChanged 4 months agoMITView on GitHub
This document provides development guidelines for agentic coding assistants working on the Craft plugin repository. It covers build/lint/test commands, code style conventions, and project-specific practices.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository42 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- system-architectSkill
- project-detectorSkill
- audit-routerSkill
- command-skill-token-efficiencySkill
- plugin-auditSkill
- sync-featuresSkill
- backend-designerSkill
- devops-helperSkill
- frontend-designerSkill
- git-workflowSkill
- dist-extrasSkill
- distribution-strategistSkill
- homebrew-formula-expertSkill
- homebrew-multi-formulaSkill
- homebrew-setup-wizardSkill
- homebrew-workflow-expertSkill
- architecture-decision-recordsSkill
- changelog-automationSkill
- claude-md-lifecycleSkill
- guard-auditSkill
- hooksSkill
- insights-applySkill
- mode-controllerSkill
- drive-engineSkill
- plan-orchestratorSkill
- repo-triageSkill
- session-stateSkill
- task-analyzerSkill
- workflow-engineSkill
- orchestrator-resilienceSkill
- project-plannerSkill
- preflight-checkSkill
- releaseSkill
- test-generatorSkill
- test-strategistSkill
- adhd-workflowSkill
- brainstorm-insightsSkill
- brainstormSkill
- grillSkill
- prompt-refinerSkill
- background-task-managerSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
37 rules. About 1 is common, 22 are distinctive, and 14 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈22
Distinctive · estimate
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 83
Use Optional[T] for nullable types, not Union[T, None]
- Very specific: line 84
Use List[T], Dict[K, V] instead of bare list, dict
- Very specific: line 85
Use dataclasses with field() for complex defaults
- Very specific: line 102
Use specific exception types, not bare Exception
- Distinctive: line 128
Use triple quotes with proper formatting
- Very specific: line 165
Lists: Use dashes (-) not asterisks (*)
- Distinctive: line 166
Line length: No hard limit (MD013 disabled)
- Distinctive: line 167
Headers: No duplicate headers in same section (MD024 with siblings_only)
- Distinctive: line 170
Code blocks: Use fenced code blocks with language specification
- Very specific: line 185
Use conventional commits: feat:, fix:, docs:, refactor:, test:
- Distinctive: line 186
Keep first line under 50 characters
- Distinctive: line 187
Use imperative mood ("Add feature" not "Added feature")
- Distinctive: line 198
Never commit directly to main: - always use feature branches
- Very specific: line 199
Use worktrees for isolation: git worktree add ../feature-name -b feature/name
- Very specific: line 214
Test shell scripts in tests/*.sh
- Very specific: line 215
Use descriptive test method names: test_should_ignore_broken_links
- Distinctive: line 237
Test individual functions/classes in isolation
- Distinctive: line 238
Use descriptive test names that explain the scenario
- Distinctive: line 256
Use realistic test data
- Common: line 270
Never: commit secrets or credentials
- Distinctive: line 271
Use absolute paths for file operations
- Distinctive: line 279
Use type hints to catch type-related issues early
- Distinctive: line 285
Prefer list comprehensions over explicit loops when appropriate
- Very specific: line 286
Use pathlib.Path for path operations
- Distinctive: line 292
Keep unit tests under 100ms each
- Distinctive: line 293
Use appropriate fixtures for test data
- Distinctive: line 301
Update README.md when adding new features
- Distinctive: line 303
Document breaking changes clearly
- Distinctive: line 304
Keep installation instructions current
- Distinctive: line 310
Document API contracts and expectations
- Very specific: line 323
Update version in package.json
- Distinctive: line 324
Run full test suite
- Distinctive: line 326
Create GitHub release with changelog
- Very specific: line 332
Count mismatches: Run ./scripts/validate-counts.sh to identify discrepancies
- Distinctive: line 333
Test failures: Check for missing dependencies or environment issues
- Very specific: line 334
Link validation errors: Update .linkcheck-ignore for known broken links
- Very specific: line 335
Markdown linting: Run npx markdownlint-cli2 "/*.md" to identify issues
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md - Development Guidelines for Craft Plugin
This document provides development guidelines for agentic coding assistants working on the Craft plugin repository. It covers build/lint/test commands, code style conventions, and project-specific practices.
Build/Lint/Test Commands
Primary Test Commands
# Run all unit tests (581+ tests, ~90% coverage)
python3 tests/test_craft_plugin.py
# Run all tests with pytest (includes integration tests)
python3 -m pytest tests/ -v
# Run specific test file
python3 tests/test_craft_plugin.py::TestClass::test_method
# Run integration tests only
python3 tests/test_integration_*.py
# Run dependency system tests
bash tests/test_dependency_management.sh
# Run specific integration test
python3 tests/test_integration_dependency_system.pyLinting and Validation
# Validate command/skill/agent counts match documentation
./scripts/validate-counts.sh
# Markdown linting (24 rules enforced)
npx markdownlint-cli2 "**/*.md" --config .markdownlint.json
# Build documentation site
mkdocs build
# Check broken links (with ignore rules)
python3 tests/test_craft_plugin.py -k "broken_links"Development Workflow
# Quick validation (lint + test counts)
./scripts/validate-counts.sh && python3 tests/test_craft_plugin.py
# Full CI validation
python3 -m pytest tests/ -v && npx markdownlint-cli2 "**/*.md"
# Documentation validation
mkdocs build && python3 tests/test_craft_plugin.py -k "broken_links"Code Style Guidelines
Python Conventions
Imports
# Standard library imports first
import json
import os
import re
from dataclasses import dataclass, field
from pathlib import Path
from typing import Dict, List, Optional, Tuple
# Third-party imports (none in this project)
# Local imports (alphabetized)
from .complexity_scorer import calculate_complexity_score
from .validators import validate_command_structureType Hints
- Always use type hints for function parameters and return values
- Use
Optional[T]for nullable types, notUnion[T, None] - Use
List[T],Dict[K, V]instead of barelist,dict - Use dataclasses with
field()for complex defaults
def calculate_complexity_score(task: str) -> int:
"""Calculate complexity score for a task."""
@dataclass
class TestResult:
name: str
passed: bool
duration_ms: float
details: str
category: str = "general"Error Handling
- Use specific exception types, not bare
Exception - Provide descriptive error messages
- Log errors appropriately with context
try:
result = risky_operation()
except FileNotFoundError as e:
log(f"Configuration file not found: {config_path}")
return TestResult(name, False, 0, f"Missing config: {e}", "structure")
except json.JSONDecodeError as e:
log(f"Invalid JSON in plugin.json: {e}")
return TestResult(name, False, 0, f"JSON parse error: {e}", "structure")Naming Conventions
- Functions:
snake_case(e.g.,calculate_complexity_score) - Classes:
PascalCase(e.g.,IgnorePattern) - Constants:
UPPER_SNAKE_CASE(e.g.,MULTI_STEP_INDICATORS) - Variables:
snake_case(e.g.,task_lower) - Methods:
snake_case, descriptive names
Documentation
- Always include docstrings for public functions and classes
- Use triple quotes with proper formatting
- Include Args and Returns sections for complex functions
def should_ignore(self, source_file: str, target_link: str) -> Tuple[bool, Optional[str]]:
"""
Check if a broken link should be ignored.
Args:
source_file: Path to the file containing the link
target_link: The broken link target
Returns:
(should_ignore, category) tuple
"""Markdown Conventions
Frontmatter (for Commands/Skills/Agents)
---
description: Brief description of the command
arguments:
- name: mode
description: Execution mode
required: false
default: default
- name: path
description: Target path
required: true
---Formatting Rules (from .markdownlint.json)
- Lists: Use dashes (
-) not asterisks (*) - Line length: No hard limit (MD013 disabled)
- Headers: No duplicate headers in same section (MD024 with siblings_only)
- Inline HTML: Limited allowed elements (MD033)
- List spacing: Consistent single-line spacing (MD030)
- Code blocks: Use fenced code blocks with language specification
Table Formatting
| Mode | Time | Focus |
|------|------|-------|
| default | < 30s | Quick smoke tests |
| debug | < 120s | Verbose with traces |Git Workflow
Commit Messages
- Use conventional commits:
feat:,fix:,docs:,refactor:,test: - Keep first line under 50 characters
- Use imperative mood ("Add feature" not "Added feature")
- Reference issues when applicable
git commit -m "feat: add complexity scoring for task routing"
git commit -m "fix: resolve broken link validation in docs"
git commit -m "test: add integration tests for dependency system"Branching
- Never commit directly to main - always use feature branches
- Use worktrees for isolation:
git worktree add ../feature-name -b feature/name - Branch naming:
feature/description,fix/issue-number
Project Structure
Command Organization
- Commands in
commands/directory with category subdirs - Each command is a
.mdfile with frontmatter - Frontmatter defines arguments, descriptions, defaults
Test Organization
- Unit tests in
tests/test_*.py - Integration tests in
tests/test_integration_*.py - Test shell scripts in
tests/*.sh - Use descriptive test method names:
test_should_ignore_broken_links
File Structure Expectations
commands/
├── arch/ # Architecture analysis commands
├── ci/ # CI/CD commands
├── code/ # Code quality commands
├── docs/ # Documentation commands
└── git/ # Git workflow commands
skills/ # Specialized capabilities
agents/ # Multi-step task handlers
utils/ # Shared Python utilities
scripts/ # Shell scripts and toolsTesting Practices
Unit Tests
- Test individual functions/classes in isolation
- Use descriptive test names that explain the scenario
- Mock external dependencies
- Assert both positive and negative cases
def test_calculate_complexity_score():
# Test multi-step task detection
score = calculate_complexity_score("lint and test the code")
assert score >= 2, "Multi-step tasks should score at least 2"
# Test simple task
score = calculate_complexity_score("run tests")
assert score < 2, "Simple tasks should score less than 2"Integration Tests
- Test component interactions
- Use realistic test data
- Validate end-to-end workflows
- Clean up test artifacts
Test Coverage
- Target 90%+ coverage
- Focus on critical paths
- Include edge cases and error conditions
Security Considerations
File Operations
- Never commit secrets or credentials
- Use absolute paths for file operations
- Validate file paths before operations
- Handle file permissions appropriately
Input Validation
- Sanitize user inputs
- Validate file paths exist before operations
- Use type hints to catch type-related issues early
Performance Guidelines
Code Efficiency
- Prefer list comprehensions over explicit loops when appropriate
- Use
pathlib.Pathfor path operations - Cache expensive operations when possible
- Profile performance-critical code
Test Performance
- Keep unit tests under 100ms each
- Use appropriate fixtures for test data
- Parallelize independent tests when possible
- Mock slow external dependencies
Documentation Standards
README Updates
- Update README.md when adding new features
- Include usage examples and screenshots
- Document breaking changes clearly
- Keep installation instructions current
Inline Documentation
- Comment complex algorithms
- Explain non-obvious business logic
- Document API contracts and expectations
CI/CD Integration
Pre-commit Hooks
- Markdown linting enforced (24 rules)
- Count validation for commands/skills/agents
- Test execution required
- Link validation with ignore patterns
Release Process
- Update version in package.json
- Run full test suite
- Validate documentation builds
- Create GitHub release with changelog
Troubleshooting
Common Issues
- Count mismatches: Run
./scripts/validate-counts.shto identify discrepancies - Test failures: Check for missing dependencies or environment issues
- Link validation errors: Update
.linkcheck-ignorefor known broken links - Markdown linting: Run
npx markdownlint-cli2 "**/*.md"to identify issues
Debug Commands
# Verbose test output
python3 -m pytest tests/ -v -s
# Debug specific test
python3 -m pytest tests/test_craft_plugin.py::test_plugin_json_exists -v -s
# Profile test performance
python3 -m pytest tests/ --durations=10This guide ensures consistent development practices across all contributors to the Craft plugin project.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

