claw-code-tingfeng
AGENTS.md4 starsChanged 7 months agoMITView on GitHub
Clawd Code is an AI-powered coding agent framework (Python 3.10+) featuring multi-agent swarm intelligence, self-healing, codebase awareness, enterprise-grade RAG, and a full workflow engine. The swarm system in src/agent/swarm/ orchestrates specialized agents: src/agent/swarm/self_fission/ automatically splits complex tasks into sub-tasks: Located in agents/, these are prompt-based personas that can be used to configure agent behavior: src/brain/world_model.py — The system's "consciousness layer": - Maintains a live dependency graph of the codebase (AST-based) - Trigram-based semantic index for code search - Pattern detection…
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 repository69 other files it gives its agents.
- templates/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- accessibilitySkill
- frontend-designSkill
- python-background-jobsSkill
- python-executorSkill
- python-testing-patternsSkill
- seoSkill
- ai-slop-cleanerSkill
- analyzeSkill
- api-and-interface-designSkill
- ask-claudeSkill
- ask-geminiSkill
- autopilotSkill
- browser-testing-with-devtoolsSkill
- build-fixSkill
- cancelSkill
- ci-cd-and-automationSkill
- code-review-and-qualitySkill
- code-reviewSkill
- code-simplificationSkill
- configure-notificationsSkill
- context-engineeringSkill
- debugging-and-error-recoverySkill
- deep-interviewSkill
- deepsearchSkill
- deprecation-and-migrationSkill
- doctorSkill
- documentation-and-adrsSkill
- ecomodeSkill
- frontend-ui-engineeringSkill
- frontend-ui-uxSkill
- git-masterSkill
- git-workflow-and-versioningSkill
- helpSkill
- hudSkill
- idea-refineSkill
- incremental-implementationSkill
- intent_routerSkill
- keyword_registrySkill
- mode_stateSkill
- noteSkill
- omx-setupSkill
- performance-optimizationSkill
- pipeline_orchestratorSkill
- pipelineSkill
- planning-and-task-breakdownSkill
- planSkill
- ralph-initSkill
- ralph_loopSkill
- ralphSkill
- ralplanSkill
- reviewSkill
- security-and-hardeningSkill
- security-reviewSkill
- shipping-and-launchSkill
- skillSkill
- spec-driven-developmentSkill
- swarmSkill
- tddSkill
- The first 60 shown.
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
13 rules. About 1 is common, 5 are distinctive, and 7 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 77
Use pytest with descriptive test names
- Very specific: line 85
Use structured error codes from src/core/exceptions.py:
- Common: line 110
No secrets or API keys in code
- Very specific: line 129
SKILL.md: Always uppercase, always this exact filename
- Very specific: line 160
Use set -e for fail-fast behavior
- Very specific: line 161
Write status messages to stderr: echo "Message" >&2
- Distinctive: line 162
Write machine-readable output (JSON) to stdout
- Distinctive: line 167
Don't duplicate content between skills — reference other skills instead
- Distinctive: line 168
Don't add skills that are vague advice instead of actionable processes
- Distinctive: line 169
Don't create supporting files unless content exceeds 100 lines
- Very specific: line 170
Don't put reference material inside skill directories — use references/ instead
- Very specific: line 184
claude.ai: Add the skill to project knowledge or paste SKILL.md contents into the conversation
- Very specific: line 186
If a skill requires network access, instruct users to add required domains at claude.ai/settings/capabilities.
≈ “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
This file provides guidance to AI coding agents when working with code in this repository.
Repository Overview
Clawd Code is an AI-powered coding agent framework (Python 3.10+) featuring multi-agent swarm intelligence, self-healing, codebase awareness, enterprise-grade RAG, and a full workflow engine.
Architecture
Multi-Agent Swarm System
The swarm system in src/agent/swarm/ orchestrates specialized agents:
| Role | File | Responsibility |
| Orchestrator | orchestrator.py | Task decomposition and dispatch |
| Coder/Worker | coder_agent.py | Code implementation |
| Architect | architect_agent.py | Architecture design and review |
| Auditor | auditor.py | Code audit and quality checks |
| Integrator | integrator.py | Result integration |
Self-Fission System
src/agent/swarm/self_fission/ automatically splits complex tasks into sub-tasks:
| Detector | File | Triggers On |
| Security | detectors/security.py | Security-sensitive code patterns |
| Performance | detectors/performance.py | Performance-critical operations |
| SQL | detectors/sql_usage.py | Database query patterns |
| CSS/TUI | detectors/css_tui.py | Styling and terminal UI |
| Crypto | detectors/crypto.py | Cryptographic operations |
| Documentation | detectors/doc_needs.py | Documentation gaps |
Agent Personas (Prompt Templates)
Located in agents/, these are prompt-based personas that can be used to configure agent behavior:
- code-reviewer.md — For code review tasks (five-axis evaluation)
- security-auditor.md — For security-focused reviews
- test-engineer.md — For test strategy and quality assurance
World Model (Brain)
src/brain/world_model.py — The system's "consciousness layer":
- Maintains a live dependency graph of the codebase (AST-based)
- Trigram-based semantic index for code search
- Pattern detection (Factory, Strategy, Observer, Singleton, etc.)
- Intent caching for efficient repeated queries
Self-Healing Engine
src/self_healing/engine.py — Autonomous error recovery:
- Error classification (classifier.py)
- AI-driven diagnosis (diagnoser.py)
- Fix generation and application
- Verification (verifier.py)
- Experience storage for future reference
Creating New Code
File Structure
src/
<module>/
__init__.py # Public API exports
<feature>.py # Implementation
tests/
<module>/
test_<feature>.py # Mirror source structureTesting Standards
- Use pytest with descriptive test names
- Follow Arrange-Act-Assert pattern
- Mock at system boundaries (LLM calls, file I/O, network)
- Each test should verify one concept
- Tests must be independent (no shared mutable state)
Error Handling
Use structured error codes from src/core/exceptions.py:
from src.core.exceptions import ClawdError, ErrorCode
raise ClawdError(ErrorCode.CONFIG_MISSING, "API key not configured")Settings
Access settings via the 6-layer config system:
from src.core.settings import AgentSettings
settings = AgentSettings()
model = settings.llm_modelCode Quality Gates
Before submitting changes:
python -m pytest tests/ -v --tb=short— All tests passruff check src/— No lint errors- No secrets or API keys in code
- Error handling uses structured error codes
- New dependencies added to both
requirements.txtandpyproject.toml
Creating New Skills
Directory Structure
skills/
{skill-name}/ # kebab-case directory name
SKILL.md # Required: skill definition
scripts/ # Optional: executable scripts
{script-name}.sh # Bash scripts (preferred)Naming Conventions
- Skill directory:
kebab-case(e.g.web-quality) - SKILL.md: Always uppercase, always this exact filename
- Scripts:
kebab-case.sh(e.g.,deploy.sh,fetch-logs.sh)
SKILL.md Format
---
name: {skill-name}
description: Brief statement of what the skill does. Use when [specific trigger conditions].
---
# {Skill Title}
{Brief description of what the skill does.}See docs/skill-anatomy.md for the full specification.
Best Practices for Context Efficiency
Skills are loaded on-demand — only the skill name and description are loaded at startup. The full SKILL.md loads into context only when the agent decides the skill is relevant. To minimize context usage:
- Keep SKILL.md under 500 lines — put detailed reference material in separate files
- Write specific descriptions — helps the agent know exactly when to activate the skill
- Use progressive disclosure — reference supporting files that get read only when needed
- Prefer scripts over inline code — script execution doesn't consume context (only output does)
- File references work one level deep — link directly from SKILL.md to supporting files
Script Requirements
- Use
#!/bin/bashshebang - Use
set -efor fail-fast behavior - Write status messages to stderr:
echo "Message" >&2 - Write machine-readable output (JSON) to stdout
- Include a cleanup trap for temp files
What Not to Do
- Don't duplicate content between skills — reference other skills instead
- Don't add skills that are vague advice instead of actionable processes
- Don't create supporting files unless content exceeds 100 lines
- Don't put reference material inside skill directories — use
references/instead
Packaging and Distribution
Skills can be packaged for distribution:
cd skills
zip -r {skill-name}.zip {skill-name}/Installation methods:
- Claude Code:
cp -r skills/{skill-name} ~/.claude/skills/ - claude.ai: Add the skill to project knowledge or paste SKILL.md contents into the conversation
If a skill requires network access, instruct users to add required domains at claude.ai/settings/capabilities.
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.

