Ai development guide

From shinpr/claude-code-workflows · View interactive version

Ai development guide is an AI agent skill from the GitHub repository shinpr/claude-code-workflows. Applies technical decision criteria, anti-pattern detection, debugging, and quality gates for backend and frontend code. Use when implementing, reviewing, or diagnosing code, code smells, failures, or implementation completeness.

How to use this skill

Skill file

AI Developer Guide - Technical Decision Criteria and Anti-pattern Collection

Value-First Engineering

Inspect until the evidence identifies the lowest-total-complexity solution that delivers the required user, operator, or maintainer value while keeping the system correct and maintainable.

Judge total complexity across every activated surface: user decisions, settings, modes, concepts, outputs, persistent state, and implementation paths, together with their UX, runtime, testing, documentation, and maintenance cost. Compare only dimensions that differ between viable approaches. Prefer reuse or no new mechanism when it delivers the same required value and proof at lower total complexity.

Fail-Fast Fallback Design Principles

Core Principle

Make all errors visible and traceable with full context. Prioritize primary code reliability over fallback implementations. Excessive fallback mechanisms mask errors and make debugging difficult.

Implementation Guidelines

Default Approach
When Fallbacks Are Acceptable
Layer Responsibilities

Error Masking Detection

Review Triggers (require design review):

Another handler may remain when it covers a distinct failure mode with a documented recovery owner, state outcome, and observable signal.

Before Implementing Any Fallback:

  1. Identify the accepted requirement, boundary contract, project policy, or Design Doc entry that defines this fallback
  2. Document the business justification
  3. Make activation observable at the boundary that owns diagnosis or recovery through one existing UI, log, or metric channel; when logging is that channel, log once with sensitive data redacted
  4. Add new monitoring or alerting only when an operational requirement or project policy requires it

Implementation Pattern

AVOID: Silent fallback that hides errors
    <handle error>:
        return DEFAULT_VALUE  // Error hidden, debugging impossible

PREFERRED: Explicit failure with context
    <handle error>:
        <attach operation context>
        IF this boundary owns diagnosis: <log once>
        <propagate error>  // Re-throw exception, return Error, return error tuple

Adaptation: Use language-appropriate error handling (exceptions, Result types, error tuples, etc.)

Criteria for Code Duplication

Keep concrete implementations separate while their apparent similarity is accidental or their change reasons differ. Consolidate when repository evidence shows the same business rule, algorithm, validation contract, or coordinated change responsibility is maintained in multiple places.

Criteria for Commonalization

Cases for Commonalization

Cases to Avoid Commonalization

Common Failure Patterns and Avoidance Methods

Pattern 1: Symptom Fixes

Symptom: Fixing one error or finding causes new ones, or the same defect returns through another path

Cause: Each symptom is repaired where it appeared, leaving what produced it in place

Avoidance: Trace the failures or findings in hand to what produces them; findings with one cause are corrected once at that cause, so no other path can produce them again

Pattern 2: Circumventing Correctness Guarantees

Symptom: Bypassing safety mechanisms (type systems, validation, contracts)

Cause: Impulse to avoid correctness errors

Avoidance: Use language-appropriate safety mechanisms (static checking, runtime validation, contracts, assertions)

Pattern 3: Implementation Without Sufficient Testing

Symptom: Many bugs after implementation

Cause: Accepted behavior left without a test that proves it

Avoidance: Prove each delivered behavior at the boundary where it is observed

Pattern 4: Building on Unverified Premises

Symptom: Dependent work fails, or workarounds accumulate, once an assumed premise proves false

Cause: Treating an assumed capability, behavior, or existing implementation as fact

Avoidance: When an unverified premise could invalidate the chosen approach, check it by the cheapest sufficient means before building dependent work on it. When results contradict the premise, reconsider the approach before patching its parts. Keep this reasoning in the active task; it needs no separate artifact.

Pattern 5: Insufficient Existing Code Investigation

Symptom: Duplicate implementations, architecture inconsistency, integration failures, adopting outdated patterns

Cause: Insufficient understanding of existing code before implementation; referencing only nearby files without verifying representativeness

Avoidance Methods:

Quality Assurance Mechanism Awareness

Before executing quality checks, identify what quality mechanisms exist for the change area:

Quality Check Workflow

Discover the repository's configured quality entry points and the categories they cover. Use the categories below as the applicable evidence checklist:

Follow repository-declared command composition or ordering when it exists. Otherwise choose an order that respects command dependencies and provides useful feedback. Completion requires every applicable configured check to pass.

Situations Requiring Technical Decisions

Timing of Abstraction

Performance vs Readability

Granularity of Contracts and Interfaces

Scope Expansion

Implementation Completeness Assurance

Impact Analysis: Risk-Scaled 3-Stage Process

Complete these stages sequentially before implementation. For an isolated change with no public contract, data-flow, integration, or configuration impact, concise notes or search evidence are sufficient. Use the structured report for cross-boundary, high-risk, or multi-consumer changes.

1. Discovery - Identify all affected code:

2. Understanding - Analyze each discovered location:

3. Identification - Record the affected units, risks, and implementation order at the depth required by the change. For expanded analysis, use:

## Impact Analysis
### Direct Impact
- [Unit]: [Reason and modification needed]

### Indirect Impact
- [System]: [Integration path → reason]

### Data Flow
[Source] → [Transformation] → [Consumer]

### Risk Assessment
- High: [Complex dependencies, fragile areas]
- Medium: [Moderate coupling, test gaps]
- Low: [Isolated, well-tested areas]

### Implementation Order
1. [Start with lowest risk or deepest dependency]
2. [...]

Proceed when discovery and understanding cover the accepted outcome, governing boundaries, and required adjacent dependencies, and each material risk has an implementation, verification, or unresolved-decision disposition.

Unused Code Deletion

When an artifact made obsolete by the requested change is detected:

Existing Code Modification

Required by the requested change? No → Preserve unless the change proves it obsolete
                               Yes → Working and compatible? Yes → Fix/Extend
                                                             No → Repair or replace with migration/rollback evidence

Principle: Prefer clean implementation over patching broken code

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.