xiaohongshu
xiaohongshu
aposd-maintaining-design-quality
Enforce strategic programming discipline when modifying existing code. Guide through STOP-ASK-DECIDE-VERIFY workflow with urgency tier assessment (trivial/minor/standard/emergency). Include when NOT to refactor (Chesterton's Fence, performance-critical, no tests) and block tactical shortcuts via ...
Full skill instructions
If you're not making the design better, you're probably making it worse. Working code is not a high enough standard.
Zero Tolerance: There is no acceptable threshold for making design worse. Even "small" compromises accumulate invisibly—dozens of tactical decisions compound into unmaintainable systems.
Not all changes need equal analysis. Match effort to impact:
| Tier | Examples | Required Analysis |
|---|---|---|
| Trivial | Typo fixes, whitespace, comment corrections | None—just do it |
| Minor | Bug fix <5 lines, config tweak, dependency bump | Quick check: does this fit cleanly? |
| Standard | New feature, refactoring, multi-file change | Full workflow: STOP-ASK-DECIDE-VERIFY |
| Emergency | Production down, security breach, data loss | Minimal fix + TODO + 24hr follow-up |
BEFORE making any change to existing code:
1. RESIST the temptation to make a quick fix
2. ASK: "Is the current system design still the best one,
given the change I need to make?"
3. IF NO: Refactor so you end up with the best possible design
Goal: After this change, the system should have the structure
it would have had if designed from the start with this in mind
4. IF YES: Make the change within the existing design
But verify: does your change fit cleanly?
5. BEFORE COMMIT: Scan all changes to verify documentation reflects them
| Approach | Short-Term | Long-Term |
|---|---|---|
| Tactical | 10-20% faster | Permanently slower (20%+ productivity loss) |
| Strategic | 10-20% slower | Benefits in months; eventually free |
Recommended investment: About 10-20% of development time on design improvements.
Tactical path:
- Each "quick fix" adds small complexity
- Complexities accumulate (dozens/hundreds of small things)
- Eventually: system is hard to understand and modify
- Result: development slows permanently
Strategic path:
- Each change improves or maintains design
- Past investments save time for future investments
- Eventually: strategic investments become FREE
- Result: development accelerates over time
A system's design cannot be conceived correctly at the outset. The design of a mature system is determined more by changes made during evolution than by initial conception.
Implication: Every modification matters. Your changes ARE the design.
Even under tight deadlines, ask:
"Is this the best I can possibly do to create a clean system design,
given my current constraints?"
| If... | Then... |
|---|---|
| Large refactoring is impractical | Look for alternatives that are almost as clean but faster |
| Cannot do proper cleanup now | Create accountability plan (see below) |
| Refactoring creates incompatibilities | Seek middle-ground solutions |
Never acceptable: Making the design worse without a plan to fix it.
If you defer refactoring, it MUST be tracked:
1. CREATE a ticket/issue with specific scope
2. TIMEBOX: Must be addressed within 2 sprints (or equivalent)
3. ADD a code comment: // TODO(YYYY-MM-DD): [ticket-id] - [what needs fixing]
4. ESCALATE if 3+ deferrals exist in same area → refactoring becomes MANDATORY
"I'll do it later" without these steps = you won't do it.
Refactoring is not always the right choice:
| Scenario | Why Refactoring Hurts | What to Do Instead |
|---|---|---|
| Chesterton's Fence code | Looks bad but handles subtle edge cases | Investigate WHY before changing |
| Performance-critical paths | Clean abstractions add overhead | Document why it's intentionally ugly |
| Regulatory/audited code | Changes trigger expensive re-certification | Get explicit approval first |
| Legacy with no tests | Refactoring without tests is dangerous | Add tests first, or freeze |
| Code with external quirk dependencies | Other systems rely on undocumented behavior | Coordinate with dependents |
| Near end-of-life systems | Investing in dying code is waste | Document, don't improve |
| During incident response | Changing more increases blast radius | Minimal fix only |
| When you don't understand domain | "Better design" reflects misunderstanding | Learn first, refactor later |
Key question: Do I understand WHY the code is the way it is?
Skip the normal workflow ONLY when ALL of these conditions are true:
Emergency does NOT mean:
| Red Flag | Symptom | What It Signals |
|---|---|---|
| Quick Fix Mentality | "Just make it work for now" | Tactical programming—design will degrade |
| Complexity Creep | Adding special cases, conditionals, dependencies | Design is getting worse, not better |
| Patch Stacking | Workarounds on top of workarounds | Technical debt accumulating |
| Tactical Tornado | Very fast developer leaving messes | Others will pay for their speed |
| Stale Comments | Comments no longer match code | Trust erosion; documentation debt |
| Deferred Cleanup | "We'll refactor later" | Later never comes; delay becomes permanent |
| Tempting Shortcut | Why It Feels Right | Why It's Wrong |
|---|---|---|
| "Just make it work" | Faster now | Creates technical debt forever; 20%+ productivity loss |
| "Don't touch working code" | Risk averse | Prevents improvement; design decays anyway |
| "We'll refactor later" | Deferred pain | Later never comes; there's always another crunch |
| "This is just a quick fix" | Scope limiting | Quick fixes accumulate; complexity is incremental |
| "I don't have time" | Deadline pressure | 10-20% investment now saves more later |
| "It's not that bad" | Normalizing decay | Each small compromise adds up to major complexity |
| Tempting Shortcut | Why It Feels Right | Why It's Wrong |
|---|---|---|
| "I'm not the owner of this module" | Not my responsibility | If you're touching it, you're responsible for it |
| "The original author did it this way" | Appeal to authority | Original author might have been wrong, or context changed |
| "This matches the existing pattern" | Consistency | Consistently following a bad pattern spreads the problem |
| Tempting Shortcut | Why It Feels Right | Why It's Wrong |
|---|---|---|
| "This is temporary/experimental code" | It's throwaway | Nothing is as permanent as temporary code |
| "The tests pass" | Correctness verified | Passing tests ≠ good design |
| "I'll document the tech debt" | I'm being responsible | Documentation is not remediation |
When modifying code, keep comments synchronized:
| Rule | Why |
|---|---|
| Position comments close to code they describe | Developers see them when modifying |
| Avoid duplicating documentation | One source of truth |
| Document each decision exactly once | Find the single most obvious place |
| Scan all changes before commit | Catch stale comments early |
| Myth | Reality |
|---|---|
| "We'll pay it back" | Most technical debt is never fully repaid |
| "It's a fair trade" | Amount paid back exceeds amount borrowed |
| "Just this once" | Once you start, it's difficult to change |
| "Everyone does it" | Complexity accumulates rapidly if everyone programs tactically |
EVERY TIME you modify existing code:
1. STOP - Resist the quick fix temptation
2. ASK - "Is this design still optimal for what I need?"
3. DECIDE:
- Design is optimal? Make change cleanly
- Design needs work? Refactor first
- Can't refactor now? Plan when you will
4. VERIFY - Comments updated? Design improved or maintained?
5. COMMIT - Only when design is better or at least not worse
THE RULE:
"If you're not making the design better, you're probably making it worse."
INVESTMENT MATH:
- 10-20% slower now → faster forever
- "Quick fix" now → 20%+ slower forever
| After | Next |
|---|---|
| Design assessment done | Back to task checklist |
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience