Capture architectural decisions made during Claude Code sessions as structured ADRs. Auto-detects decision moments, records context, alternatives considered, and rationale. Maintains an ADR log so future developers understand why the codebase is shaped the way it is.
git clone https://github.com/affaan-m/ECC.git--- name: architecture-decision-records description: Capture architectural decisions made during Claude Code sessions as structured ADRs. Auto-detects decision moments, records context, alternatives considered, and rationale. Maintains an ADR log so future developers understand why the codebase is shaped the way it is. metadata: origin: ECC --- # Architecture Decision Records Capture architectural decisions as they happen during coding sessions. Instead of decisions living only in Slack threads, PR comments, or someone's memory, this skill produces structured ADR documents that live alongside the code. ## When to Activate - User explicitly says "let's record this decision" or "ADR this" - User chooses between significant alternatives (framework, library, pattern, database, API design) - User says "we decided to..." or "the reason we're doing X instead of Y is..." - User asks "why did we choose X?" (read existing ADRs) - During planning phases when architectural trade-offs are discussed ## ADR Format Use the lightweight ADR format proposed by Michael Nygard, adapted for AI-assisted development: ```markdown # ADR-NNNN: [Decision Title] **Date**: YYYY-MM-DD **Status**: proposed | accepted | deprecated | superseded by ADR-NNNN **Deciders**: [who was involved] ## Context What is the issue that we're seeing that is motivating this decision or change? [2-5 sentences describing the situation, constraints, and forces at play] ## Decision What is the change that we're proposing and/or doing? [1-3 sentences stating the decision clearly] ## Alternatives Considered ### Alternative 1: [Name] - **Pros**: [benefits] - **Cons**: [drawbacks] - **Why not**: [specific reason this was rejected] ### Alternative 2: [Name] - **Pros**: [benefits] - **Cons**: [drawbacks] - **Why not**: [specific reason this was rejected] ## Consequences What becomes easier or more difficult to do because of this change? ### Positive - [benefit 1] - [benefit 2] ### Negative - [trade-off 1] - [trade-off 2] ### Risks - [risk and mitigation] ``` ## Workflow ### Capturing a New ADR When a decision moment is detected: 1. **Initialize (first time only)** — if `docs/adr/` does not exist, ask the user for confirmation before creating the directory, a `README.md` seeded with the index table header (see ADR Index Format below), and a blank `template.md` for manual use. Do not create files without explicit consent. 2. **Identify the decision** — extract the core architectural choice being made 3. **Gather context** — what problem prompted this? What constraints exist? 4. **Document alternatives** — what other options were considered? Why were they rejected? 5. **State consequences** — what are the trade-offs? What becomes easier/harder? 6. **Assign a number** — scan existing ADRs in `docs/adr/` and increment 7. **Confirm and write** — present the draft ADR to the user for review. Only write to `docs/adr/NNNN-decision-title.md` after explicit approval. If the user declines, discard the draft without writing any files. 8. **Update the index** — append to `docs/adr/README.md` ### Reading Existing ADRs When a user asks "why did we choose X?": 1. Check if `docs/adr/` exists — if not, respond: "No ADRs found in this project. Would you like to start recording architectural decisions?" 2. If it exists, scan `docs/adr/README.md` index for relevant entries 3. Read matching ADR files and present the Context and Decision sections 4. If no match is found, respond: "No ADR found for that decision. Would you like to record one now?" ### ADR Directory Structure ``` docs/ └── adr/ ├── README.md ← index of all ADRs ├── 0001-use-nextjs.md ├── 0002-postgres-over-mongo.md ├── 0003-rest-over-graphql.md └── template.md ← blank template for manual use ``` ### ADR Index Format ```markdown # Architecture Decision Records | ADR | Title | Status | Date | |-----|-------|--------|------| | [0001](0001-use-nextjs.md) | Use Next.js as frontend framework | accepted | 2026-01-15 | | [0002](0002-postgres-over-mongo.md) | PostgreSQL over MongoDB for primary datastore | accepted | 2026-01-20 | | [0003](0003-rest-over-graphql.md) | REST API over GraphQL | accepted | 2026-02-01 | ``` ## Decision Detection Signals Watch for these patterns in conversation that indicate an architectural decision: **Explicit signals** - "Let's go with X" - "We should use X instead of Y" - "The trade-off is worth it because..." - "Record this as an ADR" **Implicit signals** (suggest recording an ADR — do not auto-create without user confirmation) - Comparing two frameworks or libraries and reaching a conclusion - Making a database schema design choice with stated rationale - Choosing between architectural patterns (monolith vs microservices, REST vs GraphQL) - Deciding on authentication/authorization strategy - Selecting deployment infrastructure after evaluating alternatives ## What Makes a Good ADR ### Do - **Be specific** — "Use Prisma ORM" not "use an ORM" - **Record the why** — the rationale matters more than the what - **Include rejected alternatives** — future developers need to know what was considered - **State consequences honestly** — every decision has trade-offs - **Keep it short** — an ADR should be readable in 2 minutes - **Use present tense** — "We use X" not "We will use X" ### Don't - Record trivial decisions — variable naming or formatting choices don't need ADRs - Write essays — if the context section exceeds 10 lines, it's too long - Omit alternatives — "we just picked it" is not a valid rationale - Backfill without marking it — if recording a past decision, note the original date - Let ADRs go stale — superseded decisions should reference their replacement ## ADR Lifecycle ``` proposed → accepted → [deprecated | superseded by ADR-NNNN] ``` - **proposed**: decision is under discussion, not yet committed - **accepted**: decision is in effect and being followed - **deprecated**: decision is no longer relevant (e.g., feature removed) - **superseded**: a newer ADR replaces this one (always link the replacement) ## Categories of Decisions Worth Recording | Category | Examples | |----------|---------| | **Technology choices** | Framework, language, database, cloud provider | | **Architecture patterns** | Monolith vs microservices, event-driven, CQRS | | **API design** | REST vs GraphQL, versioning strategy, auth mechanism | | **Data modeling** | Schema design, normalization decisions, caching strategy | | **Infrastructure** | Deployment model, CI/CD pipeline, monitoring stack | | **Security** | Auth strategy, encryption approach, secret management | | **Testing** | Test framework, coverage targets, E2E vs integration balance | | **Process** | Branching strategy, review process, release cadence | ## Integration with Other Skills - **Planner agent**: when the planner proposes architecture changes, suggest creating an ADR - **Code reviewer agent**: flag PRs that introduce architectural changes without a corresponding ADR
[{"step":"Prepare your session context","action":"Before starting your Claude Code session, ensure the project's ADR directory is initialized (e.g., `mkdir -p docs/adr`). If using a specific ADR template (e.g., Michael Nygard's format), note the filename pattern (e.g., `adr-0001-use-postgresql.md`).","tip":"Use a consistent naming convention for ADRs (e.g., `adr-YYYY-MM-DD-topic.md`) to avoid conflicts and make them easy to reference."},{"step":"Run the session with decision tracking","action":"Execute your code changes in Claude Code while keeping the terminal or IDE open to review decisions. After key decisions (e.g., choosing a library, refactoring a module), pause and ask the AI to generate an ADR for that decision.","tip":"Use phrases like 'Let's capture this decision' or 'Document this as an ADR' to signal to the AI that a structured record is needed."},{"step":"Review and refine the ADR","action":"After the AI generates the ADR, review it for accuracy. Add any missing details (e.g., stakeholder input, performance benchmarks) and save it to the ADR directory. Commit the ADR to version control alongside the code changes.","tip":"Link the ADR to relevant issues or pull requests in your project tracker (e.g., 'See ADR 001 for rationale behind this change')."},{"step":"Maintain the ADR log","action":"Periodically update the ADR log (e.g., `README.md` in the ADR directory) to include links to all ADRs. Use this log to onboard new team members or revisit decisions during retrospectives.","tip":"Automate the log update by adding a script that scans the ADR directory and regenerates the log file (e.g., using `ls docs/adr/*.md > docs/adr/README.md`)."},{"step":"Reference ADRs in future decisions","action":"When making new architectural decisions, review past ADRs to ensure consistency and avoid revisiting old ground. Reference relevant ADRs in commit messages or pull request descriptions.","tip":"Use tools like `grep` or IDE search to quickly find ADRs related to a specific topic (e.g., `grep -r 'ADR 001' .`)."}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/affaan-m/ECC/tree/main/skills/architecture-decision-recordsCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Review the recent changes in [PROJECT_NAME] during this Claude Code session. Identify any architectural decisions made (e.g., technology choices, design patterns, refactoring approaches) and generate an Architecture Decision Record (ADR) for each. Include: decision context, alternatives considered, rationale for the chosen path, and consequences. Format the ADR using the [ADR_TEMPLATE] structure. Focus on decisions that impact the system's long-term maintainability or scalability. [ADDITIONAL_CONTEXT: e.g., 'Focus on the database schema changes in the last 2 hours.']
```markdown # ADR 001: Migration to PostgreSQL from MongoDB **Status:** Accepted **Date:** 2024-05-20 **Context:** The project's MongoDB database has become a bottleneck due to increasing query complexity and the need for ACID transactions. The team evaluated alternatives to address scalability and data integrity concerns. **Alternatives Considered:** 1. **Upgrade MongoDB Cluster:** Increase sharding and optimize indexes. Estimated cost: $15K/year. 2. **Switch to PostgreSQL:** Mature relational database with strong transaction support. Estimated migration effort: 6 weeks. 3. **Hybrid Approach:** Use PostgreSQL for transactional data and MongoDB for unstructured data. Estimated effort: 10 weeks. **Decision:** Adopt PostgreSQL as the primary database. The team prioritized data consistency and long-term maintainability over short-term cost savings. PostgreSQL's robust tooling (e.g., pgAdmin, logical replication) and the team's familiarity with SQL were key factors. **Consequences:** - **Positive:** Improved query performance for complex joins, better support for transactions, and reduced operational overhead for backups and monitoring. - **Negative:** Initial migration effort (6 weeks) and potential downtime during the switch. Legacy MongoDB queries will need refactoring. - **Risks:** Performance tuning required for high-write workloads; team training needed for advanced PostgreSQL features. **Next Steps:** 1. Finalize schema design by [DATE]. 2. Set up staging environment with PostgreSQL. 3. Begin incremental data migration starting with non-critical tables. 4. Schedule team training on PostgreSQL optimization techniques. ```
skills-collection
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan