subagents-discipline
Skill3 starsChanged 7 months agoMITView on GitHub
Core engineering principles for implementation tasks
- Sends data out
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- AvivK5498/Beads-Kanban-UIedited, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- AvivK5498/Beads-Kanban-UI★ 10250% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository21 other files it gives its agents.
- skills/setup/templates/AGENTS.mdAGENTS.md
- skills/setup/templates/CLAUDE.mdCLAUDE.md
- add-supervisorSkill
- architectureSkill
- core-loopSkill
- doSkill
- implementationSkill
- investigateSkill
- manifestoSkill
- planSkill
- productSkill
- qualitySkill
- requirementsSkill
- researchSkill
- reviewSkill
- setupSkill
- specificationSkill
- specSkill
- tasksSkill
- updateSkill
- workflowSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. About 0 are common, 18 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈18
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
Add parameters, flags, or options: not specified in the instructions (e.g., adding isolation: "worktree" to an Agent() call when the skill …
- Distinctive: line 45
Before writing any code, build your full picture by reading three layers — context, contract, and code — in order.
- Distinctive: line 58
If no comments exist, you have no prior investigation.
- Distinctive: line 68
If a design doc path exists, read it.
- Very specific: line 70
For any bead: check these fields in bd show {BEAD_ID} --json for spec references:
- Very specific: line 76
If a spec exists, it takes precedence over your own judgement.
- Distinctive: line 78
If no spec or design doc exists, proceed to Layer 3.
- Distinctive: line 82
When there is no spec defining the HOW, the existing code is your contract.
- Distinctive: line 84
Read the files you will modify (already identified in Layer 1, or find them yourself)
- Distinctive: line 103
Before writing code that touches external data (API, database, file, config):
- Distinctive: line 105
Fetch/read the ACTUAL data: - run the command, see the output
- Distinctive: line 106
Note exact field names, types, formats: - not what docs say, what you SEE
- Distinctive: line 107
Code against what you observed: - not what you assumed
- Distinctive: line 153
"Close the Loop" principle: Run the actual thing. Verify it works.
- Distinctive: line 160
Before claiming you can't fully test:
- Distinctive: line 172
When you choose between alternatives, pick a pattern, or make a non-obvious choice:
- Distinctive: line 185
When you implement something differently from what the spec/design doc defined — always log why:
- Distinctive: line 197
DECISION: Always log when multiple valid approaches exist and you picked one
- Distinctive: line 198
DEVIATION: Always log when your implementation differs from the spec in any way
- Distinctive: line 205
Before marking the bead as in-review, you MUST leave a structured completion comment summarizing what was done.
- Distinctive: line 236
When you catch yourself thinking:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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
Implementation Principles
Foundational Axiom: Tasks are WHAT; Specs are HOW
Tasks define WHAT to do. Specs define HOW to do it.
- A task (bead) answers: Why does this work exist? What must be true when it's done?
- A spec answers: How should it be built? What patterns, interfaces, types, and architecture to use?
This separation is non-negotiable. Tasks contain verifiable acceptance criteria and pointers to specs — never implementation details. Specs contain the technical contract — never project management metadata. When both exist, the spec is the implementation authority; the task is the tracking authority.
Rule 0: Follow Instructions Exactly — No Unilateral Decisions
This is the highest-priority rule. It overrides any "good idea" you might have.
You MUST execute skill instructions exactly as written. You are NOT allowed to:
- Add parameters, flags, or options not specified in the instructions (e.g., adding
isolation: "worktree"to an Agent() call when the skill doesn't mention it) - Remove or modify parameters that are explicitly specified
- Change the execution strategy (e.g., switching from sequential to parallel, or vice-versa)
- Add "safety" measures the instructions didn't ask for
- Simplify, optimize, or "improve" the approach beyond what was requested
If you believe the instructions are wrong, incomplete, or could be improved — ASK THE USER FIRST. Do not act on your own judgement. The cost of asking is near zero. The cost of a unilateral decision can break the entire workflow.
This applies to:
- Tool calls (Agent, Bash, etc.)
- Git operations (branch naming, commit strategy)
- File operations (paths, naming conventions)
- Any deviation from what the skill/spec/design doc defines
Violations of this rule are treated as bugs, not as helpful initiative.
Rule 1: Read Before You Implement
Before writing any code, build your full picture by reading three layers — context, contract, and code — in order. Each layer may or may not exist. Use what's available.
Layer 1: Context (bead comments)
bd show {BEAD_ID}
bd comments {BEAD_ID}Comments may contain investigation findings (INVESTIGATION:), dispatch context (DISPATCH:), root cause analysis, affected files, gotchas. Use this context — don't re-investigate what Sherlock already traced.
Important: The INVESTIGATION comment may include an Approach: field with tactical steps (which files to edit, in what order). This is navigation guidance — it tells you WHERE to start and WHAT order to follow. It does NOT replace the spec's HOW (patterns, interfaces, types). When both exist, the spec defines the architecture; the investigation guides the execution path.
If no comments exist, you have no prior investigation. Proceed to the next layers — they become more important.
Layer 2: Contract (spec / design doc)
The spec or design doc defines how to implement — field names, types, interfaces, architecture decisions. This is your implementation contract.
For epic children (BEAD_ID contains a dot, e.g., BD-001.2):
bd show {EPIC_ID} --json | jq -r '.[0].design // empty'If a design doc path exists, read it. Match it exactly — same field names, same types, same shapes.
For any bead: check these fields in bd show {BEAD_ID} --json for spec references:
design— one-line pointer to spec section (e.g., "See spec.md § Section 3")external-ref— pipe-separated doc references (e.g., "SPEC §7.4 | PLAN task 06.03")spec-id— PRD reference (e.g., "PRD 9.14")notes— may contain additional context
If a spec exists, it takes precedence over your own judgement. Follow it. If you believe the spec is wrong, log a DEVIATION: comment explaining why — don't silently diverge.
If no spec or design doc exists, proceed to Layer 3.
Layer 3: Code (confrontation)
When there is no spec defining the HOW, the existing code is your contract. Before implementing:
- Read the files you will modify (already identified in Layer 1, or find them yourself)
- Understand the patterns, conventions, and interfaces in the surrounding code
- Implement following what you observed — same patterns, same style, same abstractions
This is not re-investigating. The investigation found WHERE and WHAT. Code confrontation tells you HOW the codebase expects you to work.
What you have determines your approach
| Context (comments) | Contract (spec) | Code | Approach |
| Yes | Yes | — | Spec is the contract. Comments guide you to the right files. |
| Yes | No | Read | Follow existing code patterns. Log DECISION: for non-obvious choices. |
| No | Yes | — | Spec is the contract. Find entry points yourself. |
| No | No | Read | Read the bead description and acceptance criteria — that's your minimal spec. Confront the code. Log DECISION: for every choice. |
Rule 2: Look Before You Code
Before writing code that touches external data (API, database, file, config):
- Fetch/read the ACTUAL data - run the command, see the output
- Note exact field names, types, formats - not what docs say, what you SEE
- Code against what you observed - not what you assumed
WITHOUT looking first:
Assumed: column is "reference_images"
Reality: column is "reference_image_url"
Result: Query fails
WITH looking first:
Ran: SELECT column_name FROM information_schema.columns WHERE table_name = 'assets';
Saw: reference_image_url
Coded against: reference_image_url
Result: WorksRule 3: Test Functionally (Close the Loop)
Principle: Optimize for the fastest way to verify your work actually works.
| You built | Fast verification | Slower alternative |
| API endpoint | curl the endpoint, check response | Write integration test |
| Database change | Run migration, query the result | Write migration test |
| Frontend component | Load in browser, interact with it | Write component test |
| CLI tool | Run the command, check output | Write unit test |
| Config change | Restart service, verify behavior | N/A — just verify |
Two strategies:
- User Journey Tests — Test actual behavior as a user experiences it:
# API: curl with real data curl -X POST localhost:3000/api/users -d '{"name":"test"}' -H "Content-Type: application/json" # CLI: run the command bd create "Test" -d "Testing" && bd list # Error case: curl with invalid auth curl -X POST localhost:3000/api/users -H "Authorization: Bearer invalid" - Component Tests — Supplement for regression prevention when fast verification isn't possible:
- Complex logic with many edge cases
- Code that runs in environments you can't easily replicate
- Shared libraries used by multiple consumers
"Close the Loop" principle: Run the actual thing. Verify it works. Check error cases.
Good: "Curled endpoint with invalid auth, got 401 as expected" Bad: "Wrote tests, they compile"
Rule 4: Use Your Tools
Before claiming you can't fully test:
- Check what MCP servers you have access to - list available tools
- If any tool can help verify the feature works, use it
- Be resourceful - browser automation, database inspection, API testing tools
Rule 5: Log Decisions and Deviations (Mandatory when applicable)
During implementation, log every non-trivial decision and any deviation from the spec/design doc as bead comments. This creates a traceable decision trail that the QA agent and humans can review.
Decisions
When you choose between alternatives, pick a pattern, or make a non-obvious choice:
bd comments add {BEAD_ID} "DECISION: [what you chose] instead of [alternative] because [reason]"Examples:
DECISION: Used Strategy pattern instead of switch/case because the spec lists 5+ payment providers and more will be addedDECISION: Stored session in Redis instead of memory because the spec requires horizontal scalingDECISION: Used batch insert instead of individual inserts because the dataset exceeds 1000 rows
Deviations
When you implement something differently from what the spec/design doc defined — always log why:
bd comments add {BEAD_ID} "DEVIATION: Spec said [X], implemented [Y] because [reason]"Examples:
DEVIATION: Spec said use REST endpoint, implemented WebSocket because the data requires real-time pushDEVIATION: Spec defined field as 'user_id: string', implemented as 'user_id: number' because the DB schema uses integer PKsDEVIATION: Spec included pagination, deferred to separate task because it requires a new dependency
When to log:
- DECISION: Always log when multiple valid approaches exist and you picked one
- DEVIATION: Always log when your implementation differs from the spec in any way
- Skip if the choice is trivially obvious and self-explanatory from the code
Rule 6: Log Completion Summary (Mandatory)
Before marking the bead as in-review, you MUST leave a structured completion comment summarizing what was done. This is consumed by the code-reviewer agent and the orchestrator to understand the scope of changes without reading every diff.
bd comments add {BEAD_ID} "COMPLETED:
Summary: [1-2 sentences describing what was implemented/fixed]
Files changed: [list of files modified, created, or deleted]
Decisions: [count of DECISION comments logged, or 'none']
Deviations: [count of DEVIATION comments logged, or 'none — implemented as spec']
Tests: [what was tested and how — functional verification, unit tests, etc.]"Then record the canonical implementation state (enforced by the SubagentStop hook — skipping this blocks the workflow):
bd set-state {BEAD_ID} impl=done --reason "Implementation completed on branch {branch-name}"Neither step is optional. Every implementation task must have both the COMPLETED comment and impl=done state before marking in-review.
Rule 7: Never Close Beads
Your job ends at in-review. After pushing and marking the bead in-review with needs-review label, stop. Do NOT run bd close.
Closing beads is the user's decision after review and QA gates pass. This is non-negotiable.
Red Flags - Stop and Verify
When you catch yourself thinking:
- "This should work..." → run it and see
- "I assume the field is..." → look at the actual data
- "I'll test it later..." → test it now
- "It's too simple to break..." → verify anyway
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.

